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

CSC309 Lecture 04

CSC309 Lecture 04

Software Engineering II
Structural Quality Principles
(202301)

Javier Gonzalez-Sanchez
PRO

January 18, 2023
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs
    CSC 309
    Software Engineering II
    Lecture 04:
    Structural Quality Principles
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    www.javiergs.com
    Building 14 -227
    Office Hours: By appointment

    View Slide

  2. jgs
    Previously …

    View Slide

  3. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 3
    Structural Metrics
    Abstract
    concrete
    Stable
    Hard to Change
    Only incoming dependencies
    Unstable
    Changeable
    Only outgoing dependencies

    View Slide

  4. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 4
    § Distance: how far a package is away from
    the Main Sequence
    § D = A + I – 1
    § Values -1 to 1
    § Absolute Distance |D|
    Distance

    View Slide

  5. jgs
    Test Yourselves

    View Slide

  6. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 6
    public class Foo {
    Bar b= new Bar(new Car());
    public Foo (Car c) {
    c.doIt(b);
    }
    public void m (Delta d) {
    d.action(b);
    }
    }
    public class System {
    public ... main ( ...) {
    Foo f = new Foo();
    //...
    }
    }
    Question

    View Slide

  7. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 7
    public class Foo {
    Bar b= new Bar(new Car());
    public Foo (Car c) {
    c.doIt(b);
    }
    public void m (Delta d) {
    d.action(b);
    }
    }
    public class System {
    public ... main ( ...) {
    Foo f = new Foo();
    //...
    }
    }
    Question
    Any candidate for the “painful” zone:

    View Slide

  8. jgs
    Principles

    View Slide

  9. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 9
    Stable Abstraction Principle
    The more stable an artifact is,
    the more abstract it should be.

    View Slide

  10. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 10
    Do you remember repository?
    Repository A = 0
    I = 1/N = ~0

    View Slide

  11. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 11
    Stable Dependencies Principle
    Every dependency between modules should
    terminate on a module whose Instability
    is less than or equal to the depending
    module's Instability.
    Every dependency between modules should
    terminate on a module whose Abstractness
    is greater than or equal to the depending
    module's Abstractness.

    View Slide

  12. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 12
    Do you remember repository?
    Repository DrawPanel
    Main

    View Slide

  13. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 13
    Let’s Work

    View Slide

  14. jgs
    What Next?

    View Slide

  15. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 15
    Thoughts?
    It seems that the Class Diagram
    is Important

    View Slide

  16. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 16
    Team 1

    View Slide

  17. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 17
    Team 1

    View Slide

  18. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 18
    Team 2

    View Slide

  19. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 19
    Team 3

    View Slide

  20. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 20
    Team 4

    View Slide

  21. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 21
    Team 5

    View Slide

  22. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 22
    Team 6

    View Slide

  23. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 23
    Questions

    View Slide

  24. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 24
    Office Hours
    Tuesday and Thursday 3 - 5 pm
    But an appointment required
    Sent me an email – [email protected]

    View Slide

  25. jgs

    View Slide

  26. jgs
    CSC 309
    Software Engineering II
    Lab 4:
    Design Principles SAP + SDP
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    www.javiergs.com
    Building 14 -227
    Office Hours: By appointment

    View Slide

  27. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 27
    Let’s Work
    Let’s start by
    Fixing your class Diagrams
    (If needed)
    • How many classes should exist?
    • Are there connections missing?
    • Are there classes disconnected?
    • Remember the level of abstraction.
    • (not everything needs to be shown,
    • But what is shown is important)

    View Slide

  28. jgs
    CSC 309 Software Engineering II
    Javier Gonzalez-Sanchez, Ph.D.
    [email protected]
    Winter 2023
    Copyright. These slides can only be used as study material for the class CSC308 at Cal Poly.
    They cannot be distributed or used for another purpose.

    View Slide