Most of us think that we are very good developers but honestly speaking, it's quite a bit other way round. It's very common to see following piece of code,
bool myFlag;
if(MyFunction() == true)
{
myFlag = true;
}
else
{
myFlag = false;
}
If you write this kind of code then.....you obviously need help some hard work. If you don't and you are actually a decent developer, even then there is always room for improvement. So here's a guide for all those who believe in improving themselves.
Just like any other craft, there is no shortcut to becoming a better programmer, it's all good old classic hard work. Here are some tips which I have gathered over the years and which many other top coders recommend,
1. Read the Code
Read , read and read the code you write. Just like a normal essay writing, code gets better when you review it over and over. Reading the code helps in understanding the overall structure and catching errors which may come during run time. It infact directly affects your unit testing time as chances are that you will pass the testing in first attempt. My personal experience says that reading the code makes me catch errors which would otherwise be very tough to be produced by normal QA testing, mostly because of complex scenarios.
2. Read the Code....that's others Code
Going everyday to your job and writing code all day long doesn't make you a better developer. You would have to see what others are doing. Take up others code, that's of people who have a good reputation as a programmer and read their code. Internet is full of open sourced projects, many companies have opened the source code of many of their products, pick any product that you might have enjoyed using or about which you might have wondered that exactly how it was done and just read the code and play with it. This will teach what smart techniques people are using.
Apart from that, reading others code is an art which isn't that common. Some developers say that it's a gift. If you disagree with me then recall the last time when your manager tried to give you an existing code base and asked to change one of the major functions, chances are that it wasn't your favorite assignment. I believe, the fear of reading others code is more to do with the fear of unknown than anything else. So kill that fear of yours by reading codes of other developers including your colleagues, but just for the sake of keeping your social ranking intact, don't be too emphatic in terms of pointing their mistakes or rather don't point them at all unless you think that it's critical to the project.
3. Join an open source project
By joining an open source project you can get to experience many things very early in your career such as participating in more than one phase of SDLC, direct interaction with the client that's end user in this case, and a coding approach of your choice that's you don't really have to follow the red tapped process of the company. You could also see the results of your efforts much more quickly than normal long term projects which usually come software houses way. Overall open source project not only gives you first hand experience in terms of working with a team with a more active role than a normal junior or mid level developer and it also helps you in getting your communication skills fine tuned and understand end users requirements better.
You may say that it's not important to get to know end user in order to sharpen coding skills, but it in fact gives another perspective to your work because now you also have an idea of how the users are using your applications and what other future expansions are expected.
4. Learn more than one language
I can't emphasize more that how important it is to know more than one language. And if you are a computer science graduate then learning a new language should be second to your nature. Knowing more than one language gives you a new perspective in terms of approaching a problem and figuring out a solution. Every language has it's own constructs but it's always possible that a concept of Java can be used in some form in Dot Net. Similarly, your ASP.Net will definitely see a boast if you know how the underlying response/request process works.
So don't make the mistake of sticking to one language, try to keep your language profile diverse.
5. Basics first
If the only data structure you use is ArrayList or Hashtable then shame on you (seriously!). Keep your knowledge of basic data structures always updated, using a B+ tree instead of a binary tree might make all the difference in the performance of your algorithm but in order to do that you need to know what exactly B+ tree is. Similarly it's also good to know basic algorithms.
With the ultra fast machines we have these days, it's not really critical to have highly optimized code and any efforts in that regard would eventually make it difficult for you to maintain the code. But you still would have to keep a check e.g. O(N square) is definitely something to avoid. So you should be able to do some basic code profiling.
Enjoy programming!