Hacker News new | past | comments | ask | show | jobs | submit login

Reminds me of FizzBuzzEnterpriseEdition . https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

You never know when you might need to change the implementation of how the "Fuzz" string is returned, so you need a FuzzStringReturner.

And you never know when you might need multiple different ways of returning "Fuzz", so you need a FuzzStringReturnerFactory.

And for SOLID it's important to separate concerns, so you want your FuzzStringReturnerFactory separate from your FuzzStringPrinterFactory.

And that barely scratches the surface of what you need!




Yip dealing with a code base right now that's like this. Devs do this for job security. Make the thing incomprehensible to others guarantees you can't be fired right? It also guarantees a promotion right up to team lead or dev manager.

Another note it's not what's the best SOLID design it's what that original dev thinks is the best SOLID design. SOLID in itself is loose enough that you can have designs that vary massively but are still technically SOLID.


A good dev should comment their readable code so well that anyone can drop in and figure it out.

Unfortunately that good dev is no longer employed at this company...


FizzBuzzEnterprise is just "closed to modification" / "open to extension" taken to the extreme on a trivial problem.


Except that sometimes it’s hard to tell when the problem you’re working on is trivial. I saw this pattern used as a source of data for a drop down list of office locations. It should have been “select id, name from office_locations”. It really was that simple. But it was an “enterprise app”, so instead we had 5 classes and so much more.


It would be easier if people were encouraged to find the simplest solutions in their education, rather than being indoctrinated with somebody's long list of Patterns that will somehow make your code Good if you do them enough.


Maybe we just work at completely different kinds of places, but I’ve worked with a ton of people who don’t know what patterns are and very few who over-apply them


Conversely, we have a single React component for displaying locations, and a whole plethora of different parameters to send into the backend call with a variety of different effects. Having a factory or interface pattern here would have been really nice.


Sure, if that’s the use case. But I think the point of this thread is that in many cases we add functionality despite the lack of immediate necessity, and this causes problems.


From the test suite:

    this.doFizzBuzz(TestConstants.INT_14, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11_FIZZ_13_14);
This is hilarious




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: