The Artima Developer Community
Sponsored Link

Java Buzz Forum
Domain Objects as dumb data holders

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Marc Logemann

Posts: 594
Nickname: loge
Registered: Sep, 2002

Marc Logemann is founder of www.logentis.de a Java consultancy
Domain Objects as dumb data holders Posted: Feb 2, 2005 12:55 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Marc Logemann.
Original Post: Domain Objects as dumb data holders
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
Latest Java Buzz Posts
Latest Java Buzz Posts by Marc Logemann
Latest Posts From Marc's Java Blog

Advertisement
In the last days i read several times (in books and in the web) that implementing Domain Objects as simple data holders is not OOP and is in general bad practice. I must admit that i do the same thing. Lets see what i do regulary (and i am sure that many if not most others do the same):
public class User() {

   private String name;
   private Date birthday;

   public String getName() {
      return firstname:
    }

    public String getBirthday() {
       return birthday;
    }

    public void setname(String n) {
        name = n;
    }

    public void setBirthday(Date d) {
        birthday = d;
    }
}
As you can see, this is a pretty normal Domain object that will be persisted into a database. As we live in a transparent persistence world, we dont need anything more. But some people say that this is not OOP, because we dont have any behavior, just a state. First of all, i cant see too much other methods i should implement here. I think those people want methods like:
   public int calculateAge() {
       // calculate age
   }
So basically i can see some more methods one could implement, but excessive business method coding is IMO not apropriate.

Read: Domain Objects as dumb data holders

Topic: Cω (Comega) Programming Introduction Previous Topic   Next Topic Topic: Why Open Source???

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use