days
-4
-1
hours
0
-1
minutes
-2
-9
seconds
-5
-8
search
Reduce your technical debt

Does your software smell? Write better code with DesignateJava

Sarah Schlothauer
java
© Shutterstock / Debbie Steinhausser

Looking to reduce your technical debt? DesignateJava detects design smells that impact your software design structure. Save time and write stronger (better smelling) code! Your future self will thank you.

Does something smell in here or is it just your code? There’s a new tool in town that helps assess Java code quality. DesigniteJava “detects numerous design and implementation smells”. Spritz on the perfume and find out how this can help your code shine.

Does your code smell?

DesignateJava helps reduce technical debt in your software. Technical debt is one of the number one time-wasters in the day of the developer. As we previously discussed, bad code is something that C-level executives and developers don’t see eye to eye on and is keeping developers from reaching a higher level of productivity.

Besides that, let’s be honest for a moment, fixing bad code just stinks.

Design smells aren’t something that your Smell-O-Vision can pick up. On their FAQ page, DesigniteJava quotes the definition from “Refactoring for Software Design Smells: Managing Technical Debt” by Girish et al.:

Design smells are certain structures in the design that indicate violation of fundamental design principles and negatively impact design quality.

These smells have an impact on how a software performs by making it difficult to understand. The FAQ goes on to explain that, “The presence of design smells reduces understandability, changeability, and flexibility leading to a software system difficult to understand and change.” Problems with this now only lead to time later spent fixing them, and additional technical debt that grows and grows.

Essentially, design smells are the symptom of software going bad. When they’re present, it’s time for refactoring. Design smells go beyond simple things like just bugs, they are poor design choices that affect the stability of the project as a whole. Think of a home’s foundation. Instead of solid cement, a design smell is a foundation made out of glass or toothpicks.

SEE ALSO: What does it take for Java to compete in the serverless space?

Deep cleaning Java code

DesignateJava detects 17  design smells and 10 implementation smells.  (As we await the new JDK, now is a perfect time to gear up and prepare your Java toolkit!)

Some of these common design smells that DesignateJava looks out for include:

  • Imperative Abstraction
  • Multifaceted Abstraction
  • Unnecessary Abstraction
  • Unutilized Abstraction
  • Deficient Encapsulation
  • Unexploited Encapsulation
  • Broken Modularization
  • Cyclic-Dependent Modularization
  • Insufficient Modularization
  • Hub-like Modularization
  • Broken Hierarchy
  • Cyclic Hierarchy
  • Deep Hierarchy
  • Missing Hierarchy
  • Multipath Hierarchy
  • Rebellious Hierarchy
  • Wide Hierarchy

As for implementation smells, say good-bye to these:

  • Abstract Function Call From Constructor
  • Complex Conditional
  • Complex Method
  • Long Method
  • Empty catch clause
  • Long Identifier
  • Long Parameter List
  • Magic Number
  • Missing default
  • Long Statement

SEE ALSO: “Developers will see Java 11 as a better, cleaner implementation of the features they use in Java 8”

Beyond these, DesignateJava also computes thirteen object-oriented metrics:

  • LOC (Lines Of Code – at method and class granularity)
  • CC (Cyclomatic Complexity – Method)
  • PC (Parameter Count – Method)
  • NOF (Number of Fields – Class)
  • NOPF (Number of Public Fields – Class)
  • NOM (Number of Methods – Class)
  • NOPM (Number of Public Methods – Class)
  • WMC (Weighted Methods per Class – Class)
  • NC (Number of Children – Class)
  • DIT (Depth of Inheritance Tree – Class)
  • LCOM (Lack of Cohesion in Methods – Class)
  • FANIN (Fan-in – Class)
  • FANOUT (Fan-out – Class)

For an in-depth explanation of what these are, the FAQ is the place to look.

Read more on GitHub here and grab the executable jar from the website. In order to get started, you’ll need either Maven or Eclipse to install the tool and Java 8 or above.

A round of applause to Tushar Sharma, Antonis Gkortzis, Theodore Stassinopoulos, and Alexandra Chaniotakis for their work on this project. While we count down the days until Java 11, it’s great to see more and more open source projects that make coding in Java a breeze.

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University in Long Branch, New Jersey and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of