aspose file tools*
The moose likes Scala and the fly likes Clogged case classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Scala
Bookmark "Clogged case classes" Watch "Clogged case classes" New topic
Author

Clogged case classes

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

I have a set of case classes with parameters. These case classes are used by a couple of methods. When I make a small change to one of these case classes by adding a new parameter, then I have to fix all those lines of code that uses this case class. How do I avoid this but at the same time have only vals as parameters in my case classes?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Option types to the rescue. For the optional parameters, I'm going to wrap them in an Option type.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Joe Harry wrote:Option types to the rescue. For the optional parameters, I'm going to wrap them in an Option type.


I did use option types yesterday evening and after a couple of review at them, I made up my mind to get rid of them. I'm thinking of using these case classes with mixin traits! Is there any other idea that I could think of?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Here is the link to my original question!

http://stackoverflow.com/questions/20610975/case-classes-in-scala-with-behavior
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clogged case classes