Slide 1

Slide 1 text

Dr. Javier Gonzalez-Sanchez javiergs@calpoly.edu www.javiergs.info o ffi ce: 14 -227 CSC 305 Individual Software Design and Development Lecture 11. Decorator

Slide 2

Slide 2 text

Previously

Slide 3

Slide 3 text

Observer 3

Slide 4

Slide 4 text

Singleton 4

Slide 5

Slide 5 text

GoF Patterns 5

Slide 6

Slide 6 text

Decorator | Composite

Slide 7

Slide 7 text

Problem 7

Slide 8

Slide 8 text

Inheritance Approach 8

Slide 9

Slide 9 text

Inheritance Approach 9

Slide 10

Slide 10 text

Inheritance Approach 10

Slide 11

Slide 11 text

Composite 11

Slide 12

Slide 12 text

Decorator | Composite 12

Slide 13

Slide 13 text

Decorator vs Inheritance • Both a llow you to ch a nge how a n object beh a ves. • The decor a tor p a ttern a llows you to extend (decor a te) the function a lity of a n object a t runtime. • Inherit a nce a dds beh a vior a t compil a tion time. 13

Slide 14

Slide 14 text

Connecting the Dots

Slide 15

Slide 15 text

Application 15

Slide 16

Slide 16 text

Application | GUI 16 Main JFrame ChartPanel JPanel

Slide 17

Slide 17 text

Application | Data Gathering 17 Main JFrame ChartPanel Thread Genius JPanel

Slide 18

Slide 18 text

Application | Observer 18 Main JFrame ChartPanel Thread <> Board Genius JPanel PropertyChange Listener PropertyChange Support

Slide 19

Slide 19 text

MarkerDecoratorShadow MarkerDecoratorDot MarkerSimple Application | Decorator 19 MarkerDecoratorDot MarkerSimple MarkerSimple

Slide 20

Slide 20 text

To be Continued…

Slide 21

Slide 21 text

Questions 21

Slide 22

Slide 22 text

Lab

Slide 23

Slide 23 text

Homework Create a UML Class Diagram for this code: https://github.com/CSC3100/Patterns

Slide 24

Slide 24 text

CSC 305 Individual Software Design and Development Javier Gonzalez-Sanchez, Ph.D. javiergs@calpoly.edu Winter 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.