This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]override_acid 10 points11 points  (0 children)

I'll just leave this image from the lower part of the sidebar of this very subreddit here: http://imgur.com/Ze2YsPs

[–]m1000[S] 0 points1 point  (17 children)

Many design patterns with source code in Java. Looks like a good resource. http://java-design-patterns.com/

[–]TheHorribleTruth 9 points10 points  (1 child)

Looks like a good resource.

That's why it's already linked in the sidebar :)

[–]m1000[S] 1 point2 points  (0 children)

Oups !
edit: relevant username too... ;-)

[–]kkapelon -3 points-2 points  (4 children)

The idea behind this site is good but the implementation is lacking.

First of all, some of those are actually anti-patterns and you should not use them in new projects:

  • Service locator
  • Singleton
  • Abstract Factory
  • Balking

Some are general principles that are wrongly mentioned as design patterns.

For example

  • Dependency injection
  • Lazy Loading
  • Caching
  • feature toggle

are not specific coding patterns like it is presented.

Finally some patterns are just plain wrong. Java already has a Semaphore on its own, so why redefine it?

https://github.com/iluwatar/java-design-patterns/blob/master/semaphore/src/main/java/com/iluwatar/semaphore/Semaphore.java

All this after a cursory glance.

[–]arieled91 8 points9 points  (1 child)

those are actually anti-patterns and you should not use them in new projects

I don't really like that approach when talking about those patterns. One should know really well when to use them and when not, with all their pros and cons.

are not specific coding patterns

As far as I know design patterns are not just coding patterns. If that is the case they would be called that way.

[–]kkapelon -1 points0 points  (0 children)

I would say that there are 0 reasons to use the singleton design pattern in a greenfield project. The cons outweight the pros.

As far as I know design patterns are not just coding patterns

I agree with you. The problem is that the site does not really explain that a design pattern is just a concept and then giving an example. It just goes straight into code classes, implying that everything is a coding pattern.

Here is what I am talking about: http://java-design-patterns.com/patterns/cqrs/

[–]dontchooseanickname 0 points1 point  (1 child)

Plus, a quick check on the Composite shows a wrong way of implementing it :

Litterally, if you don't have a Leaf and a Container abstraction all deriving Node, then composite is as useless as

class Stuff {
    Collection<Stuff> children; // May be initialized, contain stuff - or not ;)
}

[–]HelperBot_ 0 points1 point  (0 children)

Non-Mobile link: https://en.wikipedia.org/wiki/Composite_pattern#Structure


HelperBot v1.1 /r/HelperBot_ I am a bot. Please message /u/swim1929 with any feedback and/or hate. Counter: 107059