Java coding conventions
Over time, most programming languages develop conventions
for writing source code. Some are formal and some informal.
Informal conventions usually evolve naturally as people move between
languages.
In his post How to write identifiers in Java and C# , Tomáš Kouba points out the basic conventions for identifiers and considers using accented characters in their names. Personally, I wouldn’t use Czech characters. I’m glad the option exists, though. Some programmers will surely use it.
Take conventions seriously
Back in Java, formal conventions cover more than identifiers. The Java
Code Conventions document describes things like comment formatting, filenames and their
organization, indentation, and block declarations.
The Java Code Conventions are a comprehensive document every Java developer should revisit from time to time. I think they’re especially valuable when writing, or more precisely sharing, code on a team. When everyone internalizes the same rules, the team can work much more efficiently.
There may even be small departures from the Java
Code Conventions. Those can become informal conventions in general use or formal rules within a development team. One such convention might be to prefix interface names with I (IOsoba), or to suffix their implementations with Impl (OsobaImpl).
Related articles
Related CZ Podcast episodes
- #261 · Leadership
On leading people and teams. · Czech audio
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio
- #1 · Vývojová prostředí v Javě
The first CZ Podcast episode looks at Java development environments. · Czech audio