COMP2404 -“Introduction to Software Engineering”
Assignment 3
1 Submission Instructions Submit to Brightspace on or before the due date a compressed file (.tar or .zip) that includes
- Header and source files for all classes instructed below.
- A working Makefile that compiles and links all code into a single executable. The Makefile should be specificto this assignment - do not use a generic Makefile.
- A README file with your name, student number, a list of all files and a brief description of their purpose,compilation and execution instructions, and any additional details you feel are relevant.
2 Learning Outcomes In this assignment you will learn to
- Add functionality to an existing codebase.
- Change a class implementation while keeping the same interface
- Make a UML diagram to illustrate the interaction between classes.
- Implement copy constructors that use deep copy, while properly managing all dynamic memory.
- Implement proper encapsulation (using the const keyword where appropriate)
VERY IMPORTANT!!! YOU WILL LOSE MARKS IF YOU DO NOT CONST YOUR FUNC
TIONS AND PARAMETERS!!!.
3 Overview This is a continuation of the GetHub project from assignment 2. As a starting point, you may use your own assignment,or use the code provided.In addition to changing existing classes, you will implement a Client class that can “download” (i.e., make adeep copy of) a Repo, and then print the Files it contains.As before there is a Control class that connects and coordinates the functionality of your classes with a Viewclass. In addition there is a separate TestControl class that allows you to run tests.You will be required to make a UML diagram of the completed project.
4 UML Diagram
Make a UML diagram of the completed project. You may omit the Control, TestControl, Tester, and View classes.A partial UML diagram is provided to help you get started. It includes the “uses” notation, which we did not discuss
in class, but this is the only place in the diagram where this particular notation should appear.COMP2404 -“Introduction to Software Engineering”
Assignment 3
GetHub
// add, remove, get
+ addRepo(in title: string, in owner: string)
+ deleteRepo(in index: int)
+ getNumRepos(): int
+ download(in index: int, out repo: Repo): bool
+ addFile(in repo: string, in title: string, in content: string, in date: Date)
+ addFile(in repo: int, in title: string, in content: string, in date: Date)
+ deleteFile(in repo: int, in file: int)
+ printRepos()
+ printRepo(in index: int)
+ printFileContents(in repoIndex: int, in fileIndex: int)
Client
+ cloneRepo(in getHub: GetHub, in index: int)
+ printRepo ( )
+ printFileContents(in index: int)
usesCOMP2404 -“Introduction to Software Engineering”
Assignment 3
5 Classes Overview
This application will consist of 11 classes. Ten classes are provided: these are the same classes from Assignment 2.
You will add another class and make changes to some of the existing classes.
- The Date class (Entity object):(a) Contains date information.The File class (Entity object):
(a) Contains information about the File (name, content, last date modified)
- The Repo class (Entity object):(a) Contains information about the Repo (title, owner)(b) Manages a collection of Files
- The FileList class (Collection object):
(a) Data structure for File pointers.
- The RepoList class (Collection object):
(a) Data structure for Repo pointers.
- The GetHub class (Control, Collection, View object):
(a) Manages a collection of Repos.
(b) Provides services to add, delete, access, and print Repos and the Files in the Repos.
(c) Prints (error) messages to std::cout
- The View class (Boundary object):
(a) Presents a menu, takes input from the user
- The Control class (Control object):
(a) Manages the interaction of the other objects.
- The TestControl class (Control object):
(a) Manages the interaction of the other objects in order to run tests.
- The Tester class (???):
(a) Provides testing functionality.
We will be using std::cout as the main output object for error reporting.COMP2404 -“Introduction to Software Engineering”
Assignment 3
6 Instructions
Download the starting code from Brightspace. It includes some global functions that you are to use for testing as
well as some classes. All member variables are private unless otherwise noted. All member functions are public
unless otherwise noted. Some return values are not explicitly given. You should use your best judgment (they will
often be void, but not always). ALL CLASSES MUST HAVE A PRINT FUNCTION (except for FileList and
RepoList). This print function should display the metadata of the class using appropriate formatting.our finished code should compile into two executables called a3 and a3test using the command make all orsimply make. The Makefile is provided for you. Your submission should consist of a single zip file with a suitable
name (e.g., assignment2.zip) that contains a folder containing all your files. This folder should also contain a
README with your name, student number, a list of all files that are included, a directory structure (if applicable),compiling and running instructions, and any other information that will make the TAs life easier when they mark
your assignment.Below are the changes you should make to the existing project. Section 6.1 should be applied to all classes.
6.1 Encapsulation
You should apply the const keyword to existing classes wherever possible. That means any function that can be madeconst should be, and any parameter that can be made const should be. The only exceptions are (Test)Control,
Tester, and View classes - you do not need to apply const to these classes.
VERY IMPORTANT!!! YOU WILL LOSE MARKS IF YOU DO NOT CONST YOUR FUNC
TIONS AND PARAMETERS!!!.
6.2 The File Class We are going to modify the lessThan function, and add an equals function.
- Adjust the lessThan() function so that it returns true if this File’s name comes before the parameter’s namein alphabetical order. If the two names are equal (i.e., it is the same File) then order them as defined byDate::lessThan using the lastModified parameter.
- Make an equals() function that returns true if the name and the Date are equal (you do not have to comparethe content).
6.3 The Repo Class
You should add a copy constructor to the Repo class that does a deep copy of all data. Be sure to add any other
functions that you require, here or in other classes, to correctly manage your memory.
6.4 The List Classes Modify FileList and RepoList so that they are both implemented using DOUBLY LINKED LISTS. You shouldkeep the same interface (public functions defined in the header), and the functions should do the same jobs as before(except for isFull, detailed below).Observe that once you change the implementation, everything should work exactly as before. That means allthe tests will pass whether you change these classes or not. But a TA will check and deduct or award marks asappropriate. There is an additional change detail below.
- FileList and RepoList:(a) Have isFull() always return false.COMP2404 -“Introduction to Software Engineering”
Assignment 3
(b) As a reminder, FileList should add Files in the order defined by File::lessThan, while RepoListshould add Repos to the back of the list.
6.5 The Client Class
Make a Client class. Refer to the UML diagram for function specifications. As in the GetHub class, when anoperation fails, be sure to send an appropriate error messageto cout.
- Member variables:a) A Repo pointer. This is the current Repo that the Client is working with.
- The constructor should initialize all member variables appropriately (you should set your pointer to nullptrto start with).
- The destructor should delete all dynamically allocated memory reachable by this class.
- cloneRepo: cloneRepo should make a deep copy of the GetHub Repo at the given index, and store the addressin your Repo pointer.
- printRepo: call Repo::printFiles on the stored Repo, or give an error message if the Repo pointer is null.
- printFileContents(int index): Call printContents on the File stored at the given index.
6.6 The Control Class
This class controls the interactions between the View, GetHub, and Client classes. Most of it has been done for you.You should add a Client class, and complete downloadRepo(), printClientRepo() and printClientFileContent().
6.7 The TestControl Class
This class has been done for you. It interacts with your classes and the View to run a series of tests and output yourmark.The old tests are provided for convenience. They may not work properly until you const your classes. You get5 marks if the old tests still work after you have made your modifications.In addition there are 2 new tests for the Client class worth 10 marks each.
6.8 The View Class
This class has been done for you. It interacts with the user and returns values to the control object
6.9 The main.cc and test.cc Files These have been done for you. main.cc is compiled into an executable a3 using the Control class. test.cc iscompiled into an executable a3test using the TestControl and Tester classes. The a3 executable lets you interactwith your application from a user’s perspective. The a3test executable runs tests and gives you your mark.
7 Grading
The marks are divided into three main categories. The first two categories, Requirements and Constraints are
where marks are earned. The third category, Deductions is where you are penalized marks.COMP2404 -“Introduction to Software Engineering”
Assignment 3
7.1 Specification Requirements These are marks 代写COMP2404 Introduction to Software Engineering for having a working application (even when not implemented according to the specification, withinreason). The test suite will automatically allocate the marks, though they can be adjusted by the marking TA ifsome anomaly is found.
General Requirements
- All marking components must be called and execute successfully to earn marks.
- All data handled must be printed to the screen to earn marks (make sure the various print functions print
useful information).
Application Requirements: With the exception of the memory leaks marks (Part 6), these marks are generatedby the a3test executable. Part 5 will be tested by a TA by running the individual tests in the a3test executablewith valgrind.(5 marks):(a) RepoList test(b) GetHub Repo test(c) GetHub File test
- (10 marks): Client cloneRepo test
- (10 marks): Client memory test
- (10 marks, 5 marks each) FileList and RepoList are Doubly Linked Lists.
- (4 marks): Tests 2 and 3 should pass with no memory leaks or other memory faults (2 marks per test)
- (6 marks total) Control functions
(a) (2 marks) downloadRepo
(b) (2 marks) printClientRepo
(c) (2 marks) printClientFileContent
- (5 marks) UML diagram
Requirements Total: 50 marks
7.2 Constraints The previous section awards marks if your program works correctly. In this section marks are awarded if yourprogram is written according to the specification and using proper object oriented programming techniques. Thisncludes but is not limited to:
- Apply “const”-ness to your program.
– Print statements, getters, and any member function that does not change the value of any member variablesshould be const.– Any parameter object (passed by reference) that will not be modified should be const.
- Proper declaration of member variables (correct type, naming conventions, etc).COMP2404 -“Introduction to Software Engineering”
Assignment 3
- Proper instantiation of member variables (statically or dynamically)
- Proper instantiation of objects (statically or dynamically)
- Proper constructor and function signatures.
- Proper constructor and function implementation.
- Proper use of arrays and data structures.
- Passing objects by reference or by pointer. Do not pass by value.
- Reusing existing functions wherever possible within reason. There are times where duplicating tiny amounts
of code makes for better efficiency.
- Proper error checking - check array bounds, data in the correct range, etc.
7.2.1 Constraints: 10 marks
- 2 marks: Proper implementation and const-ing of the File class.
- 2 marks: Proper implementation and const-ing of the List classes.
- 2 marks: Proper implementation and const-ing of the Repo class.
- 2 marks: Proper implementation and const-ing of the GetHub class.
- 2 marks: Proper implementation and const-ing of the Client class.
Constraints Total: 10 marks
Requirements Total: 50 marks
Assignment Total: 60 marks
7.3 Deductions
The requirements listed here represent possible deductions from your assignment total. In addition to the constraintslisted in the specification, these are global level constraints that you must observe. For example, you may only useapproved libraries, and your programming environment must be properly configured to be compatible with the virtualmachine. This is not a comprehensive list. Anyrequirement specified during class but not listed here must also beobserved.
7.3.1 Documentation and Style
- Up to 10%: Improper indentation or other neglected programming conventions.
- Up to 10%: Code that is disorganized and/or difficult to follow (use comments when necessary).COMP2404 -“Introduction to Software Engineering”
Assignment 3
7.3.2 Packaging and file errors:
- 5%: Missing README
- 10%: Missing Makefile (assuming this is a simple fix, otherwise see 4 or 5).
- up to 10%: Failure to use proper file structure (separate header and source files for example), but your programtill compiles and runs
- up to 50%: Failure to use proper file structure (such as case-sensitive files and/or Makefile instructions) thatresults in program not compiling, but is fixable by a TA using reasonable effort.
- up to 100%: Failure to use proper file structure or other problems that severely compromise the ability tocompile and run your program.As an example, submitting Windows C++ code and Makefile that is not compatible with the Linux VM wouldfall under 4 or 5 depending on whether a reasonable effort could get it running.
7.3.3 Incorrect object-oriented programming techniques:
- Up to 10%: Substituting C functions where C++ functions exist (e.g. don’t use printf or scanf, do use coutand cin).
- Up to 25%: Using smart pointers.
- Up to 25%: Using global functions or global variables other than the main function and those functions andvariables expressly permitted or provided for initialization and testing purposes.
7.3.4 Unapproved libraries:
- Up to 100%: The code must compile and execute in the default course VM provided. It must NOT requireany additional libraries, packages, or software besides what is available in the standard VM.
- Up to 100%: Your program must not use any classes, containers, or algorithms from the standard templatelibrary (STL) unless expressly permitted.