I'd like to think I've become a much better programmer over the past year. Looking back at my old code, I can tell that I grew a lot.
Here's how I did it.
Spend Time Programming
Practice makes perfect. The same is true with programming. The bad news is that programming is hard and takes a long time to learn. The good news is that if you're a professional programmer, you're spending 40+ hours a week (probably) practicing your programming and getting paid for it too!
As a full-time programmer, I've had gained more than 2000 hours of programming time since last year, and I've hopefully learned a lot from it. A good amount of improvement just comes from the job.
Spend Time Learning How to Program
Give me six hours to chop down a tree and I will spend the first four sharpening the axe. - Abraham Lincoln
While on-the-job experience is important, you can't just expect to learn everything from it. Instead, you need to deliberately learn too. There are a couple of ways to do this:
1.) Read books on how to program. Practical Object-Oriented Design in Ruby is good for Ruby, but has general applications to all sorts of object-oriented programming. Advanced R is great for R, but isn't super generalizable. The Pragmatic Programmer has good general lessons on programming better.
2.) Learn from better programmers. Ask people to review your code and offer suggestions on how to make it better. Implement those suggestions and learn from them.
3.) Read the code of better programmers. Learn from how they approach things.
It's important to be deliberate about doing this, even making time during the workday to do so. While it may seem like "slacking from work", it is exactly the opposite -- it's setting you up in the long-term to be better at your job. Any worthy employer should admire that.
In fact, I often feel uncomfortable unless I'm taking at least an hour of every workday to get better at programming. There's a reason why you learn first by going to school before you can work -- learning has really good returns on time investment, especially early on. I regret not spending more time deliberately learning when I first started at my job.
Spend Time Programming with an Aim Toward Readibility
Programs should be written for people to read, and only incidentally for machines to execute. - Structure and Interpretation of Computer Programs
There are many aspects that make good code, but the most important aspect seems to be to make code readable, or easily understood by other programmers. This involves being clever enough to write good code that gets the job done without being so clever as to abuse parts of the programming langauge that are difficult to understand.
Of course, you don't have to write code so readible that someone one month in can understand it, but if it can't be understood by someone with 1+ years experience with the language, that's a really bad sign. It's good to look more into this and try to make your code more readible. There's also a good amount of objective metrics that can help.
Spend Time Pair Programming
Programming with someone else, especially someone with a different programming style than you, can be very rewarding while you both dialogue about what makes for good code. I think my coding has increased the most per hour spent by doing this.
Learn Other Programming Styles (Especially Functional Programming)
This is mostly just a plug for my personal preferences and biases, but I feel like functional programming offers the best style for good programming habits. Regardless of your paradigm pick, it's important to be familiar with different styles and different programming languages so as to understand programming languages at a more general level.