Object-Oriented Fundamentals

  1. What’s object?
    • 真实世界中的对象
    • 对象有各种attributes属性 (名词)
    • 对象有各种behaviors方法 (动词)
  2. What’s class?
    • 将现实世界中的对象抽象
    • code-template for creating program objects
  3. Four foundation ideas
    • Abstraction抽象
    • Polymorphism多态
      • use the same interface for methods on different types of objects
      • overriding (重写)
      • method overloading (重载)
        • 实现方法,方法名相同,但是参数不同
    • Inheritance继承
      • python 可以继承多个父类
    • Encapsulation封装
  4. Three steps for OO
    • Analysis
      • Understand your problems
    • Design
      • Plan your solutions
    • Programming
      • Build it
  5. UML
    • Steps
    • Class Diagram

Requirements

  1. Functional requirements:
    • What must do?
  2. Non-Functional requirements:
    • What should be?
  3. FURPS
    • Functionality
    • Usability
    • Reliablility
    • Performance
    • Supportability

Use Cases and User Stories

  1. Use Cases
    • title
    • actor
      • how to identiy?
        • 交互对象
        • primary actor is user for the application initialtion
    • success scenario
      • how to identiy
        • 确认用户目标
        • focus on the typical situation that would occur
        • active voice, easy to read, short and concise
    • Diagram use case
      • make actor connect with scenario
  2. Use Stories

Domain Modeling

  1. Indentify objects
    • 通过分析 use cases 中的名词
  2. Indentiy class relationships
    • 将object 用动词关联
  3. Indentiy class responsibilities
    • 通过分析 use cases 中的动词
  4. CRC cards
    • class, responsibility and collaboration

Class Diagrams

  1. UML diagram for class
  2. Convert class diagram into code
  3. Instantiation
  4. Constructor
    • 初始化attribute
    • 通过overloading, 可以有多个构造函数
    • Destructoer
      • Finalizer
  5. Static attribues and methods
    • classname.静态属性/方法,非静态对象,使用实例名称,eg:Instantiation.name
    • static in UML
      • 使用下划线

Inheritance and Composition

1. 继承 (is a) -
- 在子类Overriding重写父类的方法 - 引用父类的方法 -
4. 抽象类 abstract class (UML中类名斜体) + exists for other classes to inherit + can’t be instantiated + contains at least one abstract method 5. 接口(interface) +
+
6. Aggregaton (has/uses many)
7. Composition (owns a)
8. UML

Software Development

  1. 面向对象语言对比
  2. Dev principle
    • Single responsibility principle
      • a class should have only a single reponsibility
    • DRY
      • don’t repeat yourself
    • YAGNI
      • you ain’t gonna need it
    • Code Smell
      • sniff test
  3. Software testing
  4. Design patterns
    • factory method pattern
    • memento pattern
    • 参考书
      • “Design Patterns” by Gang of Four book
      • “Head First Design Patterns”