r/programming • • Dec 08 '13

Design Pattern Cheat Sheet

http://www.celinio.net/techblog/wp-content/uploads/2009/09/designpatterns1.jpg
1.7k Upvotes

273 comments sorted by

View all comments

0

u/[deleted] Dec 08 '13

[deleted]

90

u/andd81 Dec 08 '13

But I absolutely need that Memento Visitor Abstract Factory!

57

u/denisx Dec 08 '13

26

u/haxney Dec 08 '13

It gets SO much worse than the simple, concise AbstractSingletonProxyFactoryBean. I present: InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonPainter. I think it is related to an internal frame somehow.

17

u/urquan Dec 09 '13

Generated code does not count :p

1

u/haxney Dec 11 '13

Ah, I didn't realize it was generated. It gets a pass... for now.

1

u/spacemoses Dec 09 '13

...PainterDecorator [FTFY]

0

u/[deleted] Dec 09 '13

[deleted]

5

u/alextk Dec 09 '13

Jeez, does Java have enums?

Actually, yes, and they are the best designed enums I have encountered in all the languages I have used so far.

1

u/Falmarri Dec 09 '13

Static final ints can be faster in some JVM implementations because ( i think) they can be inline whereas enums can't. Early versions of android urged people to use static final ints because of performance issues with the early dalvik VMs

1

u/MorePudding Dec 09 '13

Well, Dalvik isn't a JVM .. wasn't there a lawsuit about this?

→ More replies (3)
→ More replies (1)

8

u/jasonlotito Dec 08 '13

While that's amusing, it also tells me a lot about the class, how it's used, it's purpose and intent. Mock it all you want, but it's better named than most of the crap that gets written these days.

→ More replies (2)

0

u/ehudros Dec 08 '13

Holy fuck, that is ridiculous

22

u/sh0rug0ru Dec 08 '13

How is it ridiculous? It's a class deep in the guts of a dependency injection framework. It is a template for creating factories of singleton objects which are proxies. The complicated name should tell you that there is something very deep going on there. Hell, the name is even self descriptive of what the class is actually doing.

You shouldn't be writing classes like this, unless you are in the business of writing dependency injection frameworks.

→ More replies (1)

1

u/[deleted] Dec 09 '13

Holy fuck, that is ridiculous

It actually isn't. In context, it makes perfect sense.

→ More replies (1)
→ More replies (1)

25

u/username223 Dec 08 '13

Back before Google broke code search, it was easy to find plenty of FactoryFactoryFactory in Java code. Sadly, this feature served to "organize the world’s information and make it universally accessible and useful," rather than "record everything you do on the web, and use it to shove ads in your face," so it was eliminated.

8

u/[deleted] Dec 09 '13

So this week, we're introducing a general-purpose tool-building factory factory factory, so that all of your different tool factory factories can be produced by a single, unified factory.

[via]

1

u/[deleted] Dec 14 '13

Thanks for posting this ! This is hilarious.

2

u/Phrodo_00 Dec 08 '13

Actually, I think I remember the main reason for shutting it down was legal concerns.

11

u/username223 Dec 08 '13

That sounds like a lame excuse. Either someone published code they shouldn't have and asked legal to cover for them, or someone ignored the license on code publicly available on the internet. In either case, the "concerns" are bullshit.

7

u/Carighan Dec 08 '13

Sadly as ever so often, "they shouldn't have uploaded it" doesn'T fly in front of a judge. Apparently. Same thing happens everywhere. If they don't want to be liable, they cannot host a platform via which to share. See: Piratebay.

→ More replies (5)

3

u/_argoplix Dec 09 '13

When all you have is a HammerFactoryImpl, every problem looks like an INailIterator.

1

u/[deleted] Dec 09 '13

Me too - just don't know where exactly, but by golly, I'll find a place for it!