Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC307 Lecture 08

CSC307 Lecture 08

Introduction to Software Engineering
Design Patterns in Action
(202407)

Today, we focus on implementing design patterns, specifically the decorator, singleton, and observer patterns, within an application example. The application features a runnable class generating random data points and three panels observing the data. Additionally, a practical guide on creating UML class diagrams using Astah is provided, emphasizing the correct establishment of connections and relationships among classes.

Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 307 Introduction to Software Engineering Lecture 08. Patterns in Action
  2. Drag your Classes to the Diagram 15 Missing Connections Wrong

    relationships The "X" Missing Library Classes
  3. Right Click on an Interface (Circles) 18 Missing Connections Wrong

    relationships The "X" Missing Library Classes
  4. Right Click on the Line (near the X) 20 Missing

    Connections Wrong relationships The "X"
  5. 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. 34
  6. Application | Observer 39 Main JFrame ChartPanel Thread <<Singleton>> Board

    Genius JPanel PropertyChange Listener PropertyChange Support
  7. SVG 59 <svg xmlns="http://www.w3.org/2000/svg" width="800" height=“600"> <rect x="300" y="300" width="50"

    height="50" fill="#FF0000"/> <ellipse cx="60" cy="60" rx="25" ry="25" fill=“black"/> </svg> Always the first lines. Numbers are the size of your screen (picture) Always the last line rect The x of the top-left corner The y of the top-left corner The width of the rectangle. The height of the rectangle Color ellipse, The x-axis center of the ellipse The y-axis center of the ellipse The x radius of the ellipse The y radius of the ellipse Color
  8. Homework 61 Paint App 3.0 PS. Generating SVG could be

    great, but just creating text is OK such as: <this_is_an_arc x=10 y=10 w=90 h=90, a=0 b=180>
  9. GUI 62 <svg xmlns="http://www.w3.org/2000/ svg" width="400" height=“400"> <rect x=500 y=500

    width=50 height=50> <oval x=10 y=10 width=50 height=50> </svg></svg>
  10. CSC 307 Introduction to Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected]

    Summer 2024 Copyright. These slides can only be used as study material for the class CSC307 at Cal Poly. They cannot be distributed or used for another purpose.