Computer programs should be in such a way that it not only makes things work but also makes it easier to modify it( for various reasons like fixing bugs, modifying logic, adding a new feature). Unlike good code, the bad code does the opposite i.e. makes everything difficult. “It was the bad code that brought the company down”, says Robert C. Martin in his book — Clean Code.
The primary reason for writing bad code into software programs is “Deadline”. Thoughts like “If I don’t do what my manager says, I’ll be fired”. Probably not. Most managers want the truth, even when they don’t act like it. Most managers want good code, even when they are obsessing about the schedule. They may defend the schedule and requirements with passion, but that’s their job. It’s your job to defend the code with equal passion.
To drive this point home, what if you were a doctor and had a patient who demanded that you stop all the silly hand-washing in preparation for surgery because it was taking too much time? Clearly, the patient is the boss; and yet the doctor should absolutely refuse to comply. Why? Because the doctor knows more than the patient about the risks of disease and infection. It would be unprofessional (let alone be a crime) for the doctor to comply with the patient.
Similarly, going by that analogy, it is unprofessional for programmers to bend to the will of managers who won’t be able to understand the risks of making messes. And most importantly, you will not make the deadline by making the mess. Indeed, the mess will slow you down instantly and will force you to miss the deadline. The only way to meet the deadline — the only way to go fast — is to keep the code as clean as possible at all times.
To sum it all up, control your urge to write bad code to meet deadlines. Deadlines are always there! Instead of writing bad code and meeting deadlines prefer writing good code even if you miss deadlines. Practice explicitly and deliberately to write clean code.Soon, with practice, you’ll become so fluent in writing clean code which will enable you to stay on track and finish on or before the deadline.
Happy Coding !!
I think if you get into a good rhythm and are familiar with the problem at hand, you no longer really have to make that tradeoff (not that I can achieve this consistently)
Ben Halpern, thanks for sharing your thoughts.
To comment on your thought, humans tend to get attracted towards instant gratification rather than the process of working harder/longer for greater good and I think this will make people make the tradeoff and that's why I recommend my controlling the urge to make the tradeoff.
Yeah. But it gets complicated when there are whole teams, expectations, ignorances, etc.
I agree with you, but I would be more precise concerning the medical example. Of course, it would be unprofessional not to wash his/her hand before a surgery. But it is also unprofessional not to comply with the patient, you don't have the right to do whatever you want on the body of your patient, even as a doctor. Consent is important. Without consent you break communication and trust.
As a developer, I explain to my manager how I need to work, because we're partners first and foremost. With proper communication, managers can understand the risks of making messes.
Absolutely!
You are so right, hope PMs/CPOs will see this article
yes indeed. bad code will slow you down. also i like the doctor example I'll keep it always in mind. thank you !
Missing deadlines is acceptable as long as it's communicated adequately early enough for the manager to take measures.