Refactoring Based on Best Practices

Written by:Jan Hink

The following section shows how to refactor code according to the Groovy Best Practices which we identified throughout the years of experience with Groovy logic development. Every configuration engineer is strongly recommended to follow these. It will help us to improve readability of the code we write and in many cases even performance.

In this article we are going to refactor a poorly written logic to illustrate how to apply many of the best practices. We will improve the code readability as well as its performance. The article will show you a side-by-side comparison of the good and bad, so you can get a clearer picture what a well-written logic looks like.

The best practices are not definitive and are still evolving. You may find a better solution to the problems we present. If you do, please suggest an edit to the article so we can strive for the best quality.

Found an issue in documentation? Write to us.