Skip to content
Nicholas edited this page Nov 22, 2021 · 26 revisions
  • Introduction: Team Members, Project scope and purpose (TO BE DONE BY LORENZO)

  • Analysis: Major requirements and use cases, Target students (TO BE DONE BY NIKAL)

Design:

Design patterns used: The FileFixer application utilizes two design patterns, namely, the composite design pattern and the iterator design pattern. The composite design pattern was used to create an interface, Individual View code snippet, which defines methods that are fundamental to the functionality of the program that the leaf class View code snippet, Student and the composite class View code snippet, ToRename implements. The Student class allows for Student objects to be created which consists of a particular student's information such as their name, participant ID and student ID. The information that is stored in an instance of the Student object comes from the CSV file that the program requires. The composite class, ToRename is used to store a collection, toRename, that consists of all the names of the files that need to be renamed. The composite class was used as the collection stored in the composite class can be compared to Student objects in order to determine which assignment submission belongs to which student. The second design pattern, the iterator design pattern, is made up of four classes. Namely, the IIterator interface View code snippet, the IContainer interface View code snippet, the FileCollection class View code snippet that implements the IContainer interface and the FileIterator class View code snippet that implements the IIterator interface. The iterator design pattern was used to iterate the collection of file names stored in the composite class. This allows for each file name to be compared against different pieces of information in order for the file to be renamed correctly. The iterator design pattern was also useful as it eliminated the need for multiple for loops in each rename class in order to get the objects from the composte collection.

Conformance to SOLID: The two design patterns used allow the program to conform to SOLID design principles, namely, the Single Responsibility principle as each class has a different responsibility, the Interface Segregation Principle as interfaces as segregated and the Open/Close Principle as interfaces are closed to modification but open to extension.

Class diagram:

Composite Design Pattern Class Diagram Composite Design Pattern Class Diagram

Iterator Design Pattern Class Diagram Iterator Design Pattern Class Diagram

Implementation:

Setup requirements:

  • Place a CSV file that contains student information in the filesToRename folder in the root directory of the program folder. (This folder is created automatically upon running the program)
  • Place files that need to be renamed in filesToRename folder in the root directory of the program folder.

How to run:

  • To run the program, place the program folder, FileFixer, on the Desktop of your machine.
  • Open the program folder in the IDE of your choice and run the main class, FileFixer.java
  • A prompt will appear on the console telling you to place the files you wish to rename as well as your CSV in a folder named filesToRename The filesToRename folder is created automatically upon running the program and is located in the root directory of the program folder
  • After placing the files you wish to rename as well as your CSV file in the filesToRename folder, return to the console and press the ENTER key to start the program. You can also type HELP for the program's help page or EXIT to exit the program.
  • After pressing ENTER to start the program, the program will rename the files in the filesToRename folder and place them in a nested folder in the filesToRename folder named renamedFiles
  • A txt file will also be created in the root directory of the project folder that contains a list of missing submissions as well as flagged submissions.

Testing and Evaluation: Test Cases and Suites, Demo video link: ReaderTest:

  • testLoadCsvData()
  • testLoadDirectoryFiles() StudentTest:
  • testStudentInstantiation()
  • testGetNameOfStudent()
  • testGetIDOfStudent()
  • testGetPIDOfStudent()
  • testGetStudentAttendance()
  • testToStringOfStudentClass() ToRenameTest:
  • testGetToBeRenamedList()
  • testAddToList()
  • testStudentInstantiation()
  • testGetNameOfStudent()
  • testGetIDOfStudent()
  • testGetPIDOfStudent()
  • testGetStudentAttendance()
  • testToStringOfStudentClass()

Clone this wiki locally