Home » Software Development » Coding: Is there a name for everything?

About Mark Needham

Mark Needham

Coding: Is there a name for everything?

A month ago I wrote a post describing an approach my team has been taking to avoid premature abstractions whereby we leave code inline until we know enough about the domain to pull out meaningful classes or methods.

Since I wrote that post we’ve come across a couple of examples where there doesn’t seem to be a name to describe a data structure.

We are building a pricing engine where the input is a set of configurations and the output is a set of pricing rows associated with each configuration.

We modelled the problem using a List of Pairs of Configuration/PricingItems:

List<Pair<Configuration, PricingItem>> configurationToPricingItems = buildThoseCombinations();

We don’t need to do any lookups by Configuration – just show the results to the user – which is why we haven’t used a Map.

Our object oriented background suggested that there should be a name in the business domain for this but when we spoke to our business analyst and subject matter expert it became clear that they didn’t actually have a word.

Despite that it still feels strange to have to pass around a List of Pairs but I wonder if that’s because in Java we tend to abstract concepts behind classes rather than because it makes sense to do so.

If we were using clojure then I don’t think we’d feel as uncomfortable about passing around basic data structures because the language and the culture around it encourage this. We should only create a type when it’s strictly necessary.

In this case it’s a data structure to carry those combinations around and we don’t actually apply any logic to the data structure as a whole, only to the individual entries.

We wrote the code about three weeks ago now and haven’t experienced any difficulties in terms of the code being understandable or easy to work with.

I’m intrigued as to whether others have noticed a similar thing or if we aren’t embracing Domain Driven Design fully and need to dig deeper to find a missing domain concept?

Reference: Coding: Is there a name for everything? from our NCG partner Mark Needham at the Mark Needham Blog blog.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of