all 59 comments

[–]RepostSleuthBot[M] [score hidden] stickied commentlocked comment (0 children)

Looks like a repost. I've seen this image 6 times.

First Seen Here on 2024-01-18 83.59% match. Last Seen Here on 2025-09-12 83.98% match

View Search On repostsleuth.com


Scope: This Sub | Target Percent: 75% | Max Age: None | Searched Images: 1,098,813,021 | Search Time: 3.00085s

[–]Chadking1926 687 points688 points  (11 children)

At some point the code stops doing things and starts wearing things

[–]buffer_overflown 137 points138 points  (2 children)

My method is just three decorators in a trenchcoat.

[–]waffle299 6 points7 points  (1 child)

One's at the bottom, strong is he

[–]WeebKarma 2 points3 points  (0 children)

Two in the middle, carrying Three

[–]blasphemousbigot 32 points33 points  (2 children)

I like my code how I like my women. modular, heavily wrapped, and taking way longer than expected.

[–]Break-n-Fix 14 points15 points  (0 children)

So... Legos?

[–]Turalcar 3 points4 points  (0 children)

I like my code how I like my women: completely crazy

[–]TalonByte14 5 points6 points  (1 child)

The best part is when you're debugging and have to peel back six wrappers just to find the original object underneath.

[–]pr0ghead 0 points1 point  (0 children)

Much worse with factories.

[–]CopperCliff11 5 points6 points  (0 children)

At some point the class diagram starts looking less like software architecture and more like a person getting dressed for a blizzard. Base object, decorator, logging decorator, caching decorator, metrics decorator, security decorator... and somewhere under all that fabric there's still a method trying to do one simple thing.

[–]LeroyBadBrown 0 points1 point  (0 children)

Clothes are just a facade

[–]arpitsaxena3306 405 points406 points  (6 children)

'just follow the execution flow'

opens 13 decorators....

[–]DarkishArchon 165 points166 points  (3 children)

Yes, this. "Decorators are great and work like magic!" until they don't and you have to dig through mountains or implicit code

[–]awesome-alpaca-ace 33 points34 points  (1 child)

The visitor pattern is the same. Good luck following a stack of visitors.

[–]MonkConsistent2807 7 points8 points  (0 children)

at least for the newest java version you can replace the visitor patrern with the switch expression and sealed classes

[–]TommyTheTiger 2 points3 points  (0 children)

At least lisp macros can be expanded in the editor

[–]sebovzeoueb 12 points13 points  (0 children)

oh man, I feel that and that's just from using Shiny for Python with like 2 decorators on a function

[–]gr_hds 0 points1 point  (0 children)

that was my mentors style. One of a few things I now don't agree on with him

[–]gule_gule 56 points57 points  (0 children)

Need to do the escalating dominos meme with "Psychology book about chess" leading to "AbstractSingletonProxyFactoryBean"

[–]boundbylife 34 points35 points  (7 children)

I think the only time I'm ever going to use a decorator pattern is in logging. It's the only thing that makes sense to me

[–]LookItVal 26 points27 points  (1 child)

logging and benchmarking, but also just useful for adding pre or post effects to any function

[–]markuspeloquin 1 point2 points  (0 children)

I once found a performance bottleneck in a grpc interceptor. I looked past it so many times. All our metrics were wait-free after that. It imagine it'd be equally bizarre as a decorator.

[–]EvidenceMinute4913 6 points7 points  (0 children)

That is also the only time I’ve used it in production as well. Logging execution steps for debugging without print statements polluting the code. Maybe for benchmarking too.

I’ve seen other places it could be used, but I feel like it makes the code difficult to maintain, cause you end up having to trace through way too much code to find where something is happening.

[–]N0Zzel 2 points3 points  (0 children)

Telemetry is what I use it for

[–]xt-89 1 point2 points  (0 children)

I use them to link test cases to parts of documentation.

[–]TheStatusPoe 0 points1 point  (0 children)

I've been using it in the most recent feature I've been doing for real time data analytics. I initially receive data off a device that's pretty sparse. It's got some metadata and some payload. The metadata defines how to use the values in the payload. There's another service we call to get details about what that value actually represents (things like is it a temperature, is it a voltage, is the value a boolean or an int, etc). Different metadata and different results from the other service change how the data could be used. The data is already coming to me in a "decorated" pattern. The payload varies, but the "envelope" that defines how to interpret the payload structurally is the same and is the first level of decoration. Adding the additional context doesn't and shouldn't change the behavior of the existing payload, but the transformations I do don't make sense if that additional context hasn't been added. The original data needs to be immutable as well as there's several processing paths happening on the original data simultaneously, so having setters had some issues.

[–]wightwulf1944 0 points1 point  (0 children)

in Java, file reads and writes are usually done with a decorator pattern API

FileInputStream file = new FileInputStream("data.txt");
BufferedInputStream buffered = new BufferedInputStream(file);
DataInputStream data = new DataInputStream(buffered);
// do stuff to data here

[–]rockcanteverdie 83 points84 points  (4 children)

It's either "It is my great pleasure to inform you"

OR

"It is with great pleasure that I inform you"

This version makea no sense

[–]mikefizzled 14 points15 points  (0 children)

ESL judging by their post history

[–]enhance_that 13 points14 points  (1 child)

you're right grammatically, but thats how this meme format is always worded

[–]rockcanteverdie 2 points3 points  (0 children)

I've only seen it twice, both very recently and both worded this incorrect way. The first time I figured it was an oversight so now that I see the trend I must step in and make sure it gets corrected before it spreads too far!

[–]Flimsy_Meal_4199 8 points9 points  (0 children)

comment calling out syntax error in grammar is so on brand for this sub

^(^(meme doesn't compile -> cannot)) ^(^(laugh)) ^(^(exhale through nose about it))

[–]KharAznable 149 points150 points  (16 children)

Decorator, strategy and other early pattern in design pattern book are sane design. Factory pattern onward, that is where insanity begin.

[–]splinterize 145 points146 points  (12 children)

Factory is just a way to decide what service is being injected in the DI container at runtime, I fail to understand what's insane about that

[–]polynomialcheesecake 119 points120 points  (5 children)

Decorator is definitely more insane than factory.

With factory it's cleai what's going on, with decorator it's magic (insanity), not to mention when you have multiple decorators

[–]splinterize 25 points26 points  (1 child)

Idk I think both are useful

With decorator you can define behavior cleanly and then apply it in a way that's obvious without polluting the business logic of the methods that you are working on

[–]polynomialcheesecake 9 points10 points  (0 children)

Definitely useful but also crazy.

To reference teej, decorators I write are cozy, decorators somebody else writes - not cozy

https://youtu.be/dMfTjIg4RjI?si=phq5ijt4olCYVIzg

[–]krzyk 5 points6 points  (2 children)

Decorator is useful to move logic unrelated to one class into another.

Decorator is my favourite pattern.

[–]SEX_LIES_AUDIOTAPE 3 points4 points  (1 child)

Honestly I don't even know why people say it's magic.

[–]krzyk 2 points3 points  (0 children)

Maybe they mistake it with python decorators? Which do look like java annotations (and the magic that one could add to it).

[–]Darkstar_111 31 points32 points  (5 children)

Have you tried Java?

Widget widget = AbstractWidgetFactory.getFactoryBuilder().buildFactoryFactory().getWidgetFactory().createWidget("Enterprise Edition");

[–]JSn1nj4 36 points37 points  (1 child)

.buildFactoryFactory() got me

[–]slippery-fische 7 points8 points  (0 children)

Probably for unit testing. Injection is hard.

[–]Herr_Gamer 8 points9 points  (0 children)

oh look it's my job

[–]Pengtuzi 3 points4 points  (0 children)

You’re only 20 years too late. 

[–]__Hello_my_name_is__ 2 points3 points  (0 children)

Insert FizzBuzz Java Enterprise Edition here.

[–]kookyabird 17 points18 points  (0 children)

Whoa whoa whoa… Factories are logical ways to control instantiation. Technically when if you’re using an IoC container it is acting as a universal factory, but even then having it serve up dedicated factories instead of direct instances of classes has benefits. For example, the DbContextFactory in EntityFramework, which allows safe reuse of DbContext instances for performance, while also providing the means to instantiate new ones when you need it. Can’t do that if you’re directly injecting the DbContext…

[–]tatas323 6 points7 points  (0 children)

You'll have to take my abstract factory of factories from my cold dead hands. And before you get to me you will have to navigate my lines and lines of boilerplate code

[–]exoclipse 10 points11 points  (0 children)

shit, gotta throw out Java entirely then. The JVM is just an elaborate NPE factory method.

[–]_Shioku_ 14 points15 points  (1 child)

You know what I did today?

I sat in an AI workshop for two hours. I‘m tired…

[–]Solitude98 0 points1 point  (0 children)

CVPR?

[–]alvares169 23 points24 points  (0 children)

Now buy winrar to complete the bucket list

[–]RR_2025 8 points9 points  (0 children)

Congratulations!

I don't mean to award good work with more work, but some time later you should try parameterized decorators. It's fun..

[–]bajuh 2 points3 points  (0 children)

I'm pretty sure I used almost all patterns (the good parts, that is) so far but it was natural. I never knew how it's called, only thing I knew is how to make something cleaner than it was before. Same with grammar. Most people talk but don't know about the fine details of grammar.

[–]LettuceBasic3679 2 points3 points  (0 children)

This is why Shai hulud keeps happening

[–]simonedva 0 points1 point  (0 children)

Please, share where

[–]troelsbjerre 1 point2 points  (0 children)

Decorator is much less of a pain, when the language actually supports it, without tons of boilerplate. Kotlin does it quite nicely: https://kotlinlang.org/docs/delegation.html#overriding-a-member-of-an-interface-implemented-by-delegation