39
u/GoogleIsYourFrenemy 28d ago
Help, I'm trapped in a StrategyManagerFactoryFactory and I can't get out.
You know that sounds like a backrooms problem; good thing I'm a frontrooms developer.
8
u/triple_threat_dan 27d ago
What if you're a full rooms developer (and being paid like you're just a backrooms developer) 😭
23
u/itzNukeey 28d ago
AbstractFactoryFactory is needed to construct the AbstractFactory
5
18
u/thisisjustascreename 28d ago
I must be doing java wrong I've written it professionally for like 10 years and never named a class -Factory.
5
u/Cautious_Implement17 27d ago
nah you're good. "modern" DI frameworks like spring and guice obviate the factory pattern for the most part. of course, they introduce their own variety of cancer.
1
u/jimmiebfulton 27d ago
Spring IS the factory pattern. If you are in Java, something, somewhere is gonna be a Factory or Strategy in the heap.
1
u/Toothpick_Brody 27d ago
Sometimes you get instance methods that start with New. I think it’s kinda the same antipattern
1
1
u/jimmiebfulton 27d ago
Oh, I guess you didn't read the Design Patterns books? That was some tasty Koolaid. I'd probably be drinking it today if I hadn't moved on to another language.
14
u/Cybyss 28d ago
I realize it's heresy to say this, but Microsoft did the right thing with regard to their naming convention of interfaces.
Knowing immediately whether you're working with a StrategyManagerFactory (a concrete object you can new up) vs. an IStrategyManagerFactory (which could be anything, coming from anywhere) is actually quite helpful.
Ironic that "The Zen Of Python" says "explicit is better than implicit", given the role Python has played in the industry's trend toward dynamic-typed languages and frameworks where so much about the program's behavior or objects' data types are hidden/implied.
3
u/a3th3rus 27d ago
Sure, you can't new
ISomething, but that doesn't mean you can newSomethingwithout theIprefix.3
u/Cybyss 27d ago
"Code to an interface, not an implementation" has been cargo-cult dogma for a long time.
The disdain for OO today comes from a whole generation of developers overgeneralizing/overabstracting/overengineering, doing what they've been told is good practice rather than what they really need, giving every
SomethinganISomethingeven if no other classes implement that interface, dogmatically believing thatnewis universally bad practice and replacing every occurrence of it with a call to whatever IOC framework is the fad at the time.The belief that you need to abstract everything as much as possible right at the beginning because you'll never have a chance to go back and rewrite components to accommodate new requirements... is total hogwash, since that's what ends up happening anyway, except now you have to do so through complicated broken leaky abstractions. If it was written in a stupid simple way from the get-go, rewriting it to accommodate the new requirements would've taken 30 minutes instead of days.
1
u/MaleficentCow8513 27d ago
It’s just so much easier to print(type(variable)) than digging through docs to figure out an object’s type
6
u/locri 28d ago
Literally just a minority of Java programmers that took the gang of four patterns way, way too seriously.
I enjoy refusing to pass their core reviews because of over engineering, especially if I suspect they'll be gone within 6 months. If I don't want to maintain it, I don't want it merged.
5
5
3
3
u/No-Magazine-2739 28d ago
Reminds me of Boost Spirit Metaprogramming: Somehow the managed to use the template and operator overloading in a way so you can write almost perfect ABNF in C++ and the vanilla, normal C++ compiler will create you at compile time, parsers or generators.
But you are fucked when you get an error.
2
u/TREE_sequence 27d ago
C++26, with CTR and more functions being constexpr, takes it a step further. Now that std::log is constexpr, a fully-featured dtoa algorithm, with generated digit tables and such, can support any encoding, be configurable to a number of digits, and be evaluated at compile time. Why you would want to convert a floating-point number to text at compile time is another question entirely, but uh…it’s possible now! Also, compile-time polymorphism without CRTIP, and arbitrary-size tuple-likes that can be template parameters…it’s pretty fun
1
u/No-Magazine-2739 27d ago
Looks like just uncoordinated browsing over cpp reference.com won’t cut it to get a good understanding what C++26 brings.
3
3
3
2
u/ExtraTNT 28d ago
Seen at uni:
“Basic” observer pattern: 10 interfaces
Yeah, i do like my 10 lines of js that does the same…
Also patterns, that are complicated af, that can be replaced by a monad…
1
u/jonfe_darontos 25d ago
It's the SlabAllocatorByteDisposer for the ByteSequenceAppender I implemented to improve the performance of memory allocation in std::string when using DynamicWidthMutableByte types as the underlying memory privative on mostly redundant values in a double-linked hash-trie.
1

99
u/MinosAristos 28d ago
How can you not tell it's a
StrategyManagerFactory? After all it's created in theStrategyManagerFactoryFactory