Link Details

Link 510335 thumbnail
User 368079 avatar

By sdavidr
Published: Nov 02 2010 / 09:23

Be prepared before you read this article. How can you turn continuing coding in Java while in other languages like Scala can simplify patterns in a single Class. In this example, the factory pattern is presented in Scala. There will a before and after in your mind questioning so many things... time, effort, size of your project code.... Are you ready?
  • 6
  • 4
  • 4853
  • 323
User 743721 avatar

Mahoney replied ago:

0 votes Vote down Vote up Reply

Hmm... I'm a Scala fan, but you can easily implement that factory in a single file in Java, too, using private static inner classes and a couple of static factory methods. Frankly there's not that much to choose between the two implementations; the overriding of a method with a constant and the lack of boilerplate around using the constructor arguments is about as nice as it gets. This particular example is a nice accessible introduction to Scala, but as an advert I doubt it will have anyone running to use it ahead of Java.

User 393686 avatar

RawThinkTank replied ago:

-1 votes Vote down Vote up Reply

Scala is not the future, its just an intermediary that directs evolution of C like languages to their next variations. Scala is a FP scam.

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java