软件需求分析课件:Chap 1-Introduction_第1页
软件需求分析课件:Chap 1-Introduction_第2页
软件需求分析课件:Chap 1-Introduction_第3页
软件需求分析课件:Chap 1-Introduction_第4页
软件需求分析课件:Chap 1-Introduction_第5页
已阅读5页,还剩160页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Chapter 1 Introduction 1.1 Introduction to Object Oriented 1.2 Introduction to UML 1.3 Software Process and OOA&D 1.4 Patterns and Architecture1.1 Introduction to Object-Oriented OO Programming (procedural V.S. OO) Basic concepts of OO OO ProgrammingDesigning ProgramsSoftware Development Solving Pro

2、blemProblem SpaceBusiness ProcessPlace OrderInventoryShippingComputer SystemDescriptions of problem (Human: Requirements)Natural LanguageDescriptions of solution (Human: Designing Program )Programming LanguageExecution of programSolution SpaceA Gap between languagesSoftware Development Solving Probl

3、emProblem SpaceComputer SystemDescriptions of problem (Human: Requirements)Natural LanguageDescriptions of solution (Human: Designing Programs)Programming LanguageExecution of programSolution SpaceA Gap between languagesMachine LanguageAssembly LanguageHigh-Level Language (Procedural) e.g. C, BASICH

4、igh-Level Language (Object-Oriented) e.g. C+ JavaPlace OrderInventoryShippingBusiness ProcessProcedural Programming This programming paradigm is essentially an abstraction of machine /assembly language. Program is organized around procedures. Focus on data structures, algorithms and sequencing of st

5、eps Programs = Algorithm + Data StructureAn algorithm is a set of instructions for solving a problemA data structure is a construct used to organize data in a specific way.Most computer languages, from early examples like FORTRAN and ALGOL to more recent languages like C and Ada, have been imperativ

6、e or procedural.Procedural Programming - ExampleWriting a program to handle bank accounts Customer can open different type of accounts, such as cash account, check account and Loan account. For each account, customer can deposit, withdraw or transfer.How to write this program with C ?Procedural Prog

7、ramming - ExampleA procedural programming language usually consists of : A collection of variables, each of which at any stage contains a certain value (a number, a character, a string of characters, etc) A collection of statements that change the values of these variables.The building-block of this

8、 type program is the procedure or function.Programs = Algorithm + Data StructureStruct account char name; int accountId; float balance; float interestYTD; char accountType;Data Structure: Bank AccountProcedure 1: Deposit() .Procedure 1: Withdraw() .Procedure 1: Transfer() .Procedural Programming - D

9、isadvantagesProcedures and data are clearly separated.Transformation of concepts between analysis & implementation.Procedures are often hard to reuse.Programs are often hard to extend and maintain.DataProcedureHudson riverNJNYa gapAnalysisDesignHudson riverNJNYa gapObject-Oriented Programming: OOPA

10、design and programming techniqueSome terminology:object - usually a person, place or thing (a noun)method - an action performed by an object (a verb)type or class - a category of similar objects (such as automobiles)Objects have both data and methodsObjects of the same class have the same data eleme

11、nts and methodsObjects send and receive messages to invoke actionsObject-Oriented Programming - ExampleWriting a program to handle bank accounts Customer can open different type of accounts, such as cash account, check account and Loan account. For each account, customer can deposit, withdraw or tra

12、nsfer.How to write this program with C+ or Java ?Object-Oriented Programming - ExampleObject-Oriented approach combine the accounts (data) with the operations on the accounts to objects. A new kind of data type: BankAccount classC+ code: Class BankAccount private: float balance; float interestYTD;ch

13、ar * owner; int account_number; public: void Deposit (float amount) . float WithDraw (float amount) bool Transfer (BankAccount & to, float amount) ;Object-Oriented Programming - ExampleThe building-block of this type program is class or objects.Example - The Shape ApplicationWe have an application t

14、hat must be able to draw circles and squares on a standard GUIThe circles and squares must be drawn in a particular order. A list of the circles and squares will be created in the appropriate order, and the program must walk the list in that order and draw each circle or square. Example - Procedural

