How to be a good programmer? My tips

Update: A way better and more comprehensive article on similar lines can be found here I strongly recommend that anyone serious about programming should read it

At the very onset, let me make it clear that I DO NOT consider myself a good programmer. I rate my coding skills as average and I am still learning and have a long way to go before I am even slightly pleased with my programming skills. Yes I am better than quite a few people when it comes to programming, but thats merely because they are lazy and like to sit on their asses whole day and never bother about programming. Their horrible skills make my less horrible skills look marvellous. I have performed abysmally in ICPC and have never done well in any coding contest worth mentioning (I DO NOT consider college level contests worth mentioning). I havent succeeded yet in Google Summer of Code and my Imagine Cup moderate success (and glorious failure) isn’t much to write home about.

So most of the tips I will mention below are lessons learnt from failed endeavours, they are what I have wanted to be and I am not. So lets dive in.

1.Decide why you want to become a good programmer: Is it because you want a job, preferably in Google, Microsoft, Sun or IBM? Great. Then you will reach nowhere. All good programmers I know are good because they loved what they did. Develop interest in programming. See, programming is the only branch in engineering where you can straightway apply what you learn. Your dad may have a car but he certainly wont allow you to tweak the V2 or swap it for a v6 just to see what happens. But with computers you can do whatever you want. You want to simulate a virus? Cool. Install a virtual OS and run it. Then, when you are done, remove the virtual hard disk. If you are good at what you do, you will get paid and surely get that dream job. Yes, even I want to work in any of the above mentioned companies. But thats not because of the fat paycheck. Its because of the work they do. Because of the exposure I will have. Have you ever bothered to find out what all these companies do and the enabling technologies behind their products or the kind of R&D they do? Jobs will come. Dont make yourself a sucker for one. Sachin is not a great cricketer today because he decided to play cricket to earn money and get dozens of endoresements.

2. Programming languages: Very often people equate good coding skills with number of programming langauges known. Thats just damn untrue. While knowing a lot of programming language is good and sometimes, even, essential; it is more important that you know one or two lanugages very well. I ‘know’ and have used more than a dozen programming languages and yet C and Java are the ones I am truly comfortable at. Thats sad of course. I really wanted to be good at Assembly and Lisp as well. Never got the time or chance to develop those skills. To be good at a language takes years (at least 2 years). Being good at a language means, you understand where it is best used and where using that language makes no damn sense. On the other hand, knowing a language takes anywhere from 3 days to a week. If you are a beginner, learn C first. Don’t buy Yashawant Kanetkar. Buy the book “The C Programming Language” by Brian W Kernighan and Dennis M Ritchie (If you don’t know who they are, do this 1. Slap yourself 2. Google their names). This book is not the easiest but is the best. Its a small book but it is the most powerful. Generations of programmers have been brought up on it. And if you think this book is tough for you, please do not harbour any misplaced desires of being a good programmer and do not waste your time by reading this post further. Programming is an art (not a science. Yes you read it correctly), and like any art it requires painstaking effort.

Some people suggest Python as the first language to be learnt. Python is certainly a good language and is easy too. But you will have to rely mostly on the internet for help as not many around you would know Python. Also C has the broadest usage among all programming languages. Also please DO NOT use Turbo C. Its so fucking outdated. Use GCC. If you are in Windows download Dev C++. It has GCC

Read this (small) essay by Peter Norvig Teach yourself programming in 10 years . Again, do a Google [ 😉 ]search and find out who Peter Norvig is.

3. Algorithms: Any good programmer has a good understanding of algorithms. Its not necessary that you know each algo by heart (in fact good programmers never learn things by rote) but you must understand when to use what. Algos will broaden your understanding and give you new ways to tackle problems. Another important thing is Data Structures. Its more important than algo. Once you have chosen (or developed) the correct data structure, the algorithm becomes self evident. For algo, read the book “Introduction to Algorithm” by Thomas H Cormen et al. You may also refer Andy Tanenbaum’s “Data Structures in C and C++”. Also if you have desires to participate in coding contests (the respectable ones), “The Art of Programming Vol I to V” by Donald E Knuth are mandatory. Also may be “Concrete Mathematics” by Donald Knuth. Again reading does not mean remembering everything. Just try and understand whats written.

