OO實(shí)例教學(xué)課件_第1頁(yè)
OO實(shí)例教學(xué)課件_第2頁(yè)
OO實(shí)例教學(xué)課件_第3頁(yè)
OO實(shí)例教學(xué)課件_第4頁(yè)
OO實(shí)例教學(xué)課件_第5頁(yè)
已閱讀5頁(yè),還剩41頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

WhatisObject-Oriented?

?Objectorientationisanapproachto

softwaredevelopmentthatorganizesboth

theproblemanditssolutionasacollection

ofdiscreteobjects;

?Itisakindofrepresentationthatdescribe

object'sdatastructureandbehavior.

?Itisakindofmodelingtechnology.

Characteristicsof00Representation

?Identity-name,reference,handle

?Abstraction

?Classification

?Encapsulation

?Inheritance

?Polymorphism

?Persistence

The00DevelopmentProcess

?Beconsistencyofterminologyandof

-Theproblemandthesolutionweredescribedin

sameterms:classes,objectsmethods,attributes,and

behaviors.

?Beconsistencyofperspective

-Staticviews

-Dynamicviews

-Restrictions

TendencyforChangewhenUsing00Paradigm

(Jacobsonetal.1995)

Characteristicofsoftwareproduct/projectProbabilityforchange

ObjectsderivedfromtheapplicationLow

Long-livedinformationstructuresLow

Passiveobject5sattributeMedium

SequencesofbehaviorMedium

InterfacewiththeoutsideworldHigh

FunctionalityHigh

OORequirements

?OOrequirementsanalysisisusuallydoneintheuser's

language.

?OOrequirementsanalysisdiscussestheconceptsand

scenarioslikelyinapplicationdomain.

-Theconceptsincludeinformation,service,and

responsibilities.

-Domainknowledgeenablesbothdevelopersandusersto

understandtheproblems.

?Therequirementsdefinitioncanbeindependentof

implement.

00Design

?Requirementspecification,thefirststepsofdesign.

?Torepresentasystemdesign

-First,toidentifyandrepresentclassesandobjects.

-Second,toidentifytheinteractionsandrelationships

amongobjectsandclasses.

?Associations

?Compositions

?Aggregations

?Inheritance

?Toprovidethedetailsinprogramdesign.

-Insertcomputationalfeaturesinthemodels

-Insertsomeclasslibrarydetails

-Considernonfunctionalrequirements

UseCases(用例)

?Describeparticularfunctionalitytoexhibithow

auser,externalsystem,andotherentitydialog

withthesystem.

?Scenario場(chǎng)景

?Script腳本

Usecasediagrams(用例圖)

?Actor(角色)

-Aentityinteractingwiththesystem

-Orarolethatanentityplayswithrespectofthesystem

,User

?Device

,Anothersystem

?Cases(用例)

-Adepictionofsomeaspectoffunctionality

?Extensions

-Toextendausecasetoillustrateadifferentordeeper

perspective.

?Uses

-Actuallyareuseofanalready-definedusecase

Overviewofroyalservicestation

Aactoro

Standfbracase

(Billing^)

Customer\

\

