FIT3077 Lecture Notes - Lecture 4: Abstract Factory Pattern

45 views3 pages
Design Patterns
What is a Pattern?
Each paern describes a problem which occurs frequently in the environment
Eect paerns provide soluon that are used again and again
A design paern is:
Smart : elegant soluon not obvious to a novice
Generic : not dependent upon a system, programming language or applicaon domain
Well-Proven : been defined from real OO systems
Simple : quite small, involving only a handful of classes
Reuseable : easy to reuse
Object-Oriented : built with OO mechanisms such as classes , objects, generalisaon and
polymorphism
A design paern has:
Pattern Name : a handle we can use to describe a design problem, its soluon and
consequences
The problem: describes when to apply the paern
The solution: describes the elements which make up the soluon and their relaonships
The consequences: the results and tradeoffs of using the design paern
Categorising Design Patterns
Purpose
Creational : concern the process of object creaon
Structural : deal with the composion of classes and objects
Behavioural : characterise the way in which classes or objects interact and distribute
responsibility
Scope
Class :
Concerned with classes
Relaonships between classes and their subclasses
Object
Concerned with object relaonships
More dynamic and can change at run-me
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Ea(cid:272)h pa(cid:425)e(cid:396)(cid:374) des(cid:272)(cid:396)i(cid:271)es a p(cid:396)o(cid:271)le(cid:373) (cid:449)hi(cid:272)h o(cid:272)(cid:272)u(cid:396)s f(cid:396)e(cid:395)ue(cid:374)tly i(cid:374) the e(cid:374)(cid:448)i(cid:396)o(cid:374)(cid:373)e(cid:374)t. E e(cid:272)t pa(cid:425)e(cid:396)(cid:374)s p(cid:396)o(cid:448)ide solu(cid:415)o(cid:374) that a(cid:396)e used agai(cid:374) a(cid:374)d agai(cid:374) Smart : elega(cid:374)t solu(cid:415)o(cid:374) (cid:374)ot o(cid:271)(cid:448)ious to a (cid:374)o(cid:448)i(cid:272)e. Generic : (cid:374)ot depe(cid:374)de(cid:374)t upo(cid:374) a syste(cid:373), p(cid:396)og(cid:396)a(cid:373)(cid:373)i(cid:374)g la(cid:374)guage o(cid:396) appli(cid:272)a(cid:415)o(cid:374) do(cid:373)ai(cid:374) Well-proven : (cid:271)ee(cid:374) de (cid:374)ed f(cid:396)o(cid:373) (cid:396)eal oo syste(cid:373)s. Simple : (cid:395)uite s(cid:373)all, i(cid:374)(cid:448)ol(cid:448)i(cid:374)g o(cid:374)ly a ha(cid:374)dful of (cid:272)lasses. Object-oriented : (cid:271)uilt (cid:449)ith oo (cid:373)e(cid:272)ha(cid:374)is(cid:373)s su(cid:272)h as (cid:272)lasses , o(cid:271)je(cid:272)ts, ge(cid:374)e(cid:396)alisa(cid:415)o(cid:374) a(cid:374)d poly(cid:373)o(cid:396)phis(cid:373) Pattern name : a ha(cid:374)dle (cid:449)e (cid:272)a(cid:374) use to des(cid:272)(cid:396)i(cid:271)e a desig(cid:374) p(cid:396)o(cid:271)le(cid:373), its solu(cid:415)o(cid:374) a(cid:374)d (cid:272)o(cid:374)se(cid:395)ue(cid:374)(cid:272)es. The problem: des(cid:272)(cid:396)i(cid:271)es (cid:449)he(cid:374) to apply the pa(cid:425)e(cid:396)(cid:374) The solution: des(cid:272)(cid:396)i(cid:271)es the ele(cid:373)e(cid:374)ts (cid:449)hi(cid:272)h (cid:373)ake up the solu(cid:415)o(cid:374) a(cid:374)d thei(cid:396) (cid:396)ela(cid:415)o(cid:374)ships. The consequences: the (cid:396)esults a(cid:374)d t(cid:396)adeo s of usi(cid:374)g the desig(cid:374) pa(cid:425)e(cid:396)(cid:374) Creational : (cid:272)o(cid:374)(cid:272)e(cid:396)(cid:374) the p(cid:396)o(cid:272)ess of o(cid:271)je(cid:272)t (cid:272)(cid:396)ea(cid:415)o(cid:374) Structural : deal (cid:449)ith the (cid:272)o(cid:373)posi(cid:415)o(cid:374) of (cid:272)lasses a(cid:374)d o(cid:271)je(cid:272)ts. Behavioural : (cid:272)ha(cid:396)a(cid:272)te(cid:396)ise the (cid:449)ay i(cid:374) (cid:449)hi(cid:272)h (cid:272)lasses o(cid:396) o(cid:271)je(cid:272)ts i(cid:374)te(cid:396)a(cid:272)t a(cid:374)d dist(cid:396)i(cid:271)ute (cid:396)espo(cid:374)si(cid:271)ility.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers