面向对象分析与设计

本文详细介绍了面向对象的分析与设计,全面探讨了面向对象概念、软件开发过程、面向对象设计。学习本文的首要目标是成为一个更好的程序员。学习内容包括应用分析结果实现类和接口、遗传与多态性、按合同编程、接口编码、开闭原理、Liskov替代原理。通过探讨C++对象模型学习面向对象的分析与设计。
展开查看详情

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

2.Basic Info Office hours TuTh 3:00 – 4:00 PM ENG 250 Website Faculty webpage: http://www.cs.sjsu.edu/~mak/ Class webpage: http://www.cs.sjsu.edu/~mak/CMPE135/index.html Syllabus Assignments Lecture notes 2

3.Permission Numbers Go to the Computer Engineering Department website: https://cmpe.sjsu.edu Click the link in the sidebar: Spring 2018 Registration Notes Click the link under “Spring 2018 Online permission number request” Fill out the Google form. 3 Yes, this will take you to the Fall 2018 Permission Number Request form

4.4 Goals of the Course Become familiar with object-oriented analysis and program design . Employ industry-standard practices of an object-oriented approach to software development. Avoid the pitfalls of object-oriented design. Learn important job skills that employers want. Work as a member of a small programming team to successfully develop a software application that uses shared interfaces and data formats .

5.The Primary Goal 5 Become a much better programmer!

6.Course Learning Outcomes Requirements gathering Distinguish between functional and nonfunctional requirements. Express the requirements in the form of use cases. Object-oriented analysis Derive the appropriate classes from the requirements and define their responsibilities, behaviors, interrelationships, and internal structures. Draw UML use case, class, and sequence diagrams to document and communicate the analysis results. 6

7.Course Learning Outcomes , cont’d Object-oriented design Apply the results of analysis to implement the classes and interfaces. Incorporate concepts such as inheritance and polymorphism programming by contract coding to the interface the open-closed principle the Liskov substitution principle and the Law of Demeter Write code that is easily tested. 7

8.Course Learning Outcomes , cont’d Design patterns Know the major “Gang of Four” design patterns. Recognize when it is appropriate to apply them. The C++ object model Understand how C++ implements the object model, including the Standard Template Library (STL). Become aware of the hazards of C++. 8

9.Course Learning Outcomes , cont’d GUI programming Develop interactive programs that have a graphical user interface (GUI). Use callback routines with a software framework and comprehend inversion of control. Multi-threaded programming Learn the basics of programming multiple threads of control using semaphores, mutexes, and critical regions. 9

10.10 Course Overview Analysis Gather requirements Create use cases Identify objects, behaviors, and dependencies Functional Specification Design Encapsulation Loose coupling and high cohesion UML diagrams Design Specification

11.11 Course Overview , cont’d Object-oriented design techniques Interfaces Inheritance Polymorphism Midterm

12.Course Overview , cont’d The C++ object model Pointers and references Constructors Public, protected, and private members Concrete, abstract, overridden, and overloaded member functions Friend functions Exception handling 12

13.Course Overview , cont’d Testing Unit testing Test-driven design (TDD) 13

14.Course Overview , cont’d Design patterns Frameworks C++ templates The Standard Template Library (STL) GUI programming Inversion of control Dependency injection Multi-threaded programming 14

15.Required Textbooks None! Current textbooks on object-oriented analysis and design use Java programming examples. This class will use C++. You will receive reference material throughout the semester, or access it on the Internet. 15

16.16 Project Teams Projects will be done by small project teams. Projects will be broken up into assignments. Form your own teams of 4 members each. Choose your team members wisely! Be sure you’ll be able to meet and communicate with each other and work together well. No moving from team to team. Each team member will receive the same score on each team assignment and team project.

17.Project Teams , cont’d Each team email to ron.mak@sjsu.edu by Sunday, August 26 : Your team name A list of team members and email addresses Subject: CMPE 135 Team Team Name Example: CMPE 135 Team Hyper Hackers 17

18.Team Project A semester-long design project to develop an interactive application chosen by the team. Team assignments during the semester will enable you to incrementally improve the app’s design. Demonstrate the app to the class at the end of the semester. Each team will write a short report (10-15 pp.) Describe the design patterns and other OOAD techniques that the app used. Include a high-level architecture description with UML diagrams. 18

19.19 Individual Responsibilities You are personally responsible for participating and contributing to your team ’ s work, and for understanding each part of the work for every assignment whether or not you worked on that part.

20.20 Postmortem Assessment Report At the end of the semester, each student will individually turn in a short (one page) report: A brief description of what you learned in the course. An assessment of your personal accomplishments for your project team. An assessment of the contributions of each of your project team members . This report will be seen only by the instructor.

21.21 Your Individual Overall Class Grade 35% assignments* 30% project* 15% midterm** 20% final** * team score ** individual score During the semester, keep track of your progress in Canvas. At the end of the semester, students with the median score will get the B- grade. Higher and lower grades will then be assigned based on how the scores cluster above and below the median. Therefore, your final class grade will be based primarily on your performance relative to the other students in the class. Your final class grade will be adjusted up or down depending on your level and quality of participation , as reported by your teammates ’ postmortem reports.

22.22 Participation is Important Can move your final grade up or down, especially in borderline cases. Participation in class. Participation in your team. As reported by the postmortem assessment reports.

23.23 Take roll!

24.24 What Makes a Software Application Good? It does what it’s supposed to do. It’s well-designed. reliable robust flexible object-oriented architecture? uses design patterns? It’s easy to modify and maintain.

25.Change and Complexity Software is becoming increasingly complex. Requirements are always changing. During requirements gathering. During design. During implementation. After the product is already out in the field. A key measure of good design is how well you manage change and complexity. 25

26.26 How Do You Achieve “Good Design”? Sorry, there is no magic formula . Learning lots of object-oriented tools and techniques alone won’t give you good design. Just using design patterns won’t give you good design. For a nontrivial application, good design won’t simply “happen”.

27.27 How Do You Achieve “Good Design”? cont’d Good design is reached after a journey. Every programmer must take this trip for every application. The journey can be longer for less-experienced programmers. false starts meandering wrong paths backtracking

28.28 It’s an Iterative Process Achieving good design is an iterative process . As you’re developing the application, you will revisit your design several times. Even the very best programmers cannot achieve a perfect good design the first time every time. The journey to good design requires that you make corrections, refinements, and other improvements along the way.

29.29 It’s an Iterative Process , cont’d The journeys will become shorter as you become more experienced. Practice, practice, practice . Learn object-oriented tools and techniques. Learn when to use design patterns. More practice, practice, practice.