UML_Lec02_b2_面向对象基础.pptVIP

  • 4
  • 0
  • 约2.04万字
  • 约 35页
  • 2016-11-24 发布于浙江
  • 举报
* UML Lecture_01, Author: NK Jiang */34 A Java Example of the Interface/Implementation Paradigm Calculate a Square public class IntSquare { // private attribute private int squareValue; // public interface public int getSquare (int value) { SquareValue =calSquare(value); return squareValue; } // private implementation private int calSquare (int value) { return value*value; } } * UML Lecture_01, Author: NK Jiang */34 OO: Thinking more abstractly Giving the user the minimal interface possible For example, Appliance – power supplier – socket(插座) automobile - main concern when driving a car is that the car starts, accelerates, stops, steers etc. If, however, a manufacturer decided to install a joystick in place of the steering wheel … For using car, the engine is part of the implementation, and the steering wheel is part of the interface * UML Lecture_01, Author: NK Jiang */34 Using Abstract Thinking when Designing Interfaces Difference between an abstract and a concrete interface For a taxi object Take me to the airport, or Turn right, then right, then left, then left, then left? Which is more reusable? Take me to the airport, : abstract interface is a good, reusable OO design * UML Lecture_01, Author: NK Jiang */34 Designing with Objects Generally, a solid OO design process will include the following steps Doing the proper analysis Developing a statement of work that describes the system Gathering the requirements from this statement of work Developing a prototype for the user interface Identifying the classes Determining the responsibilities of each class Determining how the various classes interact with each other Creating a high-level model that describes the system to be built * UML Lecture_01, Author: NK Jiang */34 Ref book: Object-Oriented Thought Process, The, Second Edition, By Matt?Weisfeld End * An object is a computer representation of an entity, either real-world or invented. An object can

文档评论(0)

1亿VIP精品文档

相关文档