So you want to become a better programmer
An awesome team of professionals reviewed my code and quickly exposed my mistakes. Yes, it was a great albeit humbling experience :) . It gave me a firsthand glimpse of my code-writing flaws; I appreciate this as it will enable me to improve insha Allaah.
Here are a couple of my thoughts on how to become better; maybe I shouldn’t be writing this again but my views have changed a lot since I wrote this and it is great to have a resource I can always point to. Enough talk; here are some tips:
1. Start Simple
Choose an easy-to-learn yet powerful language (you could try python or scheme) that enables you to learn the basics of programming. Choose any language you like; learn it well and deeply enough – its programming style, culture, strengths, flaws and best uses. This takes time: it can even take years but becoming a programming ace is more like a marathon and less like a sprint.
2. Read books
Yes, you have to read. Read books like The Pragmatic Programmer, Code Complete, SICP and other similar classics. They will help you to think better about code, identify potential pitfalls easily and avoid mistakes. Well, this step should come after you’ve mastered the basics of programming and want to move to the next level. Reading will expose you to new ideas, freshen your mind and make you stand out.
3. Read + Write Code
I can’t emphasize this enough; you definitely have to ‘live in’ code and write code just for the fun of it. Write applications using the languages you know, start by building easy applications and then take on more challenging projects. Try out scary ideas too : what is stopping you from writing your own JavaScript interpreter in JavaScript ?
4. Learn the funky CS stuff
All about algorithms, data structures, operating systems, compilers and all other basic theoretical Computer Science stuff. You become a better programmer by understanding how the things we take for granted (compilers, computer memory etc) work. The CS courses will probably expose you to those annoying unrealistic problems but they are a great way to prepare for challenges – afterall it is all about code. Read more about this here and here.
5. Be Honest with your code
As a programmer you MUST know why your code works. Don’t just put in unexplainable pieces of code that ‘seem’ to work – that ’magical’ print statement that appears to make everything work when you insert it and breaks the code when you remove it – I used to do this too
. It is a shortcut to disaster as it’ll most likely lead to horrible, hard-to-fix ‘magical’ bugs too. Do you have some tricky code? Step through it with a debugger and see if it really works as it ought to – don’t just assume it works when it compiles and gives the right result for few test cases. Step through it and confirm it yourself.
6. Raise your standards
Handle unexpected cases, never assume data will be valid, use assertions to ensure that your code breaks immediately something is wrong. Don’t display error messages to users, degrade gracefully. Test, test and test your code. Code defensively. Never ever lower your standards for anything, your code speaks volume of you so you should make sure you take a stand to write the best quality code you can, are you copying the same lines of code over and over? Write a method to handle that for you. Understand the architecture of the framework you are working on before attempting to write patches or new methods. Whatever you do, strive to improve your code writing skills every time you write. I know it is challenging to move out of your comfort zone but don’t you want to be a good programmer?
7. Writing code is the easiest part of programming
Don’t just dive into code, you’ll end up with poorly-designed code and get frustrated easily when you realize that your hastily-written piece of code doesn’t do what you want it to do. During an interview, I was asked to write a tokenizer – I rushed to code and ended up with a brittle program that did the exact opposite of tokenization!
When faced with a very tricky problem, think of a possible solution, try out your design on paper or with pseudocode, see that it works and then implement it. If it works fine, test it and then improve its style and readability. Lastly you should optimize it and add all other fine bits.
Programming is like writing, it is an ART and requires time, dedication and effort. So keep at it and don’t think you’ll become a rockstar developer in a few months. Like all professions; you probably need years of top quality work to get there and lots of prayers too.
Do you disagree? Drop a comment
Related articles
- Great Article: http://norvig.com/21-days.html
- What Makes Great Programmers Different? (drdobbs.com)
- Some things I’ve learnt about programming (jgc.org)
Nice one
Iqbal Khan
July 16, 2012 at 5:11 am
Thanks
AbdulFattah Popoola
July 16, 2012 at 5:12 am
Boss, thanks for this, it is very helpful!!! How are you?
fayomi dimeji
July 16, 2012 at 5:26 am
Thanks a lot; glad you liked it!
Longest time; Howz NZ?
AbdulFattah Popoola
July 16, 2012 at 5:31 am
I’ll to add “Don’t give up!”. Programming can be pretty annoying sometimes.
Umar Farouq Khattab
July 16, 2012 at 6:50 am
Absolutely correct… it needs dedication.
AbdulFattah Popoola
July 16, 2012 at 12:29 pm
Thanks
Saheed
July 16, 2012 at 7:41 am
You are welcome.
AbdulFattah Popoola
July 16, 2012 at 12:30 pm
Jazakalau khairan. This is really helpful. Although i just started learning web development but i beleive i am impoving a lot. Might need your help/advice on the way though.
Ilyas
July 16, 2012 at 10:14 am
Ameen wa iyyakum. Great to hear this and I wish you the very best.
I’ll be glad to help.
AbdulFattah Popoola
July 16, 2012 at 12:31 pm
very nice piece! keep it up.I will also like to mention that, we should always work towards creating a solution and not just write fancy codes. Once there is a heading, all efforts (analysis and code) will move accordingly.
Abubakar Ango
July 16, 2012 at 10:57 am
Thank you very much.
AbdulFattah Popoola
July 16, 2012 at 12:32 pm
Abdulfattah, Welldone.
Thanks for sharing this.
oloyede Jamiu
July 16, 2012 at 12:29 pm
Thank you Jamiu! Glad you liked it.
AbdulFattah Popoola
July 16, 2012 at 12:33 pm
Gud start boy! Keep t up
Young coder
July 16, 2012 at 7:58 pm
Thanks!
AbdulFattah Popoola
July 17, 2012 at 12:25 am
Good article. I’d disagree on the point about not jumping right in. Sure, if your designing a big new enterprise component then spend some time on the design. But generally, for new developers starting out, cut as much code as you can, quicky – it’s how you learn. Trying something and seeing it work or fail is a much better lesson than reading a book on the subject.
Hideous Penguin Boy
July 16, 2012 at 8:34 pm
Thanks I think I agree too – we all stand to gain a lot from learning from mistakes.
For small projects – it might be easier to just dive in when you have the design in your head.
AbdulFattah Popoola
July 17, 2012 at 12:27 am
Well said Abdul
Akinsete Sunday
July 19, 2012 at 6:36 am
Thanks Akin
AbdulFattah Popoola
July 19, 2012 at 3:36 pm
This is brilliant, how can I possibly disagree??
ibrosaunks
July 30, 2012 at 12:51 pm
[...] So you want to become a better Programmer [...]
Taking the PAIN out of coding | CodeKraft
March 4, 2013 at 7:55 am
[...] "Programming is like writing, it is an ART and requires time, dedication and effort. So keep at it and don’t think you’ll become a rockstar developer in a few months. Like all professions; you probably need years of top quality work to get there and lots of prayers too." [...]
So you want to become a better programmer | lia.ionita | Scoop.it
March 30, 2013 at 7:57 pm
[...] So you want to become a better programmer [...]
For Devs only | CodeKraft
April 9, 2013 at 4:18 pm