Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Rich Domain Model Q

  1. #11
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    I absolutely agree that automatically adding getters/setters for all fields is just a bad thing. That being said, it seems to me that it'd be going too far toward the other extreme by automatically forbidding all the setters. If we all agree that some, if not most, objects in any domain model by their nature can never be immutable, why do we insist on making them so?
    --Jing Xue

  2. #12
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by manifoldronin
    I absolutely agree that automatically adding getters/setters for all fields is just a bad thing. That being said, it seems to me that it'd be going too far toward the other extreme by automatically forbidding all the setters. If we all agree that some, if not most, objects in any domain model by their nature can never be immutable, why do we insist on making them so?
    Replacing setters (like setSalary and setFireDate) by business methods (like fire or hire) doesn't lead to immutable objects.

  3. #13
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    Quote Originally Posted by Alarmnummer
    Replacing setters (like setSalary and setFireDate) by business methods (like fire or hire) doesn't lead to immutable objects.
    Absolutely. My comment was directed to the OP's "I removed all the setters" part.
    --Jing Xue

  4. #14
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by manifoldronin
    Absolutely. My comment was directed to the OP's "I removed all the setters" part.
    Do you have idead about packaging? Personally I prefer to package by functionality and not by position in one of the layers.

  5. #15
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    Quote Originally Posted by Alarmnummer
    Do you have idead about packaging? Personally I prefer to package by functionality and not by position in one of the layers.
    Me, too. Projects with packages like "controllers", "daos", "ejbs" are just depressing.
    --Jing Xue

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •