Unit 10 Flashcards
What are the main issues addressed by the Layers pattern and what are the main mechanisms used to address them?
The main issues addressed by the pattern are achieving low coupling between elements, and separating concerns.
This is realised by organising the system elements in layers, each layer addressing a particular concern, and managing the coupling between layers carefully.
How does the adoption of the pattern facilitate reuse and flexibility?
The implementation of general services can be separated from that of other parts of the system. Hence services can be potentially reused in other applications, or their implementation replaced while still providing the same basic services.
Describe the relationship between the two styles of Layers pattern illustrated in Figure 1.
The five-layered version (Figure 1(b)) introduces two mediating layers between the fundamental layers of the three-layered version (Figure 1(a)).
What do you think may determine the flavour of the patterns that should be adopted for the architecture of a particular enterprise system?
Complexity and flexibility are determining factors.
For instance, if the relationship between the presentation and domain layers is straightforward and can be easily modified and tested, then it might be more efficient to distribute the logic between these two layers rather than introducing a third one.
On the other hand, in a system that allows complex interactions to occur with a large variety of users and where changes are frequent, the introduction of an application layer might allow the logic in the two other layers to be independently modified, tested and validated. A similar argument applies to the technical services layer.
What do we mean by software architecture?
Software architecture is a high-level abstract description of the structure of a software system – its major parts and how they are interrelated.
How does an architectural pattern relate to software architecture?
An architectural pattern focuses on particular elementary principles used in software architectures, so that aspects of the way a particular architecture works can be accounted for by reference to architectural patterns.
What are the various ingredients that make up a framework?
A framework comprises an architecture, together with a component repository that contains components suitable for use within the framework, plus whatever documentation would facilitate the use of the framework.
How does a domain model differ from a conceptual model?
A domain model addresses a general set of possible problems or requirements,
whilst a conceptual model addresses a specific problem.
What is a common business object?
A business object is any entity, such as a customer, that occurs in a business application.
A common business object is one that recurs widely and often, and is worth placing in a component repository.
How do frameworks help in the reuse of components?
Components may not quite fit into a particular application, or can be too general to be useful. A framework only places in the repository those components that do fit and are useful.
The framework will guide the user to the component required, so that general search methods are not required.
Discuss how the Application Controller pattern may apply in a layered architecture.
The Application Controller pattern fits nicely in a layered architecture, as illustrated in Figure 9.
The controller may sit in the application layer and mediate between presentation and domain objects.
Actor events are translated into system events between the interface and the controller; this may result in a number of messages between the controller and domain objects.
Discuss possible advantages of separating presentation from domain logic.
The two main advantages of this separation are: first, presentation logic is not affected by changes in the implementation of the business logic; second, business logic can be tested separately from the presentation logic.
What sort of business logic will be invoked by the application controller?
The application controller will invoke business logic to:
- locate class instances within the system, by mapping value and object identities;
- invoke methods on business objects to check operations’ preconditions (the application controller takes the role of the client in the operation contract);
- delegate the satisfaction of the operations’ postconditions to business objects.
Discuss the differences and similarities between the application controller and the controller in the MVC pattern.
The application controller isolates and abstracts business logic from presentation logic, and controls the workflow of a business process.
The MVC controller manages user inputs through a user interface in order to modify business data.
Thus the contexts of their applications are different: a business process versus a user interface.
The main similarity between the two controllers is that they support a separation of concerns: presentation logic from business logic in the case of the application controller; data from the user’s view in the case of the MVC controller.
In this question we consider a variant of the heating system described in Subsection 2.2. The system, HomeWarm, is a central heating system for domestic use. It allows the user to set up a target home temperature to be maintained by the system. It also allows the user to set the periods of time, within 24 hours, when the system should be in operation. HomeWarm is made up of the following components.
- A thermostat, which senses the temperature of the environment and lets the user set the target temperature to be maintained.
- A boiler/pump, which heats up and circulates the water to the radiators in the house.
- A control unit, which lets the user set up the periods of operation of the system (start and end times) within 24 hours. The control unit includes a display which indicates to the user the set periods of operation and whether the system is currently in operation.
The HomeWarm system is designed as an object-oriented system based on an MVC framework. The system includes the classes shown in Figure 11.
(See pic)
Thermostat senses the current room temperature and lets the user set the target temperature. Clock keeps track of time for the control unit. ControlUnit allows the user to set the system operation period (start and end times) within 24 hours; when it is operating, if the temperature sensed by the thermostat falls below the target temperature, it activates the boiler. Display shows the current user setting (start and end times), and whether the system is currently in operation. The Observer pattern is applied repeatedly in the design of HomeWarm to achieve the correct system behaviour.
(a) Identify all the relevant subject/observers dependency relations between the HomeWarm classes. Focus on MVC principles and values that change at run-time.
(b) Draw a sequence diagram to illustrate what happens when the system starts operating and senses a temperature below the target one.
(a) Display depends on ControlUnit to show whether the control unit is currently in operation and to show the user settings. ControlUnit depends on Thermostat to find out the current room temperature. ControlUnit depends on Clock to start and stop operating.
(b) see pic