What is good code? The one which is following best programming patterns or the one which just does it’s job simple what is required?
Writing a better code everyday is every programmer’s job and dream. A Programmer should learn from his past projects and experiences every time he start or initialize with something new. Whether it is using Patterns to solve common problem or be it writing reusable generalized code.
When it comes to writing generalized code/solution the programmer/developer has to think from wide perspective about the problem and divide the solution in a way that it could be used in other alternate situations which are not seen as of yet but could arise in future.
As programmer gains experience he learns from his experience what works out and what not in various situations. Experience teaches a Leader/Programmer by problem. The more no of problem one faces it helps him learn faster by solving them. It highly depends on the kind of work/project (enviornment) one is dealing with..!
Recently Vance Lucas wrote on his artical that early performance benchmarking is a disease but actually it is not really. I believe it depends on the kind of project you are dealing with. Although his post has targeted my one of the PHP Performance Tips artical which was related to “Writing better code with PHP… although some of them might not be useful with newer PHP versions but it does really matter.
But the question is if you/clients are more concerned about the performance which in most cases will be than it is good to start thinking about Performance from the day one. I know about firms/companies or clients looking at the Language/Tool/Framework benchmarks before taking decision on which tool/language to choose for the Project. This approach is better than crying after spending time, efforts and money on it.
Actually no one likes build a software which is great by architectural design but when it comes to performance it is real dull.
Although this artical dosn’t provide any tips to improve code in any language but in the end I can say that evaluating any code to Bad/Better/Best Code is relative and depends on the criterias and cases you are evaluating with. Work quality is relative to demand. As anytime we can’t have good, cheap and fast all together.
Ultimately the Good code is which performs it’s job perfectly and is easy to maintain in future. (It includes writing test cases and following proper commenting and everything..)
Readers’ comments and thoughts are welcome as I would like to hear from you as well.