c++面向对象

木其工作室 http://www.xmsydw.com

COMPSYS202 / MECHENG270 
Semester Two, 2014 
Project 2 
Due: 24 October 2014 (before 6pm) 
Worth: 20% of Course Mark. 

Introduction 
A team of two software designers are asked to design the software for a Smart Home application 
using Object Oriented design principles covered in the lectures. This project is intended to be 
linked to the learning outcomes specified in the course hanout related to Object Oriented Design. 
Specifically, the following four learning outcomes are addressed: 

 Students will be able to apply the typical OO principles such as Inheritance, association, 
aggregation and encapsulation during the implementation of a small scale project in C++. 
 Students will be able to apply visual notation of UML to describe a real-world problem in an 
object oriented manner. 
 Students will appreciate the difference between requirements and analysis phases for a 
software project. 
 Students will be able to apply a widely used software design pattern called the model-view-
controller (MVC) pattern during their OO analysis. 
Description 
This project is comprised of two parts: System Design and System Implementation. System Design 
contains the functional specification of the system by describing the scenarios, use cases, object 
model and dynamic models. While the implementation of the designed system, using C++ code, is 
covered in part 2. 
Part 1 – System Design 

Among the activities involved in system design, the following will be covered in this project: 
 Scenarios identification. 
 Use cases and actors identification. 
 Object model identification. 
 Dynamic model identification. Scenarios and use cases comes under the requirements phase, while object and dynamic models 
cover the analysis phase of our software project. An identified scenario is given to you, and your 
task is to perform the other three activities around this scenario. 
Scenario identification: 
A scenario is a concrete, informal description of a single feature of the system from a single actor’s 
viewpoint. A scenario for our SmartHome system is given below. In this scenario, the owner of 
SmartHome remotely operates a device in one of the rooms of SmartHome. Note that this scenario 
only describes a single instance. It does not list all possible ways to interact with a device, nor does 
it contain a description of decisions (like alternate paths, error conditions). 
Scenario Name: OperateADeviceInSmartHome 
Participating Actor: Adam: The Owner of SmartHome 
Flow of Events 1- Adam is the owner of SmartHome, and wants to remotely operate the devices in 
SmartHome. 
2- He can access any of the devices using a user interface (UI). 
3- Upon startup, the UI shows a welcome message to Adam. 
4- He is then given a choice to traverse to any of the floors in SmartHome. 
5- Adam selects the ground floor. 
6- The UI then asks Adam to select a room, either Garage or Lobby. 
7- Adam selects Lobby. 
8- The UI displays the list of devices in the Lobby, and again asks Adam to select a device. 
9- Adam opts for bulb. 
10- The next menu is about the three options to operate a device (the window in this 
case): (i) Power management, (ii) Check Status, and (iii) Execute Command. 
11- Adam selects the option Power Management. 
12- He gets a message that the window is currently powered off, and whether he wants it 
to be turned on. 
13- Adam turns on the device, and gets back to the device menu. 
14- This time he selects the second option, i.e., Check Status of the window. 
15- The UI shows a detailed status of the window to Adam. 
16- The details include power status, online status, whether it is safety enabled or not, 
whether it is text enabled or not, whether it can execute command or not. 
17- If the device is text enabled and/or command enabled, the text status and/or range or 
supported commands numbers are also displayed. 
18- After reading the status, he goes back. 
19- If the device is command enabled, Adam selects the third option. 
20- A range of supported commands is displayed. 
21- Adam selects the desired command to achieve desired behavior. 
22- Adam goes back to the device menu. 
23- Adam goes back to the main menu. 






Use cases and Actors identification: 
A scenario represents a concrete situation, while a use case represents a general case. 
Generalizing the above scenario into a use case would result in a very large use case. Thus, your 
task is to split the scenario into self-contained and independent use cases. In other words, you 
need to consolidate the related functionality into single use cases, and split unrelated behaviour 
into several use cases. 
For this part of the project, you are required to 
 Identify and describe some use cases. You are free to add as many use cases as you want, 
including three mandatory use cases: PowerManagement, CheckStatus, and 
ExecuteCommand. 
 Identify the relationships among the use cases. 
 Identify the actor(s) and their interaction(s) with the use case(s). 
 Draw a detailed use case diagram that shows all the use cases, their relationships, and the 
interacting actors. 
 Use the following template to describe each of the use cases: 
Use Case Name 
Participating Actors 
Entry Condition 
Exit Condition 
Flow of Events 

Object model identification: 
Object model emphasizes on the individual concepts that are manipulated by the system along 
with their properties and their relationships. The object model is usually depicted with UML class 
diagrams and include classes, attributes and operations. Your task in this section is to perform the 
following activities: 
 Identify Entity objects, Boundary objects and Control Objects. 
 Identify the properties or attributes of individual objects. 
 Identify relationships among the objects (association, aggregation/composition, 
inheritance). 
 Draw a detailed class diagram that depicts all of the above identifications. 

