Master your programming language of choice

I have gone through many a program where I would stare at a section of code, trying to figure out what it’s doing. After a while, a light of understanding would flood my consciousness, and I would ask, “Why did someone write like this?”

The problem? The task at hand required a certain function, say formatting output (quite common) for displaying a string of a length of 4 characters from a number between -999 and 999, inclusive of the negative sign. I would then see code checking if the number was negative (to determine if a minus sign was required), string trimming and left/right alignment of the number and so on.

Why did anyone go through all this when there’s a perfectly functioning formatting ability within the standard library of the language? (I’m thinking C at the moment, but most other languages are still applicable) I came to one conclusion: the programmer didn’t know about it.

You can be a better programmer by simply knowing more about the language you’re using. You don’t have to remember every single function available. You just need to know where to look. Albert Einstein said something to the effect of “I don’t remember anything that’s written in a book.” There are online libraries of programming languages. Use them.

As a programmer, you are paid to think up solutions and implement them via code, not reinvent something that’s already done and then code the business logic. Your creative abilities are more important than your memorisation skills.

Comments are closed.