• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clogged case classes

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option types to the rescue. For the optional parameters, I'm going to wrap them in an Option type.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the link to my original question!

http://stackoverflow.com/questions/20610975/case-classes-in-scala-with-behavior
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic