Coding styles should be taken serious

One thing I always appreciated was “beautiful” code. The product may not be great but, wow, that code is beautiful! I will admit, if it wasn’t for the way editors are set up these days I would probably not write beautiful code, it would be legible and easy to follow because I do have my own “built in” style for programming for 30+ years and it’s not too bad.

However, when you work on larger projects, with many contributors, especially open source projects… this is where coding styles is definitely needed.

There is nothing worse than flipping between files in a single project to see the source code completely different from file to file. The solution is to make all developers use the same editor with the style enabled or publish your coding style so everyone can easily follow it. The editor idea is the best, because then the editor just formats the code as you go. In some editors you can even setup style warnings.

openFrameworks has its own “oF Code Style” guide, similar to Qt style. Interestingly enough, the oF style has a very different view on whitespace throughout the code.

Take a look at the differences:

Screen Shot 2018-08-28 at 12.14.56 PM

Neither one is right or wrong, the important thing is to be consistent throughout the project. Like I said earlier, the best thing to do is to setup your editor to do most of this for you.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: