Tuesday, 15 May 2012

oop - how to recognize object's responsibility? -



oop - how to recognize object's responsibility? -

i'm new in oop , started learning it. complicated determine functionality of classes. let's take example:

we have address-book , user want add together new contact it. in scenario have 2 classes:

user: determine user logged in. contact: contact object consists of name, address, phone number, etc

and questions:

who have save new contact?user class or contact class if seek check user's permission before doing best place it? is ok these classes have access database?(is improve create 3rd class doing query stuffs?)

thanks thought ;)

usable distribution of "responsibility" oop design , architecture decision no single simple right answer. give-and-take refer stack overflow question what single influential book every programmer should read?

you'll larn pros/cons coding (using someone's design or creating own design not work well).

however there useful/frequent distributions of responsibility known http://en.wikipedia.org/wiki/software_design_pattern

in sentiment fixed fact each class/function/structure should have responsibility defined/documented - since first lines of code - , "do 1 thing , well"

oop design-patterns uml modeling

No comments:

Post a Comment