Category Archives for Clean Code

Creating a Groovy DSL for Structurizr

In the previous post, we took a quick look into generating documentation with Structurizr. I really enjoyed playing with the tool, but I wasn’t aesthetically pleased with the code necessary to create

Continue reading

Method Length and Extract Till You Drop

As a typical nerd (and a DZone Zone Leader), I tend to read a lot of blog posts and comments about programming. One thing that keeps amazing me how long people’s functions tend to be and how many

Continue reading

Value Objects

Since I’ve already set you up in a DDD mood with the previous post, let’s capitalize on that further. In this post, I’ll try to provide an easy explanation of Value Objects and their

Continue reading

Aggregate Pattern

I’ve recently done some reading on DDD and Aggregates in particular. Since many people struggle to understand the pattern, I decided to try to explain it myself. Problem Imagine that you’re

Continue reading

The Stepdown Rule

It has recently occurred to me that some people are ordering the functions in a class randomly, mostly based on gut feelings. It’s a good indicator that we should rehash the old, simple but very

Continue reading

Entity Objects Power Ranking

There seems to be an ever-ongoing discussion about how powerful should an entity object be. That’s indeed a very valid discussion as the choice that we make (often unconsciously) will have a huge

Continue reading

Optional Method Parameters

I have recently come across an interesting problem: should you use Optional as a method parameter type? The majority of sources says that you shouldn’t, but let’s weigh the arguments before

Continue reading

Cleaner Tests with Spock

One obvious fact about tests that is often overlooked is: tests are code. This implies that the tests, as any kind of code, have to be read, understood and maintained. We’re smart, educated guys,

Continue reading

Keep Your Code Consistent

There’s a bunch of things in programming that have seemingly little to no meaning. Some of those things, despite their “seemingly” little meaning cause a lot of pointless discussions

Continue reading

10 Tips To Handle Null Effectively

When I started programming in Java, I considered the null value my enemy and I dreaded NullPointerExceptions that happened fairly often to me. Over time I learned working with it and nowadays I can consider

Continue reading
1 2 3