EIP Special Report: DDD Is All Around

Announcer: This is a special edition of I Built His Cage on the EIP web-ring.

Yes, ladies and gentlemen, it’s an EIP Special Report this week, and that means the code will do the talking. And no, despite the rumors, Hydrocon has not been abandoned!

I’ve had the unique opportunity to develop a Java application, for one of my side projects, at work entirely by myself. The difference between this and Hydrocon is that this program will actually be used for something. Work on our main project has been scarce all sprint, so scarce, in fact, that I’ve had to invent practice code changes so the intern can get some practice.

This program’s mission is straightforward: take in a dump of architecture violations from a running of Structure 101 and an XML file associating Java packages with modules in source control with development projects and spit out how many violations each development project owns.

Some facts about the problem:

  • Version control projects control the source code of several Java classes.
  • Software projects have several version control projects.
  • A software project has worked on a Java class if at least one of its version control projects controls the source of that class.
  • If a software project has worked on the source Java class of an architecture violation, that software project owns the violation.

This is an exercise in string parsing. Oh sure, I could have banged out a procedural Java app with a bunch of private methods slinging strings to and fro. However, string parsing is no fun. I chose to make it significantly more complicated.

Oh yes: I wrote a domain-driven solution for this problem. There is an infrastructure layer, a domain layer, and a UI layer. Components are injected everywhere (homemade DI). Factories are the only classes that instantiate classes. And the result is some of the most beautiful code I’ve ever written, and I doubt it took any longer than procedural string-slinging would have.

The code isn’t complete, which is a reflection of external factors. You’ll need two input files to run this program, and they are not included. Trust me, it works. And I didn’t go overboard with type-hiding, since most datums can be adequately represented as strings.

Just explore the code. Pay attention to that list of facts as you peruse the code. They will be showing up as verbatim as can be done in Java. Here’s a preview:


Cue The Troggs:

I feel it in my fingers
You see it with your eyes
I see right through the static
Maintenance is so fun and nice

Announcer: You’re reading the EIP web-ring.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: