软件体系结构-三个建模实例之一:Banking System

版权声明:如需转载或引用,请注明出处。 https://blog.csdn.net/weixin_39278265/article/details/80589475

Three instances of software modeling and design

The instances are from the book “software modeling and design–UML, user cases, patterns and software architecture”. Now I analyze them and write them here.

Banking system (C/S software architecture case study)

problem description

所有名词都应该被记录并考虑。动词也是吧。
Therefore, here are the relevant key words:

  1. bank, several ATMs, a central server

  2. for each ATM, a card reader, card dispenser, a keyboard/display, a receipt printer.

  3. behaviors:
    a customer: withdraw money, query the balance of an account, transfer funds from one account to another.
    a transaction is initiated when a customer inserts a card into the card reader (card number, start date, expiration date are encoded on the back)
    card is recognized(info is read), system validates ATM card to judge that the expiration date is valid/PIN matches the PIN maintained/card is not lost
    card is confiscated (没收) after three attempts to enter the correct PIN.
    after the PIN is validated, customer can do three transactions: withdraw, query, transfer
    withdraw: before it, system checks if the sufficient funds exist/check if there are sufficient funds at the local cash dispenser(分配器,自动取款机).
    if true, the requested amount of cash is dispensed, and a receipt is printed, card is ejected.
    transfer: system checks if the customer has at least two accounts, there are sufficient funds in the account to be debited.
    for both query and transfer requests, a receipt is printed and the card ejected.
    a customer may cancel a transaction at any time, transaction is terminated, card is ejected.
    customer records, account records, and debit card records are all maintained at the server.

    an ATM operator may start up and close down the ATM to replenish (补充) the ATM dispenser.

use case model for banking system context and entity classes

Now that we figure out the problem by analyzing the description, we now build the use case model.

  1. there are two actors: customer and ATM operator.
  2. for customer, there are three transactions: withdraw, query, transfer. for operator, two actions: start up, close down, replenish the dispenser.
  3. input devices: card reader and keyboard. output devices: printer, dispenser.
    therefore, 5 cases + Validate PIN use case are identified.

static modeling

problem domain, system context & entity classes

  1. problem domain: bank, ATM, two actors, ATM card reader, cash dispenser, keyboard, printer. && their relations.
  2. system context: the Banking system (what we have to design ourselves) are shown as one aggregate(聚合的) class.
    and show its interfaces to external classes.
    therefore, I/O devices are modeled as external classes.
    and plot two actors, 4 I/O devices, software system & their relations.
  3. entity classes: we have to identify that which classes are entity classes.
    In my view, these should be: Bank, ATM info, accounts, customer, operator??? transaction.
    plot the attributes of each entity class.

objects structuring

  1. C/S subsystem structuring: two subsytems (ATM client and banking service), external devices/users, and their relations.
  2. ATM client object and class structuring: boundary objects: banking system(an aggregate class) including boundary classes for each external devices/actors.
  3. ATM client object and class structuring: objects participating in use cases: all entities, interfaces inside the ATM client subsystem.
  4. Service subsytem object structuring: business logic objects.

dynamic modeling (interaction diagrams)

communication diagram & sequence diagram: ATM client validate pin use case
communication diagram & sequence diagram: Banking service validate pin use case.
& similarly for other 6 test cases.

state chart

state chart for ATM control: validate pin use case.

design model

very complicated…

写作时间:2018-06-06

猜你喜欢

转载自blog.csdn.net/weixin_39278265/article/details/80589475
今日推荐