Assignment title: Information


SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 1 SIT232 Object-Oriented Development Trimester 1, 2016 Assignment 2: Programming Project 2 Due Date: 5pm Tuesday May 24th Work submitted late without documented approval of the Unit Chair will be penalised. Assignments that are submitted after the submission date will be subject to a mark penalty equal to 10% of the marks per day of the marks available for the piece of work, up to and including three days after the published due date. Assignments submitted more than three days after the published submission date will not be marked. This assessment task must be completed individually, no group work is permitted. All work completed/submitted as part of this assessment task must be your own, individual work. Any content drawn from other materials, including unit materials, must be clearly quoted where appropriate, and/or clearly referenced. All students should review and be familiar with the content provided by the University regarding how to reference other materials: http://www.deakin.edu.au/students/study-support/referencing And in particular the information provided regarding Academy Integrity: http://www.deakin.edu.au/students/study-support/referencing/academic-integrity Unit Learning Outcomes ULO 1 – Apply object-oriented concepts including abstraction, encapsulation, inheritance, and polymorphism. You will be required to demonstrate the correct application of object-oriented concepts including abstraction, encapsulation, inheritance, and polymorphism. ULO2 – Solve programming problems using object-oriented techniques and the C# programming language. You will be required to apply object-oriented techniques in analyzing and modifying an existing C# program. ULO 3 – Modify an existing object-oriented application to satisfy new functional requirements. You will be required to demonstrate the ability to modify an existing application to satisfy new functional requirements. ULO 4 – Construct object-oriented designs and express them using standard UML notation. You will be required to illustrate aspects of the design of the existing application using UML notation. SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 2 Question 1 (20 marks) Objective: The ability to comprehend code written by another person is a critical skill for any programmer. Such code may be poorly written or may involve the application of more advanced concepts that you haven't encountered before. It is also important to be able to work with UML diagrams, the class diagram in particular, which are often used to document the design of an application and/or to specify the design of an application you are developing. Completing this task you will require you to develop and demonstrate your competency in each of these areas. Along with this project specification document you will find a ZIP file containing the provided code for this project (approximately 1400 lines of code). You will need to download and use this code for both questions in this project. Note that how to create a project using these provided files will be addressed in the BB Collaborate session for Week 9, for which you can access a recording in CloudDeakin by clicking into Resources, BB Collaborate, Blackboard Collaborate, then click the Recordings tab. For this task, you are required to prepare a UML class diagram with the following features:  Illustrates the classes representing different users in the system, in particular the User, Admin, Staff, and Student classes; Note: these classes must be fully illustrated, including attributes, properties, methods.  Illustrates any class that have association/aggregation/composition relationships with any of the user classes illustrated in the previous step; Note: you do not need to illustrate the attributes, properties, and methods for these classes, i.e., just show a single box containing the class name using appropriate notation.  Illustrates the relationships between these classes, including any variable names and multiplicity; and  Illustrates the attributes, properties, and methods for all classes (only for the classes representing different users as indicated above). Note: The UML you submit for this question must look like the UML presented in the workbook and lecture slides. Submitting a "class diagram" from Visual Studio will result in a zero mark. Submitting UML using the current Microsoft Visio template (which is modified UML) will result in a 10 mark penalty (50% of maximum marks for this question). You may use the templates/stencils available from http://softwarestencils.com/uml/index.html or can follow the training video in CloudDeakin which shows how to prepare UML class diagrams in Visio without using the template. SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 3 Question 2 (30 marks) Objective: In this task you will be required to demonstrate your mastery / understanding of the unit material by extending the provided code to implement additional functionality. This task focuses on Weeks 7-11 (Unified Modeling Language, Object-Oriented Modeling, Exception Handling, Strings and Regular Expressions, and Files and Generics), however you will also need to apply knowledge from earlier sessions. To complete this task you will need to know how to create objects, establish relationships between them, and work with those objects/relationships to build effective functionality, i.e., to demonstrate you can successfully write code using an object-oriented programming language. Note: This task is a programming task worth 30 marks. If your submitted solution fails to compile and/or run properly you have failed this task and will be penalized 50% of the available marks for this question, i.e., you will lose 15 marks. You are required to implement modifications to the provided code to accomplish the following tasks: a) Encapsulate any exceptions that may occur when reading from/writing to the user database with a custom exception type; b) Change from a text file to binary serialisation for the user database and implement database creation and seeding if no database is found; and c) Implement a new menu option for the administrators to search for a user. Detailed requirements for the above tasks are specified below. In completing these tasks you will need to modify a several classes in the provided code. Any changes however must be restricted to these tasks, i.e., you are not permitted to modify the provided code for your own reasons/ preferences. Substantial unauthorized changes will attract a penalty of 10 marks. Note that the above tasks are mostly independent, however to complete the mechanisms to create and seed the database if the database is absent (part of Task ii), will require the exception encapsulation mechanisms to be complete (Task i). a) Encapsulation of Exceptions Currently the functionality for loading and/or saving of the user database does not consider the possibility of exceptions being thrown, e.g., if the user database does not exist, a FileNotFoundException will be thrown, causing the entire program to terminate as it is never caught or handled. For this task, you are required to: i. Define a new custom exception class UserDBIOException (which inherits from UserDBException), implementing the three constructors indicated as a minimum requirement in the Workbook/Lecture Slides; ii. Catch any exception that occurs during the reading or writing of the user database file; iii. Create a new UserDBIOException object containing an appropriate message and the caught exception object as the inner exception; and iv. Throw the new UserDBIOException object created in the previous step. SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 4 b) User Database Changes Currently the provided code uses a text file to store user information in the following format: ::::[:] The user_type field represents one of 'ADMIN' (for an Admin user type), 'STAFF' (Staff user type), and 'STUDENT' (Student user type). This is followed by four fields for username (or login name), password (in clear text), given name, and family name. For the Staff user type, an additional field representing the department for that staff member is also indicated. For this task you are required to modify the provided code to replace the mechanisms for loading and saving user data with serialization according to the following requirements: i. Binary serialization must be used; ii. The name of the user data file must be changed to "Users.bin"; iii. All users of all types must be correctly saved to, and restored from the file; iv. Define a new method to create a new database and "seed" the database by creating a single new user as follows: Type: Admin Username: admin Password: admin Given Name: Admin Family Name: User Note that you don't create the file at this point, it will be done when the program terminates. v. Adjust the Main method so that it attempts to load the user database, and if that operation fails because the file was not found, invoke the method defined in (iv) to create and seed a new database. If loading the database fails for any other reason, the program should terminate. vi. Adjust the Main method to display an appropriate message if there are any problems loading or saving the user database. The message displayed must indicate the reason for the problem, e.g., file not found, not a generic "operation failed" or similar message. Hint: the inner exception's message will be useful here! vii. All serialization, deserialization, and seeding operations are to be performed from within the UserManager classes, however this class may not read/write any information directly from/to the Console; and viii. All objects representing open files must have their Dispose() method invoked properly, regardless of any exceptions that may occur, e.g., FileStream fs = File.Open(…); … fs.Dispose(); ix. Clean up the program by removing any code that has been made redundant by the above changes. SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 5 c) User Search Function Currently the administrator user has a menu option "Find a user" which allows them to search for a user in the system by specifying their exact login name. You are required to add a new menu option "Search for a user" to provide a more generalised search option (the "Find a user" menu option must remain as is). The requirements for the new search menu option are to: i. Prompt the administrator for text to search for (must not be blank); ii. Perform a case-insensitive search of the list of users in the system, using the specified search text for a sub-string search against the login, given name, and family name fields of each user; iii. Displays the list of matching users, if any (use the ToString() of the user object for this purpose). SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 6 SUBMISSION REQUIREMENTS Please note the following submission requirements:  All classes and interfaces must be stored in separate files, e.g., the SavingsAccount class must be in the SavingsAccount.cs file;  Only C# source files (*.cs) need to be submitted, you do not need to submit the whole Visual Studio solution/project files;  Executable files (*.exe) should not be submitted, your program will be recompiled by the marker;  All files relevant to your answer for each question should be submitted, i.e., you should include a copy of any provided files and/or unmodified files;  You may combine the files for each task into a single ZIP file, however other compressed file formats, e.g., RAR and 7z, will not be accepted (use separate folders if you are submitting multiple questions in one ZIP file);  Further submission instructions are provided in CloudDeakin. SIT232 Object-Oriented Development Due: 5pm Tuesday May 24th Trimester 1, 2016: Programming Project 2 Page 7 MARKING SCHEME Question 1:  4 marks: Notation for classes and interfaces correct;  2 marks: Notation for relationships correct;  2 marks: Notation for abstract elements correct;  8 marks: User hierarchy illustrated correctly (classes, relationships, members, etc.);  4 marks: Related classes and relationships illustrated correctly;  Penalties: o -20 marks: Visual Studio generated class diagram submitted instead of UML; o -10 marks: Visio UML template used instead of accurate UML notation; Question 2: a) Encapsulation of Exceptions:  2 marks: Custom exception class defined correctly;  1 mark: Exceptions correctly caught and encapsulated for loading user database; and  1 mark: Exceptions correctly caught and encapsulated for saving user database b) User Database Changes:  3 marks: All data is correctly saved and loaded as required using binary serialization;  2 marks: Seeding method correctly creates and seeds new user database;  2 marks: Main method correctly identifies file not found error and invokes seeding;  2 marks: Main method displays appropriate error messages for user DB reads/writes;  2 marks: All file operations located in UserManager class which does not use Console;  2 marks: All file objects correctly disposed regardless of exceptions; and  5 marks: All code made redundant by DB changes removed; c) User Search Function:  1 mark: Administrator user (only) presented with option to search for user;  2 marks: Search string is correctly prompted for and applied case-insensitive;  3 marks: Search string is applied as sub-string search against correct fields; and  2 marks: List of matching users displayed appropriately. General:  Penalties: o -10 marks: substantial unauthorized modifications made to code; o -15 marks: program failed to compile or crashed;