Many of my friends & fellows ask me How to be a good programmer. I am writing this post for all those fellas looking for answer to this question.
Why you want to become a good programmer?
Is it because you want a job, preferably in a high paying software firm? Great. Then you are set to 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 straight-away apply what you learn. Your dad may have a car but he certainly wont allow you to tweak the V2 engine or swap it for a V6 engine 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 a big software company. But that’s not because of the fat pay check. 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. Don’t make yourself a sucker for one.
1. Programming languages: Very often people equate good coding skills with number of programming languages known. That’s 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 languages very well. I only ‘know’ about C# & HTML CSS. These are the ones I am truly comfortable at. That’s sad of course. I really wanted to be good at Java and PHP as well. Never got the time or chance to develop those skills. To be good at a language takes years (at least 2 years).
There is a good article by Peter Norvig about Teach yourself programming in 10 years. If you don’t know who Peter Norvig is, do this 1. Slap yourself 2. Google his name.
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. Programming is an art (not a science. Yes you read it correctly), and like any art it requires painstaking effort.
2. 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 algos. 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. 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 what is written.
3. Coding contests: Coding contests are good for developing your algorithmic skills and they make you think fast. 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.
4. Participating in open source projects: You MUST participate in some free & open source software projects. There are just too many. 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 such projects. 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.
5. Design Project Reporting Diagrams/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.
Now let me address a few common grouses :
A. I don’t find any interest in computers and want to do an BBA or MBA: Mainly a statement often repeated by Second Year students. That’s really your problem. I did not ask you to take Computers or even to join Software 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 BBA/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.
B. I don’t like reading the books (or any books for that matter) that you mentioned above: Well this is not yet the world of Matrix movie where I can just feed in programming skills to your brain. Don’t 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 that’s how things are gonna remain buddy.
D. I want a ‘real’ project: That’s great. You can do two things:1. Start one of your own 2. Join a with someone on an open source project. But most people are not happy with this. They expect to ‘have’ a real project, one that’s easy. When people say this,they expect to go on a Autopilot ride.
E. I will learn X programming language by this semester/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.
& That’s it. Have good day 😀 . & Now I am asked to do code.