Reference no: EM133296951
Aim:
You are provided with a non-object-oriented program and are required to develop an object-oriented design for this program, with a clearly reasoned argument for the details of the design. You are then required to refactor the given code according to this design. The written report forms the main basis of assessment.
Learning Outcome 1: Select appropriate design notations, software development environments and programming languages.
Learning Outcome 2: Read and understand object-oriented design documentation.
Learning Outcome 3: Make effective use of technical documentation.
Learning Outcome 4: Develop programs using the object-oriented approach.
Learning Outcome 5: Effectively plan the development of a practical project from design to implementation.
Assignment Specification
Aim
You are provided with a non-object-oriented program and are required to develop an object-oriented design for this program, with a clearly reasoned argument for the details of the design. You are then required to refactor the given code according to this design. The written report forms the main basis of assessment.
Details
This assignment concerns applying the basic principles of object-oriented programming to rewrite an existing non-object-oriented program.
You are provided with a Java program implemented in a single file (Application1.java). This program is intended to be used to organise collections of photographs and/or videos according to their dates. In order to determine the date for a given file, three techniques are supported:
1. Reading the embedded EXIF metadata (if there is any) to determine the original date of the photograph.
2. Examining the filename to see if any unambiguously recognisable date string can be found (for example rosegarden-21.Jan.2020.jpg).
3. Using the timestamp of the file.
The program allows you to use any or all of these techniques on a folder-by-folder basis, but if more than one technique is used they will always be tried in the order given above.
The program's inputs are as follows:
• a list of target folders containing photographs and possibly sub-folders containing photographs
• for each target folder, parameters that control whether the folder should be scanned recursively (entering into the sub-folders) or not, and which techniques should be used to determine the dates of the files (read the embedded EXIF metadata / parse the filename for a date string / use the file timestamp)
• an output folder to move the photographs to
• parameters to control the tree of folders to be created, that can consist of any combination of year folders, year-month folders, and year-month-day folders
• a simulation flag that determines whether the program will actually move the files (if simulation = false) or just print out the moves it would have made (if simulation = true).
You are provided with a ZIP archive containing a couple of folders of images to run the program on. When running the program you should do the following:
1. Extract the images from the ZIP file to a location of your choice (say C:\Users\yourname\oop).
2. Edit the main method of the program so that the commonParent variable is set to point to the place you put the image folders (for example C:\Users\yourname\oop).
3. Run the program in simulation mode first, to see what it is going to do (when testing you should probably stay in simulation mode most of the time).
4. Run the program for real and see if the PhotoOrganiserOutput folder is correctly created with a date based tree of folders inside it containing the organised pictures.
Note that after running the program for real, you no longer have your input folders with images in to use again. You will need to delete the PhotoOrganiserOutput folder and re- extract the images from the ZIP file to run the program again.
Your Task
You are required to analyse the existing application for the purpose of refactoring it into an object-oriented design. In order to understand the program you may need to refer to technical documentation such as the Java language APIs or online tutorials.
You must identify potential classes that could be used to improve the code and make it object-oriented. You should discuss your thinking and give reasons for why you think each class would be beneficial. How many classes are required or useful is up to you, and will be affected by your design decisions, but it is suggested that four or five might be typical, although it might be more if polymorphism is employed as part of your design.
You are encouraged to describe multiple different approaches to the organisation of classes in your design discussion but you should settle on a single set of classes as your final proposal.
You should depict your design proposal using a UML class structure diagram, but this diagram should only be used to illustrate your written description of the design. The diagram by itself is not enough and will gain little credit.
You should then refactor the provided code into the classes you have described. You should then describe this code as part of your report, including the relevant code in the body of your report as you describe it. The code should be presented clearly legibly using a fixed- width font, proper indentation and single spaced lines.
The final version of the program should also be uploaded as the source files in their appropriate package folders packed into a zip file. To do this, you should typically pack the main src folder of your IDE's project into a zip file.