(^^efiielmg^)(^^arking^JMaintenance

Firstextensiontoincludepreventivemaintenance

Secondextensiontoincludecreditcardsystem

Thirdextensiontoincludeinventoryandaccounting

FuelOrderingPartsOrdering

systemsystem

UseUMLtoRepresent00

?OMG(ObjectManagementGroup)haveadopted

UMLasthe00notationalstandard.

?UMLcanbeusedtovisualize,specify,or

documentaproblem.

?UMLcanbeusedthroughoutthesoftware

developmentprocess.

UMLdiagrams

?Staticviewisdepictedwith

-Usecases(用例圖)

-Classdiagrams(類圖)

-Packagediagrams(包圖)

-Deploymentdiagrams(酉己置圖)

?Dynamicviewisdepictedwith

-Statediagrams(狀態(tài)圖)

-Activitydiagrams(活動(dòng)圖)

-Sequencediagrams(順序圖)

-Collaborationdiagrams(合作圖)

?Restrictionsandformalization

-BeexpressedwithOCL(objectconstraintlanguage)

00SystemDesign

?Fivelevelsof00design

-Identifysubjects

-Identifyclassesandobjects

-Identifyattributes

-Identifystructures

-Identifyservices

Determinecandidateclasses

?Somequestionscanhelpustogroupthe

candidateclassesandobjects.

-Whatneedstobe"processed“insomeway?

-Whatitemshavemultipleattributes?

-Whendoyouhavemorethanoneobjectinaclass?

-Whatisbasedontherequirementthemselves,not

derivedfromyourunderstandingofthe

requirements?

-Whatattributesandoperationsarealwaysapplicable

toaclassorobject?

RelatedRequirementStatements

Acustomerhastheoptiontobebilledautomaticallyatthetimeof

purchase(offuel,maintenance,orparking)ortobesentamonthly

paperbill.Ineithercase,customerscanpayusingcash,creditcard,

orpersonalcheck.RoyalServiceStationfuelissoldaccordingto

pricepergallon,dependingonwhetherthefuelisdiesel,regular,or

premium.Serviceispricedaccordingtothecostofpartsandlabor.

Parkingissoldaccordingtodaily,weekly,andmonthlyrates.The

pricesfbrfuel,maintenanceservices,parts,andparkingmayvary;

onlyManny,thestationmanager,canenterorchangeprices.Athis

discretion,Mannymaydesignateadiscountonpurchasefbra

particularcustomer;thisdiscountmayvaryfromonecustomerto

another.A5%localsalestaxapplestoallpurchase.

TentativeclassesofRoyalServiceStation

?Personalcheck?Services

?Paperbill?Discounts

?Creditcard?Tax

?Customer?Parking

?Stationmanager?Maintenance

?Purchase?Cash

?Fuel?Prices

FirstGroupingofAttributesandClasses:Stepl

ClassesAttributes

CustomerPersonalcheck

MaintenanceTax

ServicesPrice

ParkingCash

FuelCreditcard

PaperbillDiscounts

Purchase

Stationmanager

RelatedRequirementStatements

Thesystemappliesonlytoregularrepeat

customers.Aregularrepeatcustomermeansa

customersidentifiedbyname,addressandbirth-

datewhousesthestation'sserviceatleastonce

permonthfbratleastsixmonths.

Thesystemwillsendperiodicmessagesto

customers,remindingthemwhentheirvehicles

areduefbrmaintenance.Normally,maintenance

isneededeverysixmouths.

FirstGroupingofAttributesandClasses:Step2

ClassesAttributes

CustomerPersonalcheck

MaintenanceTax

ServicesPrice

ParkingCash

FuelCreditcard

PaperbillDiscounts

PurchaseBirthdate

PeriodicmessageName

StationmanagerAddress

Forthefullsetofrequirements,we

mightexpandourtabletoinclude

alloftheclasses.

FirstGroupingofAttributesandClasses:Step3

ClassesAttributes

Customer

MaintenancePersonalcheck

ServicesTax

Parking

FuelPrice

Paperbill

PurchaseCash

Periodicmessage

StationmanagerCreditcard

Warningletter

PartsDiscounts

Accounts

InventoryBirthdate

CreditcardsystemName

Part-orderingsystem

Fuel-orderingsystemAddress

IdentifyBehavior

?Lookfbrparticularitemsthatsuggestbehaviors:

(Extractverbsfromtherequirementsstatement)

-Imperativeverbs

-Passiveverbs

-Actions

-Thingsorremindedevents

-Roles

-Operatingprocedures

-Serviceprovidedbyanorganization

?Thebehaviorswillbecomeactionsor

responsibilities.

UseUMLtodescribetherelationship

amongtheobject,classes,andbehaviors

bill

Issuedate:Date

Paymentdate:Date

Price()

Taxes()

Customers()

Purchase()

Add_to_bill(customer,amount,date)

Inheritance

Fourkindsofrelationship

?Generalization

?Aggregation

?Association

?composition

UMLnotations

association

composition

aggregation

dependency

navigation

Associationofclasses

Qualifiedassociation

Qualifiedassociation

SwayBackandForth

?AbstractaMessageClassfromwarningletterand

periodicmessage.

?Thefuelclassshouldbeconnectedtoinventoryclass

?Deletetheaccountclass(hasonlyoneattribute)andadd

theaccountnumbertothecustomerclass.

?Addthreenewclass,refuel,parkingspace,service.

-Fortakingadvantageofthepolymorphism

?Thepriceanddiscountcanbedifferentdependingonwhatserviceis

required.

-Removethediscountratefromthefuelclassandputitinthe

partclass.

-Removethepricefromthefuelclassandaddittotherefuel

class.

-Putthepriceofaparkingspace,locationintheparkingclass.

CustomerPeriodic

Messages

nameWarningletter

Address

Birthdatetexttext

Purchase

dateBillStation

CreditCardManager

systemtaxrateissuedate

Paymentdate

Services

ParkingSpacepriceVehicleMaintenance

locationdiscountrateissuedate

Paymentdate

Refuel

Part

gallons£7Inventory?

ocationricepartnumber

price

Price

ParksFueldiscountrate

FuelOrderingOrdering

min_quantity=l00systemsystem

Currentquantity

SwayBackandForth

?DeleteStationManagerclass

?Addservicestationtohandlethetrackingof

dormantaccounts

OtherUMLDiagrams

?Classdescriptiontemplate

?Packagediagrams

?Sequencediagrams

?Collaborationdiagrams

?Statediagrams

?Activitydiagrams

Classdescriptiontemplate

?Templatetellus

-thepositionoftheclassintheoverallhierarchy

-exportcontrols

-cardinality

-associations

?Templatealsospecifies

-theoperationsintheclass

-thepublicinterfacetotheclass

Templatefbrtherefuelclass

Classname:refuelPublicinterface:

Category:serviceOperation:

Externaldocuments:price

Exportcontrol:PublicPrivateinterface:

Cardinality:nAttributes:

Hierarchy:Gallons

Super-classes:servicesprice

Associations:Implementation:

Operationname:priceAttributes:

Publicmemberof:refuelGallons

Documentation:price

Preconditions:Statemachine:no

Gallons>0

Objectdiagram:unspecifiedConcurrency:sequential

Semantics:Persistence:transient

final_price=gallons*price

Concurrency:sequential

Packagediagrams

Standfor

dependent

Interactiondiagrams

?Todescribehowoperationsandbehaviors

arehandledbyobjects.

?Todescribehowtheobjectsareconnected

statically.

?Basedoneachusecase

?Twokindsofinteractiondiagrams

-Sequencediagrams

-Collaborationdiagrams

Sequencediagramfbrtherefuelusecase

CustomerServiceStationCreditCardPurchaseRefuel

System

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論