[INF43] Lecture 9 How do we structure the software in detail part2

软件工程 SoftwareEngineering

   
   

@ZYX 写于2020年05月01日

Desgin Notation

So it helps us by helping reduce our information overload. And when you have an idea in your mind.

Software Development Languages

  1. Different lanugages are used at diffrernt stages
    Requirements——>Design——> Coding/Testing
    English ——->Diagrams/UML ——->Java/Python

UML (United Modeling Language)

  1. see ppt

  2. see ppt

    UML Class Diagrams

  3. Different types of UML diagrams are used to represent different aspects (structure, behavior, interactions) of a system

    • Class diagrams
    • Activity diagrams
    • Sequence diagrams
    • Use case diagrams
  4. It shows the classes what they’re what the attributes or data and what the operations or behavior of each class are and also shows how they are related.

  5. Typically the, a lot of the classes model domain concepts, meaning that they translate to things in the real world and a URL class diagram is the most common way to represent an object oriented design.

  6. Class Name
    Attribute
    Attribute
    Operation(patameter)
    Operation
    Operation
  7. So the main purpose of the UML class diagram is to allow easy translation to code so that you can plan out your code using the diagram

Relationship between classes

  1. Inheritance

  2. Association:

    1. Mulitiplicity
  3. Aggregation

    1. symbol is diamond
    2. relationships are transitive and assymetric
  4. Composition (like Aggregation)

    1. If the whole or the container is destroyed, then the parts they cannot exist on their own. (房子类和房间类的关系)

How to create classes

  • The set of nouns in the description of the problem (e.g., user, list, item, …) -> classes, attributes
  • The set of verbs in the description of the problem (e.g., login, logout, sort, mark complete…) -> operations, associations
  • Go through some more detailed use cases to further flesh out the flow and objects necessary
  • UI mockups
  • A little bit of programming?
  • Refer to, add to, and revise design as necessary

UML Sequence Diagram

UML Use Case Diagram

We need all these different representations to be able to try to comprehend it and understand it and visualize it and communicate about it effectively.

Design Principles

  1. High cohesion/low coupling
    1. make things easy to change
      • High Cohesion: Grouping related functionality
      • Low Coupling: Ungrouping unrelated functionality / reducing interdependency
      • Effects:
      • Changes don’t propagate
      • Reuse is facilitated