This Blog is Under Construction
Showing posts with label class design. Show all posts
Showing posts with label class design. Show all posts

Monday, November 16, 2015

Abstract Class and Interface

/* ::class design guidline::
 *
 * cohesion -> single entity + immutable
 * consistency -> choose informative name, similar operation's name, private in constructor
 * encapsulation -> use private modifier to hide info from direct access from clients. getter --> readable, setter --> updateable, if no setter method immutable
 * clarity -> you should n't declare a data field that can be derived from other data field
 * completeness -> class are designed for use by many different customer
 * instance vs static - > it is better use a setter method to change the static data field
 * inheritance vs aggregation -> is a(apple is a fruit), has a(person has a name)
 * abstrac class vs interface  -> what is choose? strong is a relationship(orange is a fruit), weak a relationship(circle, ractangle........ has a area)
 * 
 */