4. Coding contests: Coding contests are good for developing your algorithmic skills and they make you think fast. Its a good idea to participate in ACM ICPC or Then there are coding contests (like Sun’s Code for Freedom, Google’s Summer of Code, Microsoft’s Imagine Cup) where you develop a complete software. Such contests are spread over many months. Both require different sort of skills. You may be good in one and bad in another and yet you could be a good programmer. Contests like ICPC require lot of practice, fast thinking and you are expected to keep algos at the back of your mind. CFF, GSoC, on the other hand, requires creativity and focus spread over a long period of time. You dont have to come up with solutions too fast and you dont have to mug up algos. ICPC is like T10 while CFF,GSoc and Imagine Cup are like Test Matches. I would suggest you to participate in both types and then decide if you want to focus on either or both.

5. Participating in FOSS projects: You MUST participate in some free software projects. There are just too many. I am working on SCALASCA right now and then I will move on to Sun Grid Engine and Sun xVM Hypervisor and contribute code there. You learn a lot from these. You get to see a lot of code and learn the best practices. And did I mention, it looks good on your CV too. Most people catch cold feet when they go through some of the prerequities of such projects. Take Thunderbird for example. You would need to know a lot of C/C++ and Javascript (for developing modules). Now don’t wait till the day you are an expert in these languages before contributing. Programming is an art, don’t waste time sharpening your pencil when you should be drawing. You can ask me for directions.

6. Design Patterns: Any art is learnt by emulating. And therefore, you must emulate the best. Design Patterns are tried and tested architectural (of the software kind) solutions to some commonly encountered software design issues. And therefore, a basic knowledge of some common design patters in needed if you are planning to develop something that is even moderately complex. I suggest “Head First Design Patterns” from Oreilly as the first step.

7. Learning by emulation: Emulate the best. And this is possible by reading books written by the best and/or going through code from some of the best free software projects. I would urge anyone serious about programming to read the book “The Art of Unix Programming” by Eric S Raymond (dont forget to first slap yourself for not knowing who Eric Raymond is and then googling his name). You are not a programmer if you have not read that book. Period.

Now let me address a few common grouses

a. I dont find any interest in computers and want to do an MBA:Mainly a statement often repeated by Second Year(sophomore) students. Thats really your problem. I did not ask you to take Computers or even to join Engineering. You did not know, or bothered to find out, what you were getting into when you took up this branch of engineering and I am pretty sure you have NOT bothered to find out what awaits you in a MBA course either. I am also quite sure that 2 years after an MBA (if not earlier) you will also say pretty much the same thing about your job. Well what can I say. All the best 🙂

b. I dont like reading the books (or any books for that matter) that you mentioned above: Well this is not yet the world of Matrix where I can just feed in programming skills to your brain. Dont force yourself to read them. You can’t . Do it only if you want to. And if you don’t, please forget about being a good programmer. May be its time for you to use the excuse mentioned above (point a).

c. Give me one programming language that does all: There is none. Each has a different purpose. And thats how things are gonna remain buddy.

d. I want to a ‘real’ project: Thats great. You can do two things:1. Start one of your own 2. Join a FOSS project. But most people are not happy with this. They expect me to ‘give’ them a project, one thats easy (read, should not involve anything other than C and the only files you need to include should be stdio.h, conio.h (yes people here still use Turbo C) and may be string.h and math.h) and I should tell them what to learn. When people say this,they expect to go on a Autopilot ride.

e. I will learn X programming language by this sem/year/decade :There is no way you can sit with a book and learn a language. You need to do some real work with it, develop some real software and not just do those exercises in the book (that is necessary of course but not sufficient). Most of the languages I have learnt are because I was forced to do so as part of some project. Just pick up the basics in a day or two and then apply it to a real life project. Need ideas? Come to me.

Finally as Larry Wall says in Programming Perl : “We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.

Laziness:So that you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer

Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer

Hubris: Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won’t want to say bad things about. Hence, the third great virtue of a programmer.

So get set on your way to become a great programmer, the likes of Richard Stallman, Rithcie, Brian, Raymond, Torvalds. All the best.


