$30 off During Our Annual Pro Sale. View Details »

CSE564 Lecture 20

CSE564 Lecture 20

Software Design
Connecting the Dots II
(202111)

Javier Gonzalez-Sanchez
PRO

September 20, 2020
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs
    CSE 564
    Software Design
    Lecture 20: Connecting the Dots II
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    javiergs.engineering.asu.edu | javiergs.com
    PERALTA 230U
    Office Hours: By appointment

    View Slide

  2. jgs
    564 00010100
    Announcement
    § Quiz 5 is open and due November 16 (before our lecture time)
    30 minutes
    Individual.
    § Assignment 4 is open and due November 18 (before our lecture time)
    Programming assignment
    It is a team project. I create the teams. No, you cannot change your team
    Report to us if someone is not working or able to be contacted

    View Slide

  3. jgs
    Assignment 4

    View Slide

  4. jgs
    564 00010100
    You have this

    View Slide

  5. jgs
    564 00010100
    Step 1. Menu
    File Connections Action
    New
    Load
    Save
    TSP – nearest neighbor
    Clusters
    User connect
    TSP - pro
    Move ⬁
    Connect ↘
    * Double click a city to edit
    Create ✩

    View Slide

  6. jgs
    564 00010100
    Step 2. Actions
    D
    B
    A
    C
    Move ⬁
    Connect ↘
    Create ✩
    File Connections Action
    Factory Factory
    Iterator Iterator

    View Slide

  7. jgs
    564 00010100
    Step 3. Connections
    D
    B
    A
    C
    File Connections Action
    TSP – nearest neighbor
    Clusters
    User connect
    TSP - pro

    View Slide

  8. jgs
    564 00010100
    Step 3. Connections
    § TSP – pro
    The most direct solution would be to try all permutations (ordered
    combinations) and see which one is cheapest (using brute-force search).
    The running time for this approach lies within a polynomial factor of O (n!),
    the factorial of the number of cities, so this solution becomes impractical
    even for only 20 cities.
    https://en.wikipedia.org/wiki/Travelling_salesman_problem
    § Keep the GUI drawing lines.
    § Use multithreading

    View Slide

  9. jgs
    564 00010100
    Step 3. Connections
    D
    B
    A
    C
    File Connections Action
    TSP – nearest neighbor
    Clusters
    User connect
    TSP - pro
    Handler
    Iterator

    View Slide

  10. jgs
    564 00010100
    Step 4. File
    D
    B
    A
    C
    File Connections Action

    View Slide

  11. jgs
    564 00010100
    Step 5. Customize Cities
    File Connections Action
    D
    B
    A
    C
    • Shape
    • Color
    • Size
    * Double click a city to edit
    We are going to have
    problems detecting
    “selection” (contains)

    View Slide

  12. jgs
    564 00010100
    Status Bar | Keep the User on the Loop
    messages, what is happening?
    Logger

    View Slide

  13. jgs
    564 00010100
    Manufacturing vs Crafting
    1 2 3
    5
    4

    View Slide

  14. jgs
    564 00010100
    Key Ideas
    Manufacturing VS. Craftmanship
    Take advantage of
    § SOLID principles
    § Design Patterns
    § Low Coupling
    § High Cohesion
    Grades are individual, then
    a) How to stablish a limit to my responsibilities and the others?
    b) How to facilitate integration?
    c) Component Oriented Approach

    View Slide

  15. jgs
    Previously …

    View Slide

  16. jgs
    564 00010100
    Warning!
    hypothetical scenario ahead, just for fun

    View Slide

  17. jgs
    564 00010100
    Idea 2
    Main
    Factory
    Gift Ball Box Envelop
    Handler
    Supervisor
    Bin
    GUI

    View Slide

  18. jgs
    Draft 1

    View Slide

  19. jgs
    564 00010100
    Idea (and this is NOT a class diagram)
    wrapper2
    Main wrapper1
    Factory
    decoration
    Envelope
    Box
    Gift
    wrapper3
    ball Supervisor
    Is big > 10, box
    Is small < 5, envelop
    Is not big and It is not small,
    no decoration

    View Slide

  20. jgs
    564 00010100
    Main

    View Slide

  21. jgs
    564 00010100
    Factory

    View Slide

  22. jgs
    564 00010100
    Chain of Responsibilities

    View Slide

  23. jgs
    564 00010100
    Decorator

    View Slide

  24. jgs
    564 00010100
    Decorator

    View Slide

  25. jgs
    564 00010100
    Observer

    View Slide

  26. jgs
    Draft 2

    View Slide

  27. jgs
    564 00010100
    Idea 1
    Main
    Factory
    Gift Ball Box Envelop
    Handler
    Supervisor
    Bin

    View Slide

  28. jgs
    564 00010100
    Idea 1
    In main:
    In ConcreteHandlerWithBox:
    In ConcreteHandlerWithEnvelop:

    View Slide

  29. jgs
    Draft 3

    View Slide

  30. jgs
    564 00010100
    Idea 2
    Main
    Factory
    Gift Ball Box Envelop
    Handler
    Supervisor
    Bin
    GUI

    View Slide

  31. jgs
    564 00010100
    Idea 2

    View Slide

  32. jgs
    564 00010100
    Idea 2 :: the GUI elements

    View Slide

  33. jgs
    564 00010100
    Idea 2 :: Listener

    View Slide

  34. jgs
    564 00010100
    Questions

    View Slide

  35. jgs
    CSE 564 Software Design
    Javier Gonzalez-Sanchez, Ph.D.
    [email protected]
    Fall 2021
    Copyright. These slides can only be used as study material for the class CSE564 at ASU.
    They cannot be distributed or used for another purpose.

    View Slide