Skip to content
/ codingstyle Public template

Java coding style and template project used at Munich university of applied sciences

License

Notifications You must be signed in to change notification settings

uhafner/codingstyle

Repository files navigation

GitHub Actions CodeQL Line Coverage Branch Coverage Mutation Coverage Warnings Bugs

Each Java project should follow a given coding style. I.e., all contributions to the source code should use the same formatting rules, design principles, code patterns, idioms, etc. This coding style provides the set of rules that I am using in my lectures about software development at Munich University of Applied Sciences.

This project describes the coding style in detail (currently only available in German) and serves as a template project. It provides all necessary resources for a Java project to enforce this coding style using the following static analysis tools via Maven (and partly in IntelliJ):

❗This project requires a JDK version of 11 or higher.❗

Moreover, this project provides some sample classes that already use this style guide. These classes can be used as such but are not required in this project. These classes also use some additional libraries that are included using the Maven dependency mechanism. If the sample classes are deleted, then the dependencies can be safely deleted, too.

This project and the associated static analysis tools are already running in continuous integration: an example CI pipeline is active for GitHub Actions. For Jenkins a full CI pipeline has been configured that includes stages to compile, test, run static code analysis, run code coverage analysis, and run mutation coverage analysis, see section Continuous Integration for details. Additionally, some development tools are configured in this GitHub project to evaluate the quality of pull requests, see section integration of external tools.

Content of the style guide (only in German):

A lot of ideas in this style are based on the following path-breaking books about software development:

  • [1] "The Elements of Java Style", Vermeulen, Ambler, Bumgardner, Metz, Misfeldt, Shur und Thompson, Cambridge University Press, 2000
  • [2] "The Pragmatic Programmer: journey to mastery", Second Edition, Andrew Hunt, David Thomas, Addison Wesley, 2019
  • [3] "Code Complete: A Practical Handbook of Software Construction", Steve McConnell, Microsoft Press, 2004
  • [4] "Clean Code: A Handbook of Agile Software Craftsmanship", Robert C. Martin, Prentice Hall, 2008
  • [5] "Effective Java", Third Edition, Joshua Bloch, Addison Wesley, 2017
  • [6] "Refactoring: Improving the Design of Existing Code", Martin Fowler, Addison Wesley, 1999
  • [7] "Java by Comparison", Simon Harrer, Jörg Lenhard, Linus Dietz, Pragmatic Programmers, 2018

All documents in this project use the Creative Commons Attribution 4.0 International License. Source code (snippets, examples, and classes) are using the MIT license.

License: MIT License: CC BY 4.0