Link Details

Link 510335 thumbnail
User 368079 avatar

By sdavidr
via j2eethoughts.wordpress.com
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
  • 4828
  • 323

Comments

Add your comment
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.

Voters For This Link (6)



Voters Against This Link (4)



Play Framework
Written by: Ryan Knight
Featured Refcardz: Top Refcardz:
  1. Akka
  2. Design Patterns
  3. OO JS
  4. Cont. Delivery
  5. HTML5 Mobile
  1. Akka
  2. JUnit/EasyMock
  3. Java Performance
  4. REST
  5. Java