Case Studies for Exam Preparation:
Question.
Give two examples of information about a problem domain that can be captured in UML Activity Diagrams, and two ways in which these diagrams can be useful for Requirements Analysis.
Answer:
Examples of info represented:
Draw a UML Class Diagram representing the following elements from the problem domain for a hockey league. A hockey league is made up of at least four hockey teams. Each hockey team is composed of six to twelve players, and one player captains the team. A team has a name and a record. Players have a number and a position. Hockey teams play games against each other. Each game has a score and a location. Teams are sometimes lead by a coach. A coach has a level of accreditation and a number of years of experience, and can coach multiple teams. Coaches and players are people, and people have names and addresses. Draw a class diagram for this information, and be sure to label all associations with appropriate multiplicities.
Answer:
Notes: Captain could alternatively be represented as a second, named association between player and team. Assumptions: each player only plays on one team, each captain only captains one team, each team only plays in one league.
Question.
Do you know that it costs a lot of money to get a ’Certified Java Programmer’ certificate? It could cost you thousands of euros. Let’s say we will create a browser-based training scheme to support people to get ready for a certification exam. A user can appeal a quiz for the system. The system chooses a collection of questions from its database, and constitutes them together to create a quiz. It charges the user’s answers, and provides hints if the customer desires it.
Additionally, we also have professors who deliver questions and tip-offs. And similarly examinators who must declare problems to make sure they are not also trivial, and are sensical. Draw a use case diagram to create this classic system. Work out more or less of your use cases. As we don’t have real stake holders now, you are allowed to fill in facts you think is sensical for this case.
Answer:
We’ll assume multiple choice quiz.
Use case: Make quiz.
Primary actor: User
Secondary actors: Pre-condition: The system has at least 10 questions.
Post-condition:
Main flow:
1. The use-case is activated when the user requests it.
2. The user specifies the difficulty level.
3. The system chooses 10 questions, and proposes them as a quiz to the user.
4. The system starts a regulated timer.
5. For every question: 5a. The user selects an answer, or skip. [Extension point]
6. If the user has done the quiz, or the timer turns out, the quiz is finished.
Use case: Provide hint
Primary actor: User
Secondary actors: Pre-condition: The user requests for a hint. Post-condition:
Main flow:
1. The system provides a hint. The verbosity of the hint is determined by the difficulty level set previously by the user.
2. Return to to Make quiz’ main flow.
Question.
Suppose we want to develop software for an alarm clock. The clock shows the time of day. By means of buttons, the user can customize the hours and minutes fields independently, and choose among 12 and 24-hour display. It is possible to set one or two alarms. When an alarm fires, it will sound some noise. The user can turn it off, or choose to ’snooze’. If the user does not answer back at all, the alarm will turn off itself later after 2 minutes. ’Snoozing’ means to turn off the sound, but the alarm will ring again after few minutes of delay. This ’snoozing time’ can be pre-adjusted.
Identify the top-level functional requirement for the clock, and model it with a use case diagram.
Answer:
Use case: Snooze.
Primary actor: User
Secondary actors: Pre-condition: An alarm is firing.
Post-condition: Main flow:
1. The use-case is activated when the user hits the snooze button.
2. The alarm is turned off.
3. Wait for snooze time.
4. Include use case ’Make sound’
Use case: Make sound
Primary actor: System
Secondary actors: Pre-condition:
Post-condition:
Main flow: The use case starts when it is called.
What it does is to just make some noisy sound.
Question.
Draw an UML state diagram corresponding to the computer keyboard state machine. Also draw an extended state diagram to model the behavior of the keyboard which depends on the number of characters typed on it so far and that after, say, 1,000 keystrokes, the keyboard breaks down and enters the final state.(Assume normal function of the key board of a personal computer which you use regularly)
Answer:
state diagram representing the computer keyboard state machine
Question.
The Gang of Four says that the intent of the Adapter pattern is to "change the interface of a class into another interface that the clients expect. Adapter lets classes work together with each other that could not otherwise as of mismatched interfaces."
What does this imply? Give an example.
Answer:
This says that I have a class that desires to interact with a different class through a assured set of method calls. When the interface of that different class does not offer these method calls, the Adapter creates up a fresh interface to do the interpretation. For instance a reporting application that wishes to pull data from two diverse database systems. My application needs to use a "GetDate" method to attract info from the database, but the database systems don't deliver that through their API. Therefore I write an Adapter that gives the GetDate method in its interface and is accountable for pulling the data appropriately.
Question.
The Façade pattern and the Adapter pattern may seem similar. What is the essential difference between the two? Explain with an example.
Answer:
In both circumstances, there is a pre-existing class or classes that have functionality needed. So for both cases, I build an intermediate object with interfaces that my system needs to use and that has duty for mapping that to the pre-existing class. Equally Façade and Adapter are wrappers. The Adapter is used when our client previously has predefined interfaces that it believes to use and when I want to practice polymorphism.
Question.
Give two examples of information about a problem domain that can be captured in UML Activity Diagrams, and two ways in which these diagrams can be useful for Requirements Analysis.
Answer:
Examples of info represented:
- Activity diagrams show how tasks depend on one another in a business process. For example, they can show that some tasks can be carried out in parallel, while other tasks have to be synchronized so that one doesn’t start until the tasks on which it depends are complete.
- Activity diagrams show the flow of activity between different business units, using swimlanes. In other words, they show how different business units must work together to carry out some process.
- To understand the existing business processes, showing how an organization currently solves the problem.
- For sketching proposed solutions to the stakeholders to show how a proposed solution would change the way in which the organization works.
Draw a UML Class Diagram representing the following elements from the problem domain for a hockey league. A hockey league is made up of at least four hockey teams. Each hockey team is composed of six to twelve players, and one player captains the team. A team has a name and a record. Players have a number and a position. Hockey teams play games against each other. Each game has a score and a location. Teams are sometimes lead by a coach. A coach has a level of accreditation and a number of years of experience, and can coach multiple teams. Coaches and players are people, and people have names and addresses. Draw a class diagram for this information, and be sure to label all associations with appropriate multiplicities.
Answer:
Notes: Captain could alternatively be represented as a second, named association between player and team. Assumptions: each player only plays on one team, each captain only captains one team, each team only plays in one league.
Question.
Do you know that it costs a lot of money to get a ’Certified Java Programmer’ certificate? It could cost you thousands of euros. Let’s say we will create a browser-based training scheme to support people to get ready for a certification exam. A user can appeal a quiz for the system. The system chooses a collection of questions from its database, and constitutes them together to create a quiz. It charges the user’s answers, and provides hints if the customer desires it.
Additionally, we also have professors who deliver questions and tip-offs. And similarly examinators who must declare problems to make sure they are not also trivial, and are sensical. Draw a use case diagram to create this classic system. Work out more or less of your use cases. As we don’t have real stake holders now, you are allowed to fill in facts you think is sensical for this case.
Answer:
We’ll assume multiple choice quiz.
Use case: Make quiz.
Primary actor: User
Secondary actors: Pre-condition: The system has at least 10 questions.
Post-condition:
Main flow:
1. The use-case is activated when the user requests it.
2. The user specifies the difficulty level.
3. The system chooses 10 questions, and proposes them as a quiz to the user.
4. The system starts a regulated timer.
5. For every question: 5a. The user selects an answer, or skip. [Extension point]
6. If the user has done the quiz, or the timer turns out, the quiz is finished.
Use case: Provide hint
Primary actor: User
Secondary actors: Pre-condition: The user requests for a hint. Post-condition:
Main flow:
1. The system provides a hint. The verbosity of the hint is determined by the difficulty level set previously by the user.
2. Return to to Make quiz’ main flow.
Question.
Suppose we want to develop software for an alarm clock. The clock shows the time of day. By means of buttons, the user can customize the hours and minutes fields independently, and choose among 12 and 24-hour display. It is possible to set one or two alarms. When an alarm fires, it will sound some noise. The user can turn it off, or choose to ’snooze’. If the user does not answer back at all, the alarm will turn off itself later after 2 minutes. ’Snoozing’ means to turn off the sound, but the alarm will ring again after few minutes of delay. This ’snoozing time’ can be pre-adjusted.
Identify the top-level functional requirement for the clock, and model it with a use case diagram.
Use case: Snooze.
Primary actor: User
Secondary actors: Pre-condition: An alarm is firing.
Post-condition: Main flow:
1. The use-case is activated when the user hits the snooze button.
2. The alarm is turned off.
3. Wait for snooze time.
4. Include use case ’Make sound’
Use case: Make sound
Primary actor: System
Secondary actors: Pre-condition:
Post-condition:
Main flow: The use case starts when it is called.
What it does is to just make some noisy sound.
Question.
Draw an UML state diagram corresponding to the computer keyboard state machine. Also draw an extended state diagram to model the behavior of the keyboard which depends on the number of characters typed on it so far and that after, say, 1,000 keystrokes, the keyboard breaks down and enters the final state.(Assume normal function of the key board of a personal computer which you use regularly)
Answer:
state diagram representing the computer keyboard state machine
Question.
The Gang of Four says that the intent of the Adapter pattern is to "change the interface of a class into another interface that the clients expect. Adapter lets classes work together with each other that could not otherwise as of mismatched interfaces."
What does this imply? Give an example.
Answer:
This says that I have a class that desires to interact with a different class through a assured set of method calls. When the interface of that different class does not offer these method calls, the Adapter creates up a fresh interface to do the interpretation. For instance a reporting application that wishes to pull data from two diverse database systems. My application needs to use a "GetDate" method to attract info from the database, but the database systems don't deliver that through their API. Therefore I write an Adapter that gives the GetDate method in its interface and is accountable for pulling the data appropriately.
Question.
The Façade pattern and the Adapter pattern may seem similar. What is the essential difference between the two? Explain with an example.
Answer:
In both circumstances, there is a pre-existing class or classes that have functionality needed. So for both cases, I build an intermediate object with interfaces that my system needs to use and that has duty for mapping that to the pre-existing class. Equally Façade and Adapter are wrappers. The Adapter is used when our client previously has predefined interfaces that it believes to use and when I want to practice polymorphism.
No comments:
Post a Comment