Material and some slide content from:
- Atif Kahn
- Composition vs. Inheritance,
Composition vs. Inheritance, Cloud Computing, and REST-based - - PowerPoint PPT Presentation
Material and some slide content from: - Atif Kahn SERVICES COMPONENTS OBJECTS MODULES Composition vs. Inheritance, Cloud Computing, and REST-based Architectures Reid Holmes Store Example Starbucks example Beverages: house, dark
Material and some slide content from:
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
structures.”
responsibilities to individual objects, not the whole
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
// the Window interface interface Window { public void draw(); // draws the Window public String getDescription(); }
class SimpleWindow implements Window { public void draw() { // draw window }
return "simple window"; } } // abstract decorator class abstract class WindowDecorator implements Window { protected Window decoratedWindow;
this.decoratedWindow = decoratedWindow; } public void draw() { decoratedWindow.draw(); } }
class VerticalScrollBarDecorator extends WindowDecorator { public VerticalScrollBarDecorator (Window decoratedWindow) { super(decoratedWindow); } public void draw() { drawVerticalScrollBar(); super.draw(); } private void drawVerticalScrollBar() { .. } public String getDescription() { return decoratedWindow.getDescription() +" and vert sb"; } } // adds horizontal scrollbar functionality class HorizontalScrollBarDecorator extends WindowDecorator { public HorizontalScrollBarDecorator (Window decoratedWindow) { super(decoratedWindow); } public void draw() { drawHorizontalScrollBar(); super.draw(); } private void drawHorizontalScrollBar() { .. } public String getDescription() { return decoratedWindow.getDescription() + "and horiz sb"; } } public class DecoratedWindowTest { public static void main(String[] args) { Window decoratedWindow = new HorizontalScrollBarDecorator ( new VerticalScrollBarDecorator(new SimpleWindow())); // print the Window's description System.out.println(decoratedWindow.getDescription());}}
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
they are connected. hard to understand and debug.)
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
decoration is required.
heavyweight can overwhelm decorators
(if component is heavy, consider strategy instead)
Strategy pattern can change the guts.
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
in client code
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
multiple administrative domains applied to common tasks.
can work on specific parallel computation tasks.
metered like utilities.
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction. This cloud model promotes availability and is composed of five essential characteristics, three service models, and four deployment models.” [NIST]
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
without human interaction.
through standard mechanisms.
multiple consumers.
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
!"#$%&' (#%&)*" ("&+"& ,- .// 0)#) !"#$%&' (#%&)*" ("&+"& ,- .// 0)#) !"#$%&' (#%&)*" ("&+"& ,- .// 0)#) !"#$%&' (#%&)*" ("&+"& ("&+12"3 .// 0)#) !"#$%&' (#%&)*" ("&+"& ("&+12"3 .// 0)#) 4&*)516)#1%5 2%5#&%77"8 4&*)516)#1%59:93"&+12"9 ;&%+18"&93<)&"92%5#&%7 ("&+12"9/&%+18"& 2%5#&%77"8 =5><%?3"
0";7%@A"5#
B%3#"8
0";7%@A"5#
=))(
C7%?8
/))(
C7%?8
())(
C7%?8
DEF9!"#$%&"'"()*+,-*./$(0%1"-#*/2*3/(+1/&*"(*+,-*3&/$04*5-6*78894* <##;GHH'32%##A%&&13%5I2%AHJKKLHEJHKEH+13?)71615*>#<">M%?58)&1"3>%N>2%5#&%7>15>#<">27%?8H
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE
REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE