COMP 3004 Lecture Notes - Lecture 15: Adapter Pattern, Template Method Pattern, Duplicate Code

30 views6 pages

Document Summary

Comp (cid:1007)(cid:1004)(cid:1004)(cid:1008) lecture (cid:1005)(cid:1009: adapter pattern. Intent: convert the interface of a class into another interface clients expect. Adapter lets (cid:272)lasses (cid:449)ork together that other(cid:449)ise (cid:272)ould(cid:374)"t (cid:271)e(cid:272)ause of i(cid:374)(cid:272)o(cid:373)pati(cid:271)le i(cid:374)terfa(cid:272)es: motivation: components often have incompatible interfaces that cannot be used by a client but also cannot be modified. Forwards calls between client and adapter: fa ade pattern. Intent: provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use: motivation: structuring a system into subsystems helps reduce complexity. A common design goal is to minimize the communication and dependencies between subsystems. Use a facade object to provide a single, simplified interface to the more general facilities of a subsystem: example: programming environment that provides access to its compiler. Most (cid:272)lie(cid:374)ts do(cid:374)"t (cid:272)are a(cid:271)out details like parsi(cid:374)g a(cid:374)d (cid:272)ode generationjust compile my code!

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

Related Documents