Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

jgs Assignment 4

Slide 4

Slide 4 text

jgs 564 00010100 You have this

Slide 5

Slide 5 text

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 ✩

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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)

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

jgs 564 00010100 Manufacturing vs Crafting 1 2 3 5 4

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

jgs Previously …

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

jgs Draft 1

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

jgs 564 00010100 Main

Slide 21

Slide 21 text

jgs 564 00010100 Factory

Slide 22

Slide 22 text

jgs 564 00010100 Chain of Responsibilities

Slide 23

Slide 23 text

jgs 564 00010100 Decorator

Slide 24

Slide 24 text

jgs 564 00010100 Decorator

Slide 25

Slide 25 text

jgs 564 00010100 Observer

Slide 26

Slide 26 text

jgs Draft 2

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

jgs Draft 3

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

jgs 564 00010100 Idea 2

Slide 32

Slide 32 text

jgs 564 00010100 Idea 2 :: the GUI elements

Slide 33

Slide 33 text

jgs 564 00010100 Idea 2 :: Listener

Slide 34

Slide 34 text

jgs 564 00010100 Questions

Slide 35

Slide 35 text

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.