No programming is wrong programming – A little guide to get your coding career started

Edit: Since many seem to misunderstand my intentions and my point, I wish to clarify: When writing code, you should make your code as readable as possible. That is not what the article is about, though. I wrote this to show newcomers to the world of programming that it doesn’t matter if you use conventions religiously or not, if the end result is the same. What I wanted to say with this is that it doesn’t matter if you put one or two spaces between the brackets or if you put newlines before curly brackets or not, unless the project requires a very strict convention.

I’m not against conventions in any way, I use them religiously because I feel it is easier to do. Neither am I saying to throw all conventions to the wind, I’m saying that convention might be the last thing a newcomer to programming should worry about and that people intending to help newcomers should bear that in mind as well.

As a programmer of many languages, I have read and followed countless tutorials and guides. I’ve read many a book on the subject and I have discovered one thing sorely lacking from all of these, something that is so basic, yet it is implied that you should already know it.

When it comes to programming, you will often find yourself in need of help. When asking others, you will often hear you did something wrong and that they know a better way. This is when I most often stop them and say “No, I did not do something wrong, I did something different.”.

This is the most fundamental thing in programming, as long as the end result is to satisfaction, how you got there doesn’t matter. What coding convention you use is entirely up to you, what language, framework, methods, functions, variable types, database schemas… it’s all up to you as the architect of the code, but others will have you believe their way is the only way.

Sure, there are less efficient and less effective and less expandable ways, but that doesn’t mean they are wrong.


Take the following example:

Customer X wants a website. The website should have two pages, a main page and a “contact us” page. The customer does not expect this to be expanded upon in the future.

Now, a simple way to do it is to code everything in HTML and add the CSS styling directly to it. This is a compact way of doing it and with copy/paste, you can quickly get the elements that are the same over to the other file. It works, the work is done, the customer is satisfied.

People who see your code might say this is the “wrong” way of doing it in 2015. You SHOULD use something like PHP or .NET to make it more expandable and more efficient. The problem here is that you would then have to learn any of those languages, implement it and there’s a few more steps to doing things, for the same end result. Sure, if something changes later, it is easier to change it using PHP and external CSS sheets, but it isn’t needed for this case.


People will also get hangups about coding conventions, such as variable naming and placements of brackets. These things affect legibility of the code, but not the function. Each coder have their own convention, but most stick somewhat to one of the more common practices in some regards.

You’ll often hear teachers say that you should always write constants in only capital letters or always start methods with a capital and use camel-case. You could do that, but a constant will still be a constant if it is written in lower-case letters and the method will still function properly if you write it entirely in capitals.

It doesn’t matter if you have whitespace, tabs, newline or no space at all on each side of a bracket, the code will work the same. You can end with a semicolon directly, have a tab or a space between, it doesn’t make one bit of difference.

If you have made an entire application on your own, using your own convention, it will take an experienced coder about 2 minutes to figure out your convention and get used to reading it. Legibility will be intact!

A few exceptions

There are a few exceptions though, a few cases where convention is important. Anything visible to the user should follow the current conventions. A save button showing the image of a folder does still work, but it’s less intuitive for the user, who is used to seeing a symbol of a floppy disk as saving and is used to seeing the folder symbol as loading.

If the code needs expandability, it is probably best to use one of the expandable languages, preferably with some sort of framework to make it easier for future coders (or even future you, as a couple of hundreds of lines of code could be hard to remember a few months or years down the line). It’s also a common courtesy to use proper coding conventions in these cases, as it will help speed things up a bit.

If more than one person is working on the project, everyone involved who needs to read the code should agree on a common coding convention, to make it easier to quickly read the code.

So many hours spent on discussions about code convention could have been avoided, if people stopped criticising the choice of convention. Most Q&A forums I’ve visited has had every single poster’s code questioned for not using a certain convention. Longwinded discussions arise on why they didn’t do this or that, and the asking poster has to explain their entire code up until that point, and most of the time, the person answering still don’t understand why the poster did what he did and just decide to drop out of the conversation, answer still not reached.

So when you hear someone say “this is wrong”, kindly reply “no, it’s different”. Take what they say to heart, they only mean well, but also let them know that your code is yours and that you do have reasons to do what you are doing.


  1. Mostly all those who are really are programmers , never say that THIS IS WRONG. it is like “WOW your logic is different than mine” or ‘Oh!!! So you did it this way..’ or ‘Yeah it can be done like this as well’ 🙂

    • You obviously never asked for help on just about any forums. Check Stack Overflow, almost every single question there has at least one person asking “Why did you do it like this instead of that?”.
      IRC channels are almost worse, especially those for specific frameworks. You can be stuck for hours explaining every bit of your code and explaining how it interacts with other parts, just to get them to understand why you did it in the way you did it instead of the way they see as easier, before they eventually go and either say “Oh, then try this” or “Ok, can’t help you then”.

      It’s one of the biggest frustrations as a learning programmer.

      • Yeah you are right also. Sorry if you got me wrong i wasn’t saying that you are wrong. i was actually making you chill in my own way!!! I have faced StackOverFlow and always get insulted by many programmer which normally goes to my account blocking

  2. I disagree with this. Of course there are wrong ways to do things. Yes there are often many ways to perform a task, but there innumerable ways to do something incorrectly.

    For example, if a door is marked “pull”, you’re going to have to push on it pretty hard to get through. Following your logic, this approach isn’t wrong, it’s just less efficient.

    • I did not, anywhere in this text, say that there is no wrong way of doing things even if the end result ends up wrong. I said that if the end result is the same, there is no wrong way to get there.

      To use your analogy, if the door can be opened by pushing without breaking it, then pushing is fine, even if it takes more strength to do it.

    • Well, as I said in the article, if the code in the project is meant for more than your own eyes, you should follow conventions already set.

      I always follow convention when writing code, even if I’m the only one reading it, but to not help someone because they have a newline instead of a space between the “if” and the bracket seems petty to me.

      Also, to not help someone because they used Method B, when Method A works better in MOST cases, also seems rather petty.

      • Yeah, I’m not a native English speaker, and even in my own language, it’s hard to express myself in a way that others understand sometimes. I apologise for that and added a edit at the top of the article that I hope clears things out a bit.

Leave a Reply

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