How to build a good abstraction
This isn't an article, it is an instance of an Idea in the form of a Communication
One of the most powerful tools while designing a system is that you can always solve a problem in a way that feels somewhat elegant by adding one more layer of indirection.
If you are working on an accounting system and need to store someone’s address, you might find silly things like HomeAddress and WorkAddress on the Customer object directly, and then later someone asks for VacationAddress. No, no, no. You need to introduce the idea of an Address, and a User can have multiple. And they can have AddressPurpose like Vacation Home, Business Office, Panic Room, etc.
In fact, Customer is too general a term. What you are really talking about are People, some of which might use your application, and others are just relevant to its work. Now there are People with Addresses. And they have other details like phone numbers, these can be ContactPoints and they can have multiple. They also have other attributes like height and weight and preferences.
But you know what, businesses can have offices and act as customers, so its really not People and Address, but User and Location.
Really we are talking about Entities and ObservableFeatures and Addressability, you know what this is really a Noun that can do certain Verbs and has certain Adjectives. Actually, what you have are Things that have associations with other Things.
Wow, now you only need a few tables1 and you’ll have a really generic system to track whatever it is supposed to —you forget. It's probably not important what the system does, you can now track it generically.
Rarely will you receive objections to these abstractions, as they seem like future-proofing and a Good Idea. People will not argue with you that trees are really plants of a certain type, or Organism : BasedOnCarbon
, even if the application you are building is called TreeFinder, and you have no idea if you will ever track anything else.
Abstractions in Your Career
Being good at abstractions can help your career:
If your company has some resources on AWS and some resources on Azure, you can secure yourself a decent job building out a cloud agnostic Cloud Provider framework that keeps you employed and in the middle of everything for nearly a decade.
Instead of currency, if you create an AssetTransfer that moves Entities from one MatterState to another, you are going to have to explain what in the heck is going on to every future programmer you work with, securing your employment. Object-oriented programming was built so that we could model things based on the real world, and maybe your view of the real world is just a little more creative than others. It is fine; you just have a different Noun that Verbs and Adjective.
And one either really happy or really mad DBA - happy because now every problem can be blamed on application code, or angry because now they can no longer help.