Midterm review

本文主要学习了 Midterm review的基本概念及应用。通过Midterm review我们查看了代码,功能不灵活,难以维护。所以我们需要逐步的改进代码,在这个过程中,我们采用了良好的面向对象设计原则。了解你的客户想要什么,这就显示出了 Midterm review的重要性。
展开查看详情

1.CMPE 135: Object-Oriented Analysis and Design October 9 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor: Ron Mak www.cs.sjsu.edu/~mak 1

2.Midterm Review We looked at code that was functional but was inflexible and hard to maintain. Code that was not able to handle change . We incrementally improved the code. Encapsulated what varied Delegated tasks Wrote code that could scale In the process, we applied good object-oriented design principles . 2

3.Midterm Review , cont’d Understand what your customer wants. Functional and nonfunctional requirements UML diagrams : Use case, sequence, class Functional Specification 3

4.Midterm Review , cont’d Analysis Dealing with complexity . Where do classes come from? Textual analysis CRC cards (Class Responsibility Collaboration) Class relationships : dependency, inheritance, aggregation, composition Design Specification Design and implementation of proposed Date and Day classes 4

5.Midterm Review , cont’d Object-oriented design basics Abstraction Encapsulation Inheritance Polymorphism Object-oriented design principles Encapsulate what varies. Favor composition over inheritance. Program to interfaces , not implementations. 5

6.Midterm Review , cont’d Factory classes Accessors and mutators Dangerous setters Immutable classes References to immutable objects 6

7.Midterm Review , cont’d Interfaces Law of Demeter (“Principle of Least Knowledge”) Liskov Substitution Principle Cohesion Completeness Convenience Clarity Consistency 7

8.Midterm Review , cont’d Programming by contract Precondition Postcondition Invariant Favor composition over inheritance Delegation “Has a” vs. “is a” SimUDuck example 8

9.Midterm Review , cont’d Polymorphism Abstract classes Pure virtual member functions Virtual destructors Model-View-Controller architecture Software frameworks Inversion of control Events and event handlers Callback functions 9

10.Midterm Review , cont’d wxWidgets multi-platform software framework GUI-based applications Mac, Linux, Windows Rock-Paper-Scissors game Simple machine learning GUI version 10

11.Video A typical requirements gathering meeting with customers. 11