您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 面向对象分析与设计Part 9
CH31精化领域模型关联类聚集和组合关联的类型和UML表示使用包来组织领域模型关联类什么时候使用关联类?一个属性与关联有关关联类生命周期依赖于关联两个概念之间存在多对多的关系salaryEmploymentEmploysCompanyPerson**一个人,可能受雇于多家公司关联类商店授权服务和机器号码的关联addressnamephoneNumberAuthorizationServiceaddressnameStoremerchantIDServiceContract一个关联类它的属性与关联相关它的生命周期依赖于关联Authorizes-payments-via1..**聚集和组合聚集和组合的UML表示组合聚集部分是全部的成员,而且部分完全依赖于全部共享聚集部分是全部的成员,但部分可能还是其他的成员Finger0..7Handcompositeaggregation1UMLElementReferencesUMLPackagesharedaggregation**聚集和组合POS中的聚集表示Sale包含着SaleLineItem,ProductCatalog包含着ProductSpecificationProductSpecification与ProductPrice关联用于表示不同时期的价格。SaledatetimeSalesLineItemquantityProductSpecificationdescriptionitemID1..*Described-by*1ProductCatalog...ProductPriceactiveInterval:TimeIntervalprice:MoneyTimeIntervalstart:timeStampend:timeStamp1..*11Priced-by1..**关联的其他UML表示关联角色概念的角色和关联的角色两种表达方式FlightCityFlies-to*destination角色名字Person*parentCreates2child1StorePersonEmploys-to-handle-salescashierEmploys-to-managemanager**Manages*workermanagerStoreCashierManagerEmploys*Employs*rolesasconceptsManages*rolesinassociations11111关联的其他UML表示导出元素由其他元素决定的元素受限关联有限制条件的关联自反关联自己和自己关联有序元素date/totaltimeSalederivedattributeSalesLineItem1..*{ordered}Sale...1thereissomekindofordering,suchasbyorderaddedProductCatalogProductSpecificationitemIDContainsProductCatalogProductSpecificationContains1..*multiplicityreducedto1(a)(b)qualifier111使用包来组织领域模型UML的包将对象进行分类管理对象的容器可应用于各种模型的描述UML的包图DomainCoreElementsSalesDomainCoreElementsSalesPOS系统领域模型的表示顶级模型DomainCore/MiscPaymentsProductsSalesAuthorizationTransactionsPOS系统领域模型的表示Core/MiscRegisterManagerStoreaddressnameHouses1..*Employs1..*11POS系统领域模型的表示PaymentsCheckAccountsReceivableCreditPaymentCheckPaymentCheckAuthorizationServiceCreditAuthorizationServiceAuthorized-byAuthorized-by***AuthorizationServiceaddressnamephoneNumberCore::StorePaymentamountEstablishes-credit-forLogs*CreditCardexpiryDatenumberDriversLicensenumber1..*Establishes-identity-forPaid-byCashPaymentamountTendered*Sales::CustomerAbused-byIdentifiesAuthorizationTransactions::PaymentAuthorizationReply-CheckPaymentshaveCheckPaymentReplies-CreditPaymentshaveCreditPaymentReplies11111111111Authorizes-payments-ofmerchantIDServiceContract1POS系统领域模型的表示Products1..*Core::StoreStocks*Describes*Sales::SalesLineItemDescribed-by*Records-sale-of0..1ProductSpecificationdescriptionpriceitemIDProductCatalogItem11111POS系统领域模型的表示SalesCashierCustomer1..*SalesLineItem/quantitySaledateisCompletetimeInitiatesCore::RegisterRecords-sales-onCaptured-onCore::StoreLogs-completed*11111111TaxLineItemdescriptionpercentageamount1..*1POS系统领域模型的表示AuthorizationTransactionsCreditPaymentApprovalRequestCheckPaymentApprovalRequestPaymentAuthorizationRequestCreditPaymentApprovalReplyCheckPaymentApprovalReplyCreditPaymentDenialReplyCheckPaymentDenialReplyPayments::AuthorizationServiceSendsReceivesPayments::CreditPaymentPayments::CheckPaymentPaymentAuthorizationTransactiondatetimeCore::StorePaymentAuthorizationReplyReceives*Sends***1111111111111111CH32新增的系统顺序图和契约makeCreditPayment(credNum,expiryDate)reply:=requestApproval(request)postReceivable(receivable)«actor»:CreditAuthorizationService«actor»:AccountsenterItem(itemID,quantity):NextGenPOSSystem:CashierendSale()ProcessSalePaybyCreditScenariodescription,totaltotalwithtaxes*[moreitems]makeNewSale()«actor»:TaxCalculatortaxLineItems:=getTaxes(sale)postSale(sale)契约信用卡支付makeCreditPayment交叉引用:用例:ProcessSale前置条件:一个处理的销售已经存在所有的商品条目已经输入。后置条件:创建了一个CreditPaymentpmtpmt与当前的销售建立了关联创建了一个CreditCardcc;且cc.number=…cc与pmt建立了关联创建了一个CreditPaymentRequestcpqpmt与cpq建立了关联创建了一个ReceievableEntryrere与外部的AccountsReceievable关联已经建立Sale与Store关联已经建立,并是一次完整的销售。
本文标题:面向对象分析与设计Part 9
链接地址:https://www.777doc.com/doc-3968271 .html