And with “coding with style” I don’t mean to keep your pinkies up while doing it or just write code every evening at 5:00 pm. No. Coding with style is to make our code legible, documented as much as we can an following some conventions that other coders adopt to make our programs “universal”.

They say that every programmer has its own way to do its thing (I agree on that), but this sometimes becomes a problem when it comes to terms of optimization, review or scale the code. In the best of cases we might remember everything what that asdflkj variable means in our code, but imagine if you couldn’t remember and you have to look here and there to find what you meant to do with that variable. OR EVEN WORSE: Imagine that the code you wrote a long time ago is now a responsibility for other person, poor him!

“It works”, yeah, you could say that. There are times when a quick fix is needed but at the end of the day we always forget to come back and do it right. But trust me, that will make the life easier for you and your colleagues.

One of the problem’s sources

I believe the problem comes right from our schools (at least mexican schools), where when we are asked to present our homework, projects or practices we settle for “well, it works” because we never work over the same thing again. Every teacher ask for new things, not the ones we have worked previously on with other teachers. It would be ideal if at the very beginning we could choose a long term project to force ourselves to constantly improve it and to make things right.

It’ll help if we decide to get into the working world where over time the same application is developed, and to make that development easy the code must be well documented making it easy to be worked on by a lot of hands and without wasting time by asking our partner “what does this do?” or scratching our heads wondering for what did we used some variable instead of another.

A brilliant solution

Luckily for us there are some style guides that give us some conventions, which we may not take as if they were laws but I recommend that you take them in account. Of course, you can create your own styles of coding, the important part of adopting or creating a style is to apply it as consistently as we can.

My fellow programmer, below are some links to style guides that I found somewhere (in the internet), if your language isn’t listed there, keep looking or create your own. Speaking of that… I decided to write my very own style guide for C#, it is on GitHub and everyone can contribute to its development.

Yet another cool style guide for C#

Otras guías: C++, C++, C#, C#, Java, Java, PHP, PHP.

Having doubts? comments?
Want to see more like this? check the tag #Meta.
Share this