Reference no: EM132867080 , Length: word count:2500
CSI-5-ADP Advanced Programming - London South Bank University
Demonstrate understanding of the module subject matter and the ability to apply it, including critical analysis and judgement. To achieve this, you are provided with an example application that must be analysed and assessed, and then enhanced to add additional functionality and parallel execution.
Learning Outcome 1: Demonstrate an understanding of software development using a variety of software engineering techniques.
Learning Outcome 2: Critically evaluate the quality of a software artefact.
Learning Outcome 3: Use sources of information to improve your knowledge and understanding.
Learning Outcome 4: Develop multi-threaded applications.
Learning Outcome 5: Effectively plan the development of a practical project from design to implementation.
Advanced Programming Coursework Assignment
Introduction
You are provided with a working application that searches a raster of elevation data for regions of relative flatness. The raster is an image in which each pixel represents an elevation (height) for a point on the terrain1. This application could be imagined to be searching for potential landing sites for an aircraft or spacecraft of some kind.
Provided files:
• adpelevation.jar - this is a Java archive that should be added to your project as a library (seek advice from your tutor if unable to do this). It contains classes that you will not need to modify, but you will need to extend classes and implement interfaces from within it. For your assistance, the source code of all files is contained in the jar for you to inspect.
• Folder rgbelevation containing bigelevation.png and smallelevation.png - these images contain elevation data encoded in the RGB colour value of each pixel.
• src/adp/image/Demo.java - a command line-based searcher program to compile and run
• src/adp/image/ui/SearchUI.java - a UI-based searcher program to compile and run
• javadocs - a set of HTML JavaDoc files for all provided classes
Compile and run Demo and experiment with searching for flat regions of each of the terrain elevation maps by editing the filename variable in the main method.
Now run the provided SearchUI application, and again search each of the terrain maps for flat regions. The smaller map is searched very quickly and the larger one will take a bit longer.
Report Deliverable 1: Comparative Analysis
Give a written comparative analysis of the characteristics and behaviour of Demo and SearchUI, identifying the functional differences between them. In doing so, pay particular attention to the following:
• The display of progress the program has achieved over time as it runs
• The ability of the user to cancel the operation (with and without terminating the program)
• The threads of execution involved in each program and how they determine the behaviour You should explain the characteristics of the programs in terms of the threads of execution being used, by explicit reference to the source code.
Report Deliverable 2: SearchUIEnhancement and commentary
Develop an application that looks like SearchUI but differs in the following ways:
1. It is called SearchUIEnhancement
2. It runs the search on a dedicated worker thread so that the UI is not frozen
3. It displays output from the program in the text area as it is produced
4. The user can cancel the operation and quit the program by closing the window
5. The user can cancel the operation without quitting the program by means of an additional cancel button
6. The UI has an additional progress bar that is updated once every second by a dedicated thread that monitors the progress of the Searcher object.
Note that for full functionality and thread-correctness, you will need to implement a new subclass of
AbstractSearcher.
You should ensure that all code is written to be properly thread-safe, and document exactly what this means. Remember that non-thread-safe code does not necessarily exhibit any incorrect behaviour - just because it works doesn't mean it is right!
You may use as much or as little code from the existing SearchUI as you choose, but other than this your code must be your own. You are strongly advised not to share your code with other students as the full source code must be included in your report and will be checked via TurnItIn.
You must present the full source code as text in the body of the report. It must be formatted in a fixed-width font and single line spacing, and should be presented with line numbers that can be referred to in the narrative of the report. A single screenshot of the UI is permitted if you feel it is necessary. Failure to follow these guidelines will result in marks being lost.
You must accompany the source code with a full explanation of what you have done, the rationale for your design choices and paying particular attention to all issues of thread-safety and thread interactions. Where you are unsure about thread-safety, a logical discussion of your partial understanding is worth far more than ignoring it or bland assertions of its correctness. You should also critically assess and discuss the resulting application and its performance.
Report Deliverable - Parallelised Searcher and commentary
Make a version of Searcher that subdivides the search and runs it simultaneously on multiple
threads using Java's fork/join framework. To do this, you should consider first making a class that extends RecursiveAction and that
- is given a terrain map to search and a range of positions in the map to search, as parameters of its constructor
- has a compute method that decides whether to create an Searcher object and use it to perform an search on the range of positions, or to instead create two new instances of itself and give each half the range it has been given
You will also need to decide how best to assign SearchListener objects to the Searcher objects contained inside this RecursiveAction object, so that meaningful information can be fed back to the UI. (A listener that discards information messages but forwards match found information to a master listener that is the UI would be a reasonable solution for this).
The RecursiveAction would be contained within an implementation of the Searcher interface so that it could be used within the existing SearchUIEnhancement class just by changing what kind of Searcher is instantiated and used by it. Ideally all methods of the Searcher interface would be implemented so that the parallelised job could be both cancelled and monitored by the progress bar (something that will require careful design to support it inside the RecursiveAction subclass).
You must present the full source code as text in the body of the report. It must be formatted in a fixed-width font and single line spacing, and should be presented with line numbers that can be referred to in the narrative of the report. A single screenshot of the UI is permitted if you feel it is necessary. Failure to follow these guidelines will result in marks being lost.
You must accompany the source code with a full explanation of what you have done, the rationale for your design choices and paying particular attention to all issues of thread-safety and thread interactions. Where you are unsure about thread-safety, a logical discussion of your partial understanding is worth far more than ignoring it or bland assertions of its correctness. You should also critically assess and discuss the resulting application and its performance.
Attachment:- Advanced Programming.rar