Designing Object-Oriented Software Architectures in Software Assign barcode code39 in Software Designing Object-Oriented Software Architectures

Designing Object-Oriented Software Architectures using software torender barcode 3 of 9 in web,windows application .NET CF operation to clear t Code 39 Extended for None he prompt window and an operation to displayPrompt (in promptText).. 14.7 BUSINESS LOGIC CLASSES A business logic cla Software Code 39 ss de nes the decision-making, business-speci c application logic for processing a client s request. The goal is to encapsulate business rules that could change independently of each other into separate business logic classes. Usually a business logic object accesses various entity objects during its execution.

An example of a business logic class is the Withdrawal Transaction Manager class (shown in Figure 14.5), which encapsulates the rules for processing an ATM withdrawal request. It has operations to initialize, withdraw, con rm, and abort.

The operation initialize is called at initialization time; withdraw is called to withdraw funds from a customer account; con rm is called to con rm that the withdrawal transaction was successfully completed; and abort is called if the transaction was not successfully completed (e.g., if the cash was not dispensed at the ATM).

The operations are determined by careful study of the Banking Service analysis model communication diagram, as shown in Figure 14.5a, and the message sequence descriptions that identify the contents of the messages (see 19). From this, the design model communication diagram shown in Figure 14.

5b and the class diagram shown in Figure 14.5c are determined..

14.8 INHERITANCE IN DESIGN Inheritance can be u barcode 3/9 for None sed when designing two similar, but not identical, classes in other words, classes that share many, but not all, characteristics. During architectural design, the classes need to be designed with inheritance in mind so that code sharing and adaptation can be exploited in detailed design and coding. Inheritance can also be used when adapting a design for either maintenance or reuse purposes.

Used in this way, the biggest bene t is from using inheritance as an incremental modi cation mechanism.. 14.8.1 Class Hierarchies Class hierarchies (a Code 3 of 9 for None lso referred to as generalization/specialization hierarchies and inheritance hierarchies) can be developed either top-down, bottom-up, or by some combination of the two approaches. Using a top-down approach, a class is designed that captures the overall characteristics of a set of classes. Specializing the class to form variant subclasses separates the differences among the classes.

Alternatively, it can be recognized that an initial design contains classes that have some common properties (operations and/or attributes) as well as some variant properties. In this case, the common properties can be generalized into a superclass; these attributes and/or operations are inherited by the variant subclasses. It should be noted that when designing with inheritance, the internals of the parent classes are visible to the subclasses.

For this reason, design and reuse by subclasses is referred to as white box reuse. Thus, inheritance breaks the encapsulation (i.e.

, information hiding) concept. The implementation of the child class is. (b) Withdraw, Confir m, Abort withdraw ( in accountNumber, in amount, out response), confirm (accountNumber, amount), abort (accountNumber, amount) business logic : WithdrawalTransaction Manager coordinator : BankTransaction Coordinator business logic : Withdrawal TransactionManager (c) business logic WithdrawalTransactionManager + initialize () + withdraw (in accountNumber, in amount, out response) + confirm (accountNumber, amount) + abort (accountNumber, amount). coordinator : BankTransaction Coordinator Withdraw Response Figure 14.5. Example Code 3/9 for None of business logic class: (a) Analysis model: communication diagram.

(b) Design model: communication diagram. (c) Design model: class diagram. Designing Object-Oriented Software Architectures bound up with the im barcode 3 of 9 for None plementation of the parent class, which can lead to rippleeffect problems with deep inheritance hierarchies. Thus, an error made to a class high up in the inheritance hierarchy will be inherited by its descendent classes at all lower levels in the hierarchy. For this reason, it is advisable to limit the depth of class hierarchies.

. 14.8.2 Abstract Classes An abstract class is Software Code-39 a class with no instances. Because an abstract class has no instances, it is used as a template for creating subclasses instead of as a template for creating objects. Thus, it is used only as a superclass and de nes a common interface for its subclasses.

An abstract operation is an operation that is declared in an abstract class but not implemented. An abstract class must have at least one abstract operation. An abstract class defers all or some of its operation implementations to operations de ned in subclasses.

Given the interface provided by the abstract operation, a subclass can de ne the implementation of the operation. Different subclasses of the same abstract class can de ne different implementations of the same abstract operation. An abstract class can thus de ne an interface in the form of abstract operations.

The subclasses de ne the implementation of the abstract operations and may extend the interface by adding other operations. Some of the operations may be implemented in the abstract class, especially in cases in which some or all of the subclasses need to use the same implementation. Alternatively, the abstract class may de ne a default implementation of an operation.

A subclass may choose to override an operation de ned by a parent class by providing a different implementation for the same operation. This approach can be used when a particular subclass has to deal with a special case that requires a different implementation of the operation..

Copyright © . All rights reserved.