DEV Community

Discussion on: What is your single most important rule for good software design?

Collapse
 
jamesmh profile image
James Hickey

Be explicit.

I've seen too many times things abstracted to the point where things just get too generic and you have no idea what's happening.

Honestly, I'd rather see the "same" non-business critical code duplicated then have to dig down through 5 levels of inheritance why dynamically generated methods on a class (yes, I had to refactor this kind of monstrosity in the last year! 😂)

For example, if your business has a rule that blog posts shouldn't have more than 10000 words per article, then a class called ArticleHasLessThan10000Words would be very explicit and easy to understand what it does.

I find this happens when we focus on the business aspect of what we are trying to solution vs. the technical "how"