Programming, as I understand it, is something that needs one to solve problems by analytical thinking. But one thing that I have noticed recently reviewing code is that a lot of people code in a pretty haphazard, “just finish it” kind of way. What happens due to this is that, you end up with a lot of crazy code. Crazy code?! Oh, this is not code that won’t work. It will work all right… cause that was the objective from the start right? to get it working. What makes it crazy is that, it present to you the work created by a shut-out mind. Sometimes it feels like the person was almost brain dead or highly doped. Yup! I find no traces of the logical work by a thinking mind.
There will always be those who are no good at programming. Who are just doing a job with no love for the programming and logic that goes behind it. I can’t seem to find a way to help them, but what was more shocking was that, a lot of good programmers too wrote crazy code.Â Why?! One thing that totally kills the thinking mind are deadlines set by a non thinking mind. When you work in a services company, and have clients who always want the code ready before they thought of developing it you get mindless deadlines. Yes, you can argue; you can get extentions… But whenever there is a deadline, that leave no scope for a programmer to sit there, think about the situation and decide the best solution, you are bound to find crazy code.
Who pays for it?! Before we talk about who pays, lets see what all costs we are talking about here. I have found that you spend more time writing crazy code that writing well thought out code. Yes it may appear that you are just scribbling on paper when you should be programming… but that saves time. So the first cost comes in extra time spent by programmers. The code is inefficient, so system performance is degraded. User experience will be bad and you are bound to loose value. This code is difficult to understand, debug, modify, fix, maintain… they all add to a lot of extra cost. In the end you will hire more programmers, tighten the deadline, mess up the code even more, and come up with a crappy product. Losses losses losses….
If you are a programmer who wants to avoid writing crazy code, I suggest writing a small plan on paper, needn’t be a complex flow chart or something, but just a few lines of step by step documentation of how you plan to solve the problem at hand. Before this is ready, don’t even start coding. You are bound to miss out a lot of things. This plan is not foolproof, but avoid a lot of logical errors.
If you are someone who sets deadlines…. GIVE YOUR PROGRAMMERS TIME TO THINK!