FIT3077 Lecture 3: Principles of OO Analysis & Design
Principles of OO Analysis & Design
What is OO Design?
No sharp boundary between analysis and design
●Conceptual - Analysis
●Specificaon - Analysis & Design
●Implementaon - Design
Key Ideas in OO Design
Abstraction
The essenal characteriscs of an object that disnguish it from all other kinds of object and thus
provide well defined conceptual boundaries, relave to perspecve of the viewer
Reduction of dependencies
●Dependency : when a change in some element of soware may cause in another element of
soware
●Cause of maintenance problems
●Less dependencies the beer
Open/Close Principle
Classes should be open for extension ( add funconality) but closed for modificaon
Principles of OO Design
Encapsulation
●Process compartmentalizing the elements of an abstracon that encapsulates its structure
and behaviour
●Serves to separate the contractual interface of an abstracon from its implementaon
Connascence
●Between two soware elements they used for some related purpose
●A change in one would cause a change in another
●Stac Connascence : can be assessed from the code/structure of the classes
●Dynamic Connascence: based on the execuon paern of the running code
●Use encapsulaon to manage connascence
●Guidelines:
○Minimise overall connascence by breaking the system into encapsulated components
○Minimise any connascence with crosses encapsulaon boundaries
○Maximise the connascence within encapsulaon boundaries
Document Summary
The esse(cid:374)(cid:415)al (cid:272)hara(cid:272)teris(cid:415)(cid:272)s of a(cid:374) o(cid:271)je(cid:272)t that dis(cid:415)(cid:374)guish it fro(cid:373) all other ki(cid:374)ds of o(cid:271)je(cid:272)t a(cid:374)d thus pro(cid:448)ide (cid:449)ell de (cid:374)ed (cid:272)o(cid:374)(cid:272)eptual (cid:271)ou(cid:374)daries, rela(cid:415)(cid:448)e to perspe(cid:272)(cid:415)(cid:448)e of the (cid:448)ie(cid:449)er. Depe(cid:374)de(cid:374)(cid:272)(cid:455) : (cid:449)he(cid:374) a (cid:272)ha(cid:374)ge i(cid:374) so(cid:373)e ele(cid:373)e(cid:374)t of so(cid:332)(cid:449)are (cid:373)a(cid:455) (cid:272)ause i(cid:374) a(cid:374)other ele(cid:373)e(cid:374)t of so(cid:332)(cid:449)are. Classes should (cid:271)e ope(cid:374) for e(cid:454)te(cid:374)sio(cid:374) (cid:894) add fu(cid:374)(cid:272)(cid:415)o(cid:374)alit(cid:455)(cid:895) (cid:271)ut (cid:272)losed for (cid:373)odi (cid:272)a(cid:415)o(cid:374) Pro(cid:272)ess (cid:272)o(cid:373)part(cid:373)e(cid:374)talizi(cid:374)g the ele(cid:373)e(cid:374)ts of a(cid:374) a(cid:271)stra(cid:272)(cid:415)o(cid:374) that e(cid:374)(cid:272)apsulates its stru(cid:272)ture a(cid:374)d (cid:271)eha(cid:448)iour. Ser(cid:448)es to separate the (cid:272)o(cid:374)tra(cid:272)tual i(cid:374)terfa(cid:272)e of a(cid:374) a(cid:271)stra(cid:272)(cid:415)o(cid:374) fro(cid:373) its i(cid:373)ple(cid:373)e(cid:374)ta(cid:415)o(cid:374) Bet(cid:449)ee(cid:374) t(cid:449)o so(cid:332)(cid:449)are ele(cid:373)e(cid:374)ts the(cid:455) used for so(cid:373)e related purpose. A (cid:272)ha(cid:374)ge i(cid:374) o(cid:374)e (cid:449)ould (cid:272)ause a (cid:272)ha(cid:374)ge i(cid:374) a(cid:374)other. Sta(cid:415)(cid:272) co(cid:374)(cid:374)as(cid:272)e(cid:374)(cid:272)e : (cid:272)a(cid:374) (cid:271)e assessed fro(cid:373) the (cid:272)ode/stru(cid:272)ture of the (cid:272)lasses. D(cid:455)(cid:374)a(cid:373)i(cid:272) co(cid:374)(cid:374)as(cid:272)e(cid:374)(cid:272)e: (cid:271)ased o(cid:374) the e(cid:454)e(cid:272)u(cid:415)o(cid:374) pa(cid:425)er(cid:374) of the ru(cid:374)(cid:374)i(cid:374)g (cid:272)ode. Mi(cid:374)i(cid:373)ise o(cid:448)erall (cid:272)o(cid:374)(cid:374)as(cid:272)e(cid:374)(cid:272)e (cid:271)(cid:455) (cid:271)reaki(cid:374)g the s(cid:455)ste(cid:373) i(cid:374)to e(cid:374)(cid:272)apsulated (cid:272)o(cid:373)po(cid:374)e(cid:374)ts. Mi(cid:374)i(cid:373)ise a(cid:374)(cid:455) (cid:272)o(cid:374)(cid:374)as(cid:272)e(cid:374)(cid:272)e (cid:449)ith (cid:272)rosses e(cid:374)(cid:272)apsula(cid:415)o(cid:374) (cid:271)ou(cid:374)daries. Measure the i(cid:374)terrelated(cid:374)ess of the (cid:373)ethods i(cid:374) the e(cid:454)ter(cid:374)al i(cid:374)terfa(cid:272)e of (cid:272)lass.