Block 3 Unit 9 Flashcards
Suggest a reason why choosing the architecture very late on might be a bad idea.
Choosing the architecture at a very late stage suffers from the risks of the waterfall approach. By then many other design decisions will have been taken and it will be too late to change them, even if they force us to adopt an architecture that is less than ideal.
An analogy could be with building a house. Would anyone dream of starting construction without an architectural design for the building?
Think of some reasons why reuse is desirable.
We thought of several reasons. You may have come up with others.
It avoids duplication of effort and reinventing already existing solutions, which saves resources.
It promotes reliability because developers can use tried and trusted solutions.
It speeds up development because developers can take existing solutions without starting from the beginning every time.
It is a mechanism for spreading good practice among the software development community and familiarising practitioners with tried and tested solutions.
What are the various ingredients that make up a framework?
A framework consists of an architecture, a small amount of software for the framework, a set of components suitable for use within the framework and the documentation needed to make use of the framework.
List the various forms of reuse discussed in Section 4 and say briefly what is reused in each case.
Architectural styles reuse expertise in large-scale architectural design – the types of component used and the patterns of interaction between them.
Frameworks reuse a particular architecture and a set of software components suitable for use within it.
Product lines reuse reference architectures, software components and expertise about the variations needed to fulfil customer requirements.
What is the difference between generalisation and realisation?
Generalisation expresses a subtyping relationship between two classes. The subclass is a specialised subtype of its superclass and inherits the attributes and operations defined by the superclass. Realisation is not a subtyping relationship but instead expresses the fact that a class provides an implementation for all the operations specified by an interface.
Discuss possible advantages of separating the user interface from the domain logic.
These are the main advantages.
- The user interface is not affected by changes in the implementation of the business logic.
- The same domain logic can be used with different user interfaces.
- The business logic can be tested separately from the interface logic.
Where in the hotel system might we use a singleton?
We could use a singleton instance of HotelChain as a system object that all messages from the user interface are sent to.
Suggest some quality requirements that the Factory pattern might help satisfy.
The ones we thought of were maintainability and portability (and flexibility if it is counted as distinct from maintainability). You may have come up with others.
Think of another concept that uses principles similar to those above.
From the above principles, a component closely resembles the concept of an object in an object-oriented language.
Think of some possible advantages and disadvantages of building software by plugging together off-the-shelf components.
Advantages
1. Reusing a standard component should be cheaper than developing software from scratch.
2. Using off-the-shelf components will allow applications to be developed more quickly.
3. Standard components will have been used in many other projects, so their behaviour will be well understood and any bugs are likely to be known.
4. Components are pluggable, so it is often possible to replace one component with another providing it has the same interface and behaves in the same way.
Disadvantages
1. Using standard components may restrict what we can do since we have to work with the capability of the components.
2. Some additional software is likely to be needed as ‘plumbing’.
3. If the interfaces of components are incompatible, adapters will have to be written.
4. Creating a system by plugging together off-the-shelf components may not be as simple as it sounds.
Suppose a component is implemented as an instance of a Java class. What corresponds to:
the provided interface of the component
the required interface of the component?
The provided interface consists of all the public methods in the class. The required interface consists of all the methods from other classes that the component’s methods make use of. In object-oriented languages an object belonging to a subclass is allowed to replace an object of the parent class. This is substitutability, which was discussed in Block 2 Unit 5.
In the context of software components, describe a concept that is similar to substitutability.
Components are replaceable: a component can be replaced by another that does the same job.
What would the assume–guarantee contract for a component include and how do the assume and guarantee relate to the component’s provided and required interfaces?
The contract for a component would be:
1. the pre- and postcondition of all the operations in the provided interface of the component
2. the invariants that apply to any publicly visible properties of the component
3. the required interface of the component and all the assumptions of the required interface
4. any other assumptions about the environment in which the component will operate.
The assume would be the preconditions of the operations, and items 3 and 4 of the contract above.
The guarantee would be the postcondition of the operations and item 2 of the contract above.
Think of two application areas where the appropriate response measure for a performance scenario would be something other than latency.
Here are several examples we thought of:
- a system controlling a plant processing industrial chemicals – deadline
- an online shopping site – throughput
- an online gaming site – jitter (since users will expect consistent response times)
- a social networking site – data loss
- an online shopping site – miss rate.
From your study of the module, list some other types of reusable solution, apart from design tactics, that are available to software engineers.
We thought of: analysis patterns requirements patterns architectural styles design patterns language idioms components services.