17 thoughts on “How to be a good programmer? My tips

  1. Good tips … and very well pointed grouses …. just wanted to emphasize on the point … that one shud take programming as fun … as do all the great coders ( Petr ,ACRush , tomek, marek cygan, etc) , and not as some compulsion or something like tat … Even i was once under that problem, was forcing myself to code , rather than doing it for fun .. but now when i do it the other way … I realised that my skills truly improved with the latter approach .

    • Thanks Kevin…Specially because you have “been there, done that”. Yes programming, like sex and art and so many other things, should not be a compulsion. BTW, two points for those you dont know:
      1. Kevin and his team beat my team at ICPC prelims last year and were selected to participate in the next round. Kevin, I wont deny that it was a tsunamic jolt to my ego, but hey you are good and all the best this year.
      2. The coders Kevin has mentioned Petr, ACRush, tomek, marek cygan are some of the highest paid coders in They earn more than enuf to never need a job.

      • hehe …. this is also one of the many problems which many face out there … trying to compete among the friends …. but I learned later (after surfing for hours on internet) , that there are lot many people out there in the world for competition … so one should collaborate as much as possible locally , putting aside mutual differences , in order to challenge the other people out there ..

  2. god this was i must confess AWESOME!! i belonged to group a for quiet a time!not now though!! 🙂
    i may not be a great programmer but i must confess i first time recognized it as an art!! ek number sandy!!superb!i would refer this to all my juniors and batchmates!!

  3. hey thanks sandip…for your very valuable tips….
    you are in which year??? i am a student of I.T engineering SCET surat….badly needed a role model like you….is it possible to contact you, here in surat??? i really lack someone to show me the right path….

    plz do reply….
    thanks a ton….

  4. Hi Sourish,

    Thanks for the comments..Though I am pretty sure I cannot be a role model…There are, of course, many who can serve as role models and some of them have been mentioned in the above post…drop me an SMS at 9712761571…we can meet..certainly…or may I suggest another option…I am doing a Sun Tech Demo on SPOT ( on wednesday, 5:30 PM at my college (SVNIT)…u can attend it..learn about SPOT and meet me as well…and I have been planning to involve SCET in my Sun activities…we can discuss about that too…

  5. It would be an honour sir….i will surely be there…and i would also like to work with you on your projects(if you feel i am worth it)…..although currently i dont know much…but i have the zeel to do something new and practical…..

    I cannot stop myself from appreciating your posts about “How to be a good programmer” & “Software Engineering”. These are so basic issues and doubts and you have given the most appropriate answer for them i feel….neways…

    Thank You.

    • Sourish,the honor is all mine.. Well do attend it. Lets see what I can offer you in the way of projects. Drop me an SMS so that I can inform you about any changes in timing of the event.

    • lol….yes tech mom…seems like that….do give me your tech blessings so that I may scale new heights of blogosphere.. 😉

  6. Good work ! Liked the concept of ppl slaping themselves when they did not know about K & R !! For long i was figuring out what to do with these ppl 🙂 !!! And also add the books like —“The C++ Programming Language” by Bjarne Stroustrup for OOP Concepts !
    These guys K & R and Stroustrup are Gods and dunno why ppl keep braggin’ that they are Masters when they have read only kanetkar !!! Which I believe is as crapy as Ankit Fadia and his Fart.
    Also add codeblocks for the IDE as the dev C++ ships as Editor only and ppl have to get the compiler themselves and set path ! what leads most ppl into a frenzy !It uses GCC (MingW / GNU GCC) and would compile even the obnoxious codes typical to college practicals and beginner programming as in Kanetkar and kinda books !
    Overall I liked your article , keep up your work !!!

    • Hey thanks Shiv. Yes certainly, Stroustrup is THE book for C++. If someone is interested in C/C++ programming in Windows (and they are not using Visual Studio compilers) Dev Cpp is the best. It does come with the GCC compiler. For most other purpose I would recommend Netbeans.

      Also its a sad thing (shows the utter level of degradation in humanity) when people think Ankit Fadia is a real hacker (whatever they understand by that term). He is a fake and a hacker he is not. But thats for some other time.May be a different blog post.

Let me know what you think

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s