Dynamic model identification: The dynamic model focuses on the behaviour of the system, and is typically represented via 
sequence diagrams and via state machines. A sequence diagrams shows the interactions among a 
set of objects during a single use case. Your task here is to draw sequence diagrams for each of the 
use cases. That means, you will be essentially mapping the use cases to objects with sequence 
diagrams. 
Part 2 – System Implementation 

In this part, you are required to implement your designed system using C++ code. You will be 
using the identified objects (Entity, Boundary and Control) to apply MVC pattern in this activity. 
Like Project 1, a working system with a limited set of features is given, and your task is to 
complete the system by adding the missing code. A model solution is also given to you as an 
executable binary file (modelSolution.exe), so that you can match your functionality with the 
desired solution. 
Instructions 
 Download the project pack, “Project2.zip” from Cecil, and unzip the files. 
 Run the simulator using the instructions given in the file RunSimulator. 
 Open up a command line terminal, and change the terminal's working directory to the 
Project2 folder. 
 Type make to compile the source code. 
 Type ./release/assign2.exe to run the program. You would see the welcome message and 
a menu on your terminal. 
 Your task is to complete the system implementation by adding new program files using 
MVC pattern. For example to implement functionality of a room, you would require three 
files: RoomManager, RoomModel and RoomUI. 
 You can execute the model solution by typing ./release/modelSolution.exe. This is a 
complete solution, and you may use this as a guide to your project. 

Marking Details 
Smart Home Control System 100 Marks 

Use cases and actors identification. Use case descriptions. Use case Diagram. 20 
Object model identification. Class Diagram. 20 
Dynamic model identification. Sequence Diagrams 20 
System implementation using MVC pattern 35 
Declaration and feedback page at the end of this doc. (One pdf scan for each student) 05 Typical Reasons to Lose Marks 
When marking, we will give each project a small amount of time to get it running and test it. 
Occasionally people will submit something that doesn't work immediately and the marker has to 
spend some time trying to fix it. While it wouldn't be fair to give you 0 marks because you had a 
typo stopping an otherwise good program from running, it's also not reasonable to expect the 
markers to spend hours debugging your projects to get them to run well enough to assess fairly. 
The following are examples of things people have done which make fair marking very difficult. 
 Program does not compile at all. 
 Program doesn't work on Linux, seems to have been written on Windows. 
 Commenting was really poor; we couldn't work out how to fix the bug stopping it from 
working. 
Submission 
You should submit a .zip file to the assignment dropbox before the deadline. We will post the link 
to the dropbox on Cecil two weeks prior to the deadline. Make sure that you name the .zip file 
with your own studentUPI and your team mate’s studentUPI separated with a dash. The following 
is an example of a submission with the expected name and contents. 

xav023-trb576.zip 

 A zip file containing the code for your project2 (i.e. all CPP and HPP files and the modified 
‘Makefile’) – don’t submit SHAPI and SHSIM folders. 
 All use cases, object (state) diagrams and dynamic diagrams in quality pdf format. 
 Scan of next page with your signature in the declaration, one for each student (make sure 
that the scan is clear enough to read). 

Important Points about Submission 
1- There will be only one submission per group, with the naming convention thereof. 
2- The dropbox will remain open until 24 hours after project deadline. However, late submissions 
will incur penalties as follows. 
 Late submissions until 12 hours after deadline incur 20% penalty 
 Late submissions until 24 hours after deadline incur 50% penalty 
3- All contents of your assignment must be submitted at the same time in one submission. 
Otherwise, the most recent submission will override the previous ones. 
4- Excuses regarding late submissions, or submitting wrong contents won’t be accepted! 
5- Each student will evaluate their project partners via peer review forms. The peer review forms 
must be kept confidential, and will be submitted to a different dropbox. We will provide you 
with the forms and more information regarding the dropbox later. 

Declaration 
I am aware of and understand the University’s policy on plagiarism and I certify that this 
assignment is my own work. In addition, I understand that any false claim in respect of this work 
will result in disciplinary action in accordance with University regulation. 

Name: .................................................................... UPI: ..................................... Uni ID: ............................................. 
Sign: ......................................................................................................................... Date: ................................................ 

Feedback 
Please provide us your feedback on this assignment. Note that this section is not compulsory. 

1. How much time did the assignment take overall? 
....................................................................................................................................................................................................... 
2. What areas of the assignment did you find easy? 
....................................................................................................................................................................................................... 
3. What areas of the assignment did you find difficult? 
....................................................................................................................................................................................................... 
4. Which topics of the course did the assignment most help you understand? 
....................................................................................................................................................................................................... 
5. Any other comments: 
.......................................................................................................................................................................................................

你可能感兴趣的:(面向对象)