15、 Programming in CData Structure-Shape.h -Enum Shape circle, square;struct Shape ShapeType itsType; -Circle.h -struct Circle Shape itsType; double itsRadius; Point itsCenter;-square.h -struct Square Shape itsType; double itsSide; Point itsTopLeft;Example - Procedural Programming in CFunction-drawAllS

16、hapes.c -typedef struct Shape *ShapePointer;Void DrawAllShapes (ShapePointer list, int n) int I; for (i=0; iitsType) case square: DrawSquare(struct Square*)s); break; case circle: DrawCircle(struct Circle*)s); break; Example - Procedural Programming in CProblemsRigid: because the addition of Triangl

17、e causes Shape,Square,Circle, and DrawAllShapes to be recompiled and redeployed.Fragile: because there will be many other switch/case or if/else statements that are both hard to find and hard to decipher.Immobile: because anyone attempting to reuse DrawAllShapes in another program is required to bri

18、ng along Square and Circle, even if that new program does not need them. Example Object-Oriented Programming in C+class Shape public: virtural void Draw() const= 0; class Square : public Shape public: virtual void Draw() const;class Circle : public Shape public: virtual void Draw() const;void DrawAl

19、lShapes(vector & list) vector : iterator I; for (i = list.begin(); i != list.end(); i+) (*i)-Draw(); It is changed by adding new code rather than by changing existing code.Not rigid Not FragileNot ImmobileWhat Is Object Technology?Object TechnologyA set of principles guiding software construction to

20、gether with languages, databases, and other tools that support those principles. (Object Technology - A Managers Guide, Taylor, 1997)The History of Object TechnologyMajor object technology milestonesSimula1967C +Late 1980sSmalltalk1972Java1991The UML1996?2000+Strengths of Object TechnologyA single p

21、aradigmA single language used by users, analysts, designers, and implementersFacilitates architectural and code reuseModels more closely reflect the real worldMore accurately describes corporate entitiesDecomposed based on natural partitioningEasier to understand and maintainStabilityA small change

22、in requirements does not mean massive changes in the system under developmentAdaptive to changeBasic concepts of OOBasic Concepts of Object Orientation Object Class Message Basic Principles of Object Orientation Abstraction Encapsulation Inheritance Polymorphism Interface and Abstract ClassInformall

23、y, an object represents an entity, either physical, conceptual, or software.Physical entityConceptual entitySoftware entityWhat Is an Object?TruckChemical ProcessLinked ListA More Formal DefinitionAn object is an entity with a well-defined boundary and identity that encapsulates state and behavior.S

24、tate is represented by attributes and relationships.Behavior is represented by operations, methods, and state machines.ObjectOperationsAttributesAn Object Has StateThe state of an object is one of the possible conditions in which an object may exist.The state of an object normally changes over time.

25、Name: J ClarkEmployee ID: 567138HireDate: 07/25/1991Status: TenuredDiscipline: FinanceMaxLoad: 3Name: J ClarkEmployee ID: 567138Date Hired: July 25, 1991Status: TenuredDiscipline: FinanceMaximum Course Load: 3 classesProfessor ClarkProfessor ClarkAn Object Has BehaviorBehavior determines how an obje

26、ct acts and reacts.The visible behavior of an object is modeled by the set of messages it can respond to (operations the object can perform).Professor Clarks behaviorSubmit Final GradesAccept Course OfferingTake Sabbatical Maximum Course Load: 3 classesSubmitFinalGrades()AcceptCourseOffering()TakeSa

27、bbatical()Professor ClarkSetMaxLoad()Professor ClarkAn Object Has IdentityEach object has a unique identity, even if the state is identical to that of another object.Professor “J Clark” teaches BiologyProfessor “J Clark” teaches BiologyObjects Need to CollaborateObjects are useless unless they can c

28、ollaborate together to solve a problem.Each object is responsible for its own behavior and status.No one object can carry out every responsibility on its own.How do objects interact with each other?They interact through messages.What Is a Class?A class is a description of a set of objects that share

29、 the same properties and behavior. An object is an instance of a class.ObjectsProfessor SmithProfessor JonesProfessor MellonClass: ProfessorAttributesOperationsThe Relationship Between Classes and ObjectsA class is an abstract definition of an object.It defines the structure and behavior of each obj

