CSE564 Lecture 03

CSE564 Lecture 03

Software Design
Modularization
(202008)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez

August 03, 2020
Tweet

Transcript

  1. jgs CSE 564 Software Design Lecture 03: Modularization Dr. Javier

    Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. jgs Previously

  3. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 3 jgs

    Timeline 1971 Wirth 1972 Parnas 1975 DeRemer 1989 Beck
  4. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 4 jgs

    Stepwise Refinement Complete Task Subtask 1 Subtask 1.a Subtask 1.b Subtask 2 Subtask 2.a Subtask 2.b Subtask 2.c
  5. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 5 jgs

    Concepts • Module is a responsibility assignment rather than a subprogram. • Module specification = its inputs, its outputs its interfaces • Small enough and simple enough to be thoroughly understood • Independent development of modules • Comprehensibility: they makes easy to understand parts, connections, and the whole. • Unit Testing: Module or Function?
  6. jgs Modularization

  7. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 7 jgs

    Decomposing Systems into Modules (1972) On the Criteria To Be Used in Decomposing Systems into Modules D.L. Parnas Communications of the ACM April 1972 Pioneer of software engineering ACM Fellow Developed the concept of information hiding
  8. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 8 jgs

    Decomposing Systems into Modules (1972) • modularization = design decisions / independent modules • modularization improves flexibility and comprehensibility • What is a module? • What criteria to use in dividing the system into modules?
  9. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 9 jgs

    • What criteria to use? • Niklaus Wirth. • Information Hiding - Input Format, Data Storage, etc. • A data structure, its internal linking, accessing procedures and modifying procedures are part of a single module • The sequence of instructions necessary to call a given routine and the routine itself are part of the same module. • What is the difference of Function vs Module? • What is the difference of Task vs Responsibility?
  10. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 10 jgs

    Wirth + Parnas • Niklaus Wirth. • Decomposition of a system into modules based on a flowchart. • Each major step in the process a module. • Begins with a list of difficult design decisions or design decisions which are likely to change. Each module is then designed to hide such a decision from the others. • In some cases modules will not correspond to steps in the processing.
  11. jgs And …

  12. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 12 jgs

    Test Yourselves: Problem Traveling salesman problem (TSP) Given a set of n nodes and distances for each pair of nodes, find a roundtrip of minimal total length visiting each node exactly once.
  13. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 13 jgs

    Test Yourselves: Problem Traveling salesman problem (TSP) Given a set of n nodes and distances for each pair of nodes, find a roundtrip of minimal total length visiting each node exactly once.
  14. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 14 jgs

    Test Yourselves: Data § Symmetric The distance from node i to node j is the same as from node j to node i. http://www.math.uwaterloo.ca/tsp/world/countries.html 29 cities - 71,009 cities
  15. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 15 jgs

    Test Yourselves: Data Symmetric
  16. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 16 jgs

    Test Yourselves: Data § Symmetric The distance from node i to node j is the same as from node j to node i. http://www.math.uwaterloo.ca/tsp/world/countries.html 29 - 71009 § Asymmetric The distance from node i to node j and the distance from node j to node i may be different. http://elib.zib.de/pub/mp-testdata/tsp/tsplib/atsp/index.html 17 to 443
  17. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 17 jgs

    Test Yourselves: Data Asymmetric
  18. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 18 jgs

    Test Yourselves: Solution It is an NP-hard problem. Do not worry for an optimal solution a) Calculate and report the total distance for a dummy route as city1, city2, city3, city4, … b) Calculate and report the total distance using a greedy algorithm (nearest-neighbors) or any other fancy solution (2-opt, genetic algorithm, etc.) city1, city2, city3, city4, …
  19. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 19 jgs

    Test Yourselves: Software § Information Hiding... How? § Stepwise refinement… How? § How many modules / functions? Why ? § How they will be connected (who call who? Who needs who?) Why ? § Which is the largest file (symmetric and asymmetric) that your solution can process? Can you improve that? How? § Your program should stop (by itself) in 300 seconds. § Sequential solution is acceptable, but challenge yourselves to use at least threads (CPU) or go for GPU programming
  20. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 20 jgs

    Homework Submit to Canvas (individually): a) Source Code – one file (kind of structural programming). C, C++, Java, are OK. b) A PDF file a paper describing § your code and how did you apply Wirth and Parnas ideas a.k.a. functional decomposition and information hiding. § Screenshot with the output for small, medium, and stop scenario § A conclusion addressing the quality of your solution PS. showcase your skills for readability (make your code easy to read)
  21. jgs CSE 564 Computer Systems Fundamentals Javier Gonzalez-Sanchez javiergs@asu.edu Fall

    2020 Disclaimer. These slides can only be used as study material for the class CSE564 at ASU. They cannot be distributed or used for another purpose.