Beware of classes that have many accessor methods defined in their public interface. Having many implies that related data and behavior is not being kept in one place.
class test
{
private int thisData;
private int thatData;
private float moreData;
public void setThisData( int data ) { thisData = data; }
public void setThatData( int data ) { thatData= data; }
public void setMoreData( int data ) { moreData= data; }
public void getThisData( ) { return thisData; }
public void getThatData( ) { return thatData; }
public void getMoreData( ) { return moreData; }
public String toString() { // code deleted }
}
No work is being done in this class.
Other classes are getting the data in class test and performing some operation on it.
Why is this class not doing the work on the data!
Who is doing the work?
No comments:
Post a Comment