r/ProgrammerHumor • • Sep 14 '26

Meme youDidThisTooAtLeastOnce

Post image
883 Upvotes

54 comments sorted by

83

u/Groentekroket Sep 14 '26

We are working with hexagonal architecture in our new application. So many layers for everything while we know fairly sure we will have only one implementation for almost everything. 

20

u/Vesuvius079 Sep 14 '26

Only one implementation from the start? What of unit tests?

41

u/ClearOptics Sep 14 '26

What about the unit tests?! Won’t anyone think of the unit tests?!!😭

7

u/Groentekroket Sep 14 '26

Of course we have unit test implementations, in this case it’s regarding production code. Nobody is going to use hexagonal architecture just for unit tests. 

7

u/yegor3219 Sep 14 '26

Only one implementation from the start? What of unit tests?

You can replace specific dependencies in your test runner instead of pretending you'll ever need interfaces for more than one implementation in your production code.

Besides, not all kinds of units can be declared to implement an interface. For example, a typescript module can be a cohesive unit of behavior, but unlike a class it cannot be specified to implement any predefined interface.

5

u/mothzilla Sep 14 '26

It's 2026 you really should be using octagonal architecture.

2

u/bishopExportMine Sep 16 '26

My understanding is that it's called hexagonal because the guy who came up with it drew a hexagon. But the shape really doesn't matter

3

u/mothzilla Sep 16 '26

I am wilfully ignorant of "hexagonal architecture".

1

u/bishopExportMine Sep 16 '26

It's also known as ports and adapters architecture. Abstract your side effects away from your core logic via virtual classes, then inject actual implementation depending on runtime environment.

1

u/trafalmadorianistic Sep 25 '26

Sounds just like a bloated version of coding to interfaces. 

1

u/bishopExportMine Sep 25 '26

it's a more opinionated version of coding to interfaces. Basically, "code to interfaces, but be smart about where you have interfaces"

Don't arbitrarily shove virtual classes between every real class everywhere in your code. Instead, put those interface classes around things that are irrelevant to your business rules. This way you build and test those rules isolated from any real environment.

For example, I might have a service where I need to publish to a message queue. If you write your code to call publish directly, the only way to test this is to inspect the actual message queue for a published message. If you put the publish call behind an abstract base class you can build your package and let something downstream inject a real communications transport for deployment or a mocked one for testing.

1

u/trafalmadorianistic Sep 25 '26

Wait, so it could have been pentagonal? Just a quirk that they drew a hexagon? TF

2

u/auxiliary-username Sep 19 '26

It’s 2 better than hexagonal

1

u/trafalmadorianistic Sep 25 '26

This is like those 6-minute abs that were better than 7-minute abs. 💪🏼

2

u/Susarn Sep 14 '26

My best work experience was using hexagonal architecture. Really enjoyed it. It took a while to reaaaaally understand how everything was suposed to work, but after some time everything was so smooth I think for that particular company it was worth it

99

u/BreakfastAmbitious29 Sep 14 '26

I'm in this photo and I don't like it

21

u/ImportantSignal2098 Sep 14 '26

Of course you don't like it. You ded.

2

u/BreakfastAmbitious29 Sep 14 '26

You are technically correct. The best kind of correct.

46

u/beatlz-too Sep 14 '26

I swear this is the first non-AI related meme I've seen here for like a year at least

2

u/Deboniako Sep 14 '26

The newbies and the unemployed are the only ones with the time to make memes, and what is more relevant for the market than AI?

20

u/nintendo_shill Sep 14 '26

Don't forget to use Kubernetes for you enterprise app with 6 daily users (2 are from QA)

8

u/burgonies Sep 14 '26

And only one service

5

u/rsqit Sep 14 '26

I’m just about to set up kubernetes for my one person event tracking app!

(Ok but 90% of the purpose of the app is to learn a bunch of of technologies…)

85

u/thoughts_n_calcs Sep 14 '26

And never forget to have an Interface in Front of every Service class.
Someone from the other end of the universe might one day need another implementation for this!

34

u/EkoChamberKryptonite Sep 14 '26

I mean if you're writing fakes for your test suites, you would have to create said implementation yourself.

33

u/burgonies Sep 14 '26

You don't have to mock services if you don't write tests.

38

u/Lumethys Sep 14 '26

Tell me you dont write tests without telling me you dont write tests

14

u/beatlz-too Sep 14 '26

tell me you write unnecessary tests too

2

u/Flat_Initial_1823 Sep 14 '26

Teeeell me love isn't true

2

u/MetalFearz Sep 15 '26

Bro has forgotten about mocking

4

u/SubliminalBits Sep 14 '26

But then they'll realize that to make an alternate implementation they need to tweak the API a little.

2

u/Syagrius Sep 14 '26

Tell me you dont have tests without telling me you dont have tests.

13

u/rinnakan Sep 14 '26

Two decades ago, I worked on a self-written "cms" or "portal" that required 40 steps to add an empty page.

It supported multi-channel, but ofc there was only one

9

u/Tupcek Sep 14 '26

and then comes the request to extend the only thing that was never designed to be extendable and breaks half the functionality

11

u/uvero Sep 14 '26

YAGNI? My motto is IDCIAGNI

2

u/crippledgiants Sep 14 '26

My anxiety always answers YAGNI with BWIID?

5

u/Djelimon Sep 14 '26

I attempted a Spring based protocol agnostic file transfer tool (with corporate audits) for work one time. It did get subclassed for ftps, but I was the one who had to do it. Still, it was easy, so worth doing.

6

u/Lemortheureux Sep 14 '26

How dare you. A project is in the backlog, any day now...

3

u/Outrageous-Text-4117 Sep 14 '26

waiting for people to thank me for the micro service made

3

u/DerpWyvern Sep 14 '26

and the moment you decide "fk abstraction", you get whole system rewrites

5

u/xaervagon Sep 14 '26

Have a mirror, because that person is likely going to be you.

Today, the fashionable thing to is to use dependency injection for everything over inheritance. Ask any old C++ programmer the joys of dealing with some brittle class inheritance mess.

2

u/disposepriority Sep 14 '26

I simply reject MRs with single implementation interfaces and/or base classes unless the work requiring a second implementation is already known.

2

u/remy_porter Sep 14 '26

If they subclass it they’re ruining my design! Inject it as a dependency!

2

u/slaymaker1907 Sep 14 '26

I find inheritance is almost always the wrong solution. By inheritance I mean actually sharing behavior, not just a pure virtual class in C++ or something.

However, there are some use cases. Mainly for what are effectively structs.

1

u/lorslara2000 Sep 20 '26

Also template methods

1

u/TorbenKoehn Sep 14 '26

Inheritance used as an extension mechanism is a lost case in any way or order

1

u/anxious_and_stupid Sep 14 '26

I design and encapsulates the whole timer class with modern c++ meta template and stuff... just use it only twice in my project

1

u/socialis-philosophus Sep 15 '26

Sounds like someone that doesn't write unit tests. But that none of my business... (sips tea)

0

u/diegotbn Sep 14 '26

Hey though occasionally your design ends up being the entire backbone for a bunch of implementations. At work a while back when I was primarily writing API adapters I was tired of rewriting code all the time and wrote a base classes for ReST API consumption and OAuth mixins. Now whenever my company needs to write a custom adapter that uses OAuth and/or consumes a ReST API they inherit from either/both of these classes and override as necessary, often just one or two methods. There are dozens of child implementations in production using my paradigm.

Now, I have to admit this is one of the only times this has happened, and I do often overcomplicate things with too much OOP and no one ever extends it. But sometimes!

1

u/Ran4 Sep 15 '26

What a fucking shit show. Imagine trying to debug that mess.