Coding style guides across languages
By Piotr Hankiewicz
August 17, 2015
Before you can start programming production code in any programming language you should know a few things like syntax, purpose, coding standards, good practices. There is another thing that is really important too and can help developers that work with multiple projects and languages: coding style guides. This is just a set of rules that developers should take care about when writing code. They are not so different across various programming languages. In this article, I will sum up and list coding style guides for the most popular languages.
It’s not a crime to use different styling, but standardizing this helps in the process of creating software. When your team is using the same standard it’s much easier to read each other’s code.
There is one universal resource when it comes to programming style guides. Many of you will already have read it: the “Clean Code” book by Robert C. Martin.
Something else that should be mentioned here:
- When you don’t know how to write a structure, read guides.
- When you know how to write a structure but it’s different than standardized, ask other developers about it.
- When your structure is different than all the other structures made by your co-workers, consider changing it.
- When someone will force you to change your styling code, ask her/him/them why, even if she/he/they are your manager or boss.
- When there is no good coding style guide for your language, create one.
- Try to have the same habits of coding in your team and company—it’s a time saver.
- Even if you’ve adapted to some structures be open for change.
- Respect experience. If senior developers tell you that your code is weird, there is probably something wrong with it.
Order of the guides is not random, most important and trusted first. Not all the guides cover all the topics so it would be wise to real all of them when you plan to write code in such a language.
Visual Basic .NET
Maybe it’s not the most important programming part but it’s something you need to think about.
If we will try to compare those rules to human language, English for example, see “Romeo and Juliet”, Act III:
Come, come, thou art as hot a Jack in thy mood as any in Italy, and as soon moved to be moody, and as soon moody to be moved.
Now try to remove writing standards:
MERCUTIO Come, come, thou art as hot a Jack in thy mood as any in Italy, and as soon moved to be moody, and as soon moody to be moved.
It’s not easy to read this one liner. Our code is the same: Be smart, listen to more experienced people, read style guides and you will make live easier for you and other people too.