• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • Our Blog

    Ongoing observations by End Point Dev people

    Coding style guides across languages

    Piotr Hankiewicz

    By Piotr Hankiewicz
    August 17, 2015

    Introduction

    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:

    1. When you don’t know how to write a structure, read guides.
    2. When you know how to write a structure but it’s different than standardized, ask other developers about it.
    3. When your structure is different than all the other structures made by your co-workers, consider changing it.
    4. 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.
    5. When there is no good coding style guide for your language, create one.
    6. Try to have the same habits of coding in your team and company—​it’s a time saver.
    7. Even if you’ve adapted to some structures be open for change.
    8. 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.

    Let’s begin.

    Java

    C

    C++

    C#

    Python

    Objective-C

    PHP

    Visual Basic .NET

    JavaScript

    Visual Basic

    Perl

    Assembly

    Ruby

    Conclusion

    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:

    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.

    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.

    programming tips


    Comments