30、ect in the class.It serves as a template for creating objects Objects are grouped into classes.An object is an instance of a class.ObjectsProfessor SmithProfessor JonesProfessor MellonFrom Real WorldabstractingClass: ProfessorTo computer WorldinstancingObjectsWhat Is an Attribute?An attribute is a n

31、amed property of a class that describes a range of values instances of the property may hold.A class may have any number of attributes or no attributes at all.AttributesAttributes in Classes and Objectsname: M. Modanoaddress: 123 MainstudentID: 9dateofBirth: 03/10/1967name: D. Hatcheraddress: 456 Oa

32、kstudentID: 2dateofBirth: 12/11/1969ClassObjectsWhat Is an Operation?An operation is the implementation of a service that can be requested from any object of the class to affect behavior.A class may have any number of operations or none at all.Operationsclass Professor private String name; private i

33、nt age; private String speciality; public Professor (String sm, int ia, String ss) name = sm; age = ia; speciality = sst; public String getName () return name; public int getAge () return age; public String getSpeciality () return speciality;Example: class Professor Professor- name : String- age : i

34、nt- speciality : String+getName() : String+getAge() : int+getSpeciality() : Stringwang : Professor name = “wang” age = 35speciality = “computer”Professor wang = new Professor (“wang”, 35, “computer”);Example : Instance of Professor What is a message?A specification of a communication between objects

35、 that conveys information with the expectation that activity will ensueOne object asks another object to perform an operation.Professor wangwang.getName()What is your name?The OrderEntryForm wants Order to calculate the total dollar value for the order.Example: Object InteractionOrderEntryFormOrdero

36、rderIDdatesalesTotaltaxshipDateCalculateOrderTotal()calculateOrderTotal()The class Order has the responsibility to calculate the total dollar value.MessageBasic Principles of Object OrientationObject OrientationEncapsulationAbstractionPolymorphismInheritanceWhat Is Abstraction?Abstraction can be def

37、ined as: Any model that includes the most important, essential, or distinguishing aspects of something while suppressing or ignoring less important, immaterial, or diversionary details. The result of removing distinctions so as to emphasize commonalties. (Dictionary of Object Technology, Firesmith,

38、Eykholt, 1995)Abstraction Emphasizes relevant characteristics.Suppresses other characteristics.BriefCase- Capacity- Weight+ open()+ close()Example: AbstractionStudentProfessorCourse Offering (9:00 AM, Monday-Wednesday-Friday)Course (e.g. Algebra)What Is Encapsulation?Encapsulation means to design, p

39、roduce, and describe software so that it can be easily used without knowing the details of how it works.Also known as information hidingAn analogy:When you drive a car, you dont have know the details of how many cylinders the engine has or how the gasoline and air are mixed and ignited.Instead you o

40、nly have to know how to use the controls.What Is Encapsulation?Improves Resiliency Hide implemmentation from clients clients depend on interfaceEncapsulation Information/Implementation hidingInterfaceImplementation details which are unvisuable for client.Information which cant be accessed by clientC

41、lientDeposit()Withdraw()Transfer()BalanceinsterestYTDOwnerAccount_number Deposit() Withdraw() Transfer() What Is Inheritance ?Inheritance a way of organizing classes Term comes from inheritance of traits like eye color, hair color, and so on.Classes with properties in common can be grouped so that t

42、heir common properties are only defined once. Is an “is a kind of” relationshipAn Inheritance HierarchyVehicleAutomobileMotorcycleBusSedanSports CarSchool BusLuxury BusWhat properties does each vehicle inherit from the types of vehicles above it in the diagram?Example: Single InheritanceOne class in

43、herits from another.CheckingSavingsSuperclass (parent)SubclassesInheritance RelationshipAncestorDescendentsExample: Multiple InheritanceUse multiple inheritance only when needed and always with caution!A class can inherit from several other classes.Multiple InheritancePolymorphismPolymorphismthe sam

44、e word or phrase can be mean different things in different contextsAnalogy: in English, bank can mean side of a river or a place to put moneyIn Java, two or more classes could each have a method called outputEach output method would do the right thing for the class that it was in.One output might di

45、splay a number whereas a different one might display a name.What Is Polymorphism?Manufacturer AManufacturer BManufacturer COO Principle:EncapsulationThe ability to hide many different implementation behind a single interface.Example: PolymorphismStockBondMutual FundGet Current ValuegetCurrentValue()

