Raquel Pau , from DAMA-UPC, and Albert Coroleu from Alpify present today walkmod, an open source tool to apply and share coding conventions.
Coding conventions are a set of guidelines for a specific programing language that simplify the maintenance of a software project, especially for those projects with a large number of contributors / committers. Applying specific design patterns, writing documentation and following a given code style are some examples of typical coding conventions. Nevertheless, where are coding conventions specified? How can we detect which source files are violating conventions? And who will fix the code?
Walkmod is the answer to all these questions, specially the last one, since Walkmod allows you to specify coding conventions for any programing language (Java by default), and automatically fix those source files that violate them. How does Walkmod do so? By means of code transformations.
Walkmod offers three ways to create code transformations: using a template engine (1), a scripting language (2) or using pure java code (3). Groovy is the default template engine and scripting language, but you can customize Walkmod with your favorite one.
In general, code generation tools are not designed to allow further code modifications once it has been generated. Otherwise, if you apply changes in the generated code, you assume the risk the tool may overwrite them if it is executed again. To solve this gap, Walkmod provides a powerful merge engine which is completely configurable. So, the user can configure, for instance, whether to replace or not the existing fields or methods for a given class. In short, feel free to change the code generated by Walkmod! It will not overwrite your changes if you do not want.
Many coding conventions are usually shared by many projects, and therefore, it makes sense to look for a way to share them among the community. Walkmod is completely developed in Java and uses Ivy and Spring to download third party plugins, so you can add those you need without updating the tool.
Start playing with Walkmod now and share your conventions!