2008 Flashcards
A good software system is one that meets its users’ needs. List three characteristics that such a system should possess.
A good software system should be useful, usable, reliable, flexible, affordable and available [any three of these].
If more people are added to a software development team, what effect will it have on communication?
If more people are added to a software development team, then the number of channels of communication will increase. This will mean that each person will spend more time communicating with other team members, adding extra overhead.
What is the difference between a functional requirement and a non-functional requirement?
A functional requirement is one that specifies an action the software must perform, e.g. check, calculate, record, retrieve etc., whereas a non-functional requirement specifies a quality that the software must possess.
What are the advantages of using a standard template, such as the Volere template, for requirements capture?
Using a standard template for requirements capture:
- saves wasting time repeatedly making decisions about what to record;
- ensures that nothing important is left out;
- assists communication between developers;
- allows projects to be compared and requirements reused in some cases.
[any three of these]
What are the benefits of prototyping? Who should test a prototype?
The benefits of prototyping include:
- it helps with the design of the user interface;
- it gets the users involved and is a good way of capturing and refining requirements;
- it help minimise misunderstandings between the developer and the users;
- it may allow early detection of possible problems, before things have gone too far, at a relatively low cost; [any three benefits] The prototype should be tested by ‘real’ users, that is, those who will be using the software on a day-to-day basis.
Can the association between Doctor and Patient be derived from those between Doctor and Clinic, and Clinic and Patient? Explain your answer.
No. Several doctors can be linked to a given clinic, and any one of these might be the one that is linked to a given patient. Therefore, it is not generally possible to work out which doctor is linked to which patient from the links between doctors and clinics and between clinics and patients.
By considering a loop from Clinic or Patient, formed by associations, find an invariant that should apply to the model. Express the invariant either in OCL in the context of Clinic or Patient, or using an unambiguous description in English.
The unambiguous English description is shown as a comment in the OCL specifications.
context Patient inv:
- -The set of Doctor instances of the Clinic a Patient is linked to includes the Doctor of that Patient.
self. clinic.doctor -> includes(self.doctor)
Alternatively, in Clinic,
context Clinic inv:
– The set of Patient instances of a Clinic is the same as the collection of
Patient instances of all Doctors of that Clinic.
self.patient = self.doctor.patient
Redraw the classes Clinic and Patient, and the association between them, to show the fact that patientRef is a unique identifier by using a qualified association.
This question refers to the class model in Figure 1. Suppose we want to implement a use case printPrescription(Patient aPatient) and we have decided that the initial message printPrescription(joanna) will be sent to the Clinic from the user interface. Draw a sequence diagram showing a fork solution, inventing suitable names for the methods required.
In a shared hallway, the light is operated by a press-button switch. Initially, the light is off. Whenever the button is pressed, the light is switched on. As an energy saving measure the light only remains on for 2 minutes after being switched on, then switches itself off again automatically.
Draw a statechart diagram for the hallway light.
Would an object of class A be substitutable for one of class X, without undermining the subtyping relationship? Briefly justify your answer.
No. Class A redefines the sum method to return a value rounded to the nearest whole number, thus sacrificing some accuracy. This will break the contract with a client that is expecting an object of class X and may be relying on the full accuracy being retained.
Would an object of class B be substitutable for one of class X, without undermining the subtyping relationship? Briefly justify your answer.
Yes. Class B adds a method product but leaves the existing sum method unaltered, so that a client expecting an object of class X will be not be affected if an object of class B is used in its place.
State two advantages of separating presentation logic from domain logic.
The advantages of separating presentation logic from domain logic are:
• the business and presentation logic can be tested separately;
• changes to the implementation of the business logic will not affect presentation logic;
• the presentation logic can be varied independently of the business logic.
[any two of these]
In Figure 3, which layer would you expect to be responsible for checking the validity of user input? Briefly explain your choice.
The presentation layer. The validity of input is a user interface issue rather than a business logic issue.
Compare the two code samples below (A and B in Figure 4) using first the lines-of-code (LOC) metric and then the cyclomatic-complexity metric. Which extract do you conclude is the more complex?
Note: we advise that when calculating the cyclomatic complexity, you show your working.
Code sample A:
LOC 5 (6 if the comment is counted)
Cyclomatic complexity: 1 straight-through + 1 for + 1 if + 1 if = 4
Code sample B:
LOC 5 (6 if the comment is counted)
Cyclomatic complexity: 1 straight-through + 1 for = 2
Although the LOC is the same for both samples, A has the higher cyclomatic complexity, suggesting that it is more complex.