46、getCurrentValue()getCurrentValue()Realization relationship(stay tuned for realization relationships)What is an Interface?An interface is a collection of operations that specify a service of a class or component.Interfaces support “plug-and-play” architecturesShapedraw()move()scale()rotate()TubePyram

47、idCubeWhatHowElided/Iconic Representation(“lollipop”)Canonical (Class/Stereotype) Representation(stay tuned for realization relationships)How Do You Represent An Interface?Shapedraw()move()scale()rotate()ShapeTubePyramidCubeTubePyramidCube1.2 Introduction to UML What is modeling? What is visual mode

48、ling ? What is the UML? What is modeling?What is modeling?A model is a simplification of reality.What is this Thing?Modeling a BriefcaseAbstractingBriefCase- Capacity- Weight+ open()+ close()What is modeling?What is this Thing?A new Use for a BriefcaseQuestions: Why did we model the thing as “Briefc

49、ase”? Why did we not model it as a “chair”? What do we do if the sitOnIt() operation is the most frequently used operation? The briefcase is only used for sitting on it. It is never opened nor closed. Is it a “Chair”or a “Briefcase”?A model is an abstraction of things. Emphasizes relevant characteri

50、stics. Suppresses other characteristics.AbstractingBriefCase- Capacity- Weight+ open()+ close()+ sitOnIt()The Importance of ModelingPaper AirplaneF-16 Fighter JetLess ImportantMore ImportantSoftware Teams Often Do Not ModelMany software teams build applications approaching the problem like they were

51、 building paper airplanesStart coding from project requirementsWork longer hours and create more codeLacks any planned architectureDoomed to failureModeling is a common thread to successful projectsWhy Do We Model?We build models to better understand the system we are developing.Modeling achieves fo

52、ur aims. ModelingHelps us to visualize a system as we want it to be.Permits us to specify the structure or behavior of a system.Gives us a template that guides us in constructing a system.Documents the decisions we have made.We build models of complex systems because we cannot comprehend such a syst

53、em in its entirety.Four Principles of ModelingThe model you create influences how theproblem is attacked.Every model may be expressed at different levels of precision.The best models are connected to reality.No single model is sufficient.What is visual modeling?What Is Visual Modeling?Computer Syste

54、m“Modeling captures essential parts of the system.” Dr. James RumbaughVisual Modeling is modelingusing standard graphical notationsBusiness ProcessPlace OrderInventoryShippingVisual Modeling Captures Business ProcessesUse-case analysis is a technique to capture business processes from a users perspe

55、ctive.Visual Modeling Is a Communication ToolUse visual modeling to capture business objects and logic.Use visual modeling to analyze and design your application.Visual Modeling Manages ComplexityVisual Modeling and Software ArchitectureUser Interface(Visual Basic,Java)Business Logic(C+, Java)Databa

56、se Server(C+ & SQL)Model your systemindependent of implementation languageVisual Modeling Promotes ReuseMultiple SystemsReusableComponentsWhat Is the UML?UML is an acronym for Unified Modeling LanguageThe UML is a language forVisualizingSpecifyingConstructingDocumentingthe artifacts of a software-in

57、tensive system.UML: Object-Oriented & Visual Modeling The UML Is a Language for VisualizingCommunicating conceptual models to others is prone to error unless everyone involved speaks the same language.There are things about a software system you cant understand unless you build models.An explicit mo

58、del facilitates communication.The UML Is a Language for SpecifyingThe UML builds models that are precise,unambiguous, and complete.The UML Is a Language for ConstructingUML models can be directly connected to a variety of programming languages.Maps to Java, C+, Visual Basic, and so on Tables in a RD

59、BMS or persistent store in an OODBMS Permits forward engineering Permits reverse engineeringThe UML Is a Language for DocumentingThe UML addresses documentation of system architecture, requirements, tests, project planning, and release management.A Language Is Not Enough to Build a SystemWhat Type o

60、f Process Most Benefits the UML?The UML is largely process independent. A process fully benefits from the UML whenthe process is:Use-case drivenArchitecture-centricIterative and incrementalA Use-Case Driven ProcessUse cases defined for a system are the basis for the entire development process.Benefi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论