展开查看详情
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