This part of the assignment comes after the first three lectures of the module. It tests the use of the some of the main techniques covered in the module so far, these being:
You will be expected to demonstrate the ability to use these techniques and will lose marks heavily if you do not use them. You will also have to learn and use a new technique called serialization.
You are to design a program in UML which allows you to record the details of your music collection, both that on CD and downloads (we’ll ignore vinyl etc.). You then need to implement this as a console application. The second part of the assignment will involve converting the console application to a GUI program (Windows Application) and you should bear this in mind when producing your design.
To test the program you will need to use a fair amount of data, and you will need to save/load this data to/from a file (or files). You need to get this part going very early on as you will have great difficulty progressing if you don’t.
There are several approaches that you can use for saving the data, however, for this assignment you must use one which you have yet to be taught. The technique you are expected to use is called serialization. Using serialization is the neater approach than using stream readers/writers, but since you have not covered this in the lectures you will have to research it yourself (either in Help, books, the web or all three – incidentally, learning to use Help is an important part of learning to program, so no matter what you should check this in Help even if you use additional sources).
There are two types of serialization, binary serialization and XML serialization. For this assignment you should be using binary serialization. You may have to implement the ISerializable interface, but hopefully you won’t have to and will only need to use the serialization attribute ([Serializable]) in a couple of places. You will need some rather awkward using statements to do this, so I’ll give you these for free:
Since you have to research this yourself, this approach will carry a reasonable amount of marks.
It will be easiest if you assume all music is in an album of some sort. If you have a (download) track which you don’t know where it came from, assume it is from an album called
You will need a class to hold the details of an album. The details of the album that you need will be the title of the album, artist and a list of tracks. The title and artist will both be stored as simple strings. Also you need to know the type of album, i.e. whether it is a physical CD, an album ripped from a CD, a downloaded track or a hybrid/combination of the last two (partly ripped, partly downloaded). You should think carefully about how you want to manage this. Also, you may have the entire album, or maybe you only downloaded one (or a few) tracks off a given album. Again, careful thought about managing this.
Compilations of tracks by several artists will also provide a problem. Such albums should be of a derived class called something like “CompilationAlbum” or “MultiArtistAlbum” and should always give the artist as Various Artists.
It is probably worth defining a class to hold track details as well. For each track you must store the title (a string) and track number (an integer). These should be read only properties (set by the constructor – which will need a list of the tracks as well). You must store the tracks in a standard generic container. The tracks should be stored in the list in the order that they appear on the album. Bear in mind that you may download one or two tracks from an album then download a few later (i.e. you need to be able to add tracks one at a time to incomplete albums). Test and get the class working.
When you have the album class(es) working you can now create the music collection class. This should have a generic collection of albums (either by containment or by inheritance, it doesn’t matter which).
The album collection class should have functions/methods to allow you to:
You must think carefully about whether you want to add load/save functions to the album class to help the load/save functions of the album collection class (it is possible to get it to work either way).
Put display methods in classes so you can test as you go along. If you write the whole program in one go and then try to debug it you have very little chance of getting it to work. Develop the work in stages, do one part and TEST IT THOROUGHLY before going onto the next stage. Only ever add to working code and only add one new thing before testing. Failure to work methodically like this will probably result in failure. You must not cut corners or you will fail.
A menu based test harness will suffice. One of the main reasons for insisting that you can save and load the users is that it will simplify testing for you. You must ensure that you can test the use of both types of user and also that you can save and load both types of user to/from the same file.
You must hand in a paper copy of the UML diagram. You must produce the diagram electronically; hand drawn versions will not be accepted. Also, class diagrams generated from Visual Studio will not be accepted (as this is not standard UML). You may use any other tool of your choice including Visio (which has UML templates) or even Paint. In the labs we have Enterprise Architect which would be a good tool to use. We cannot supply this to you, but you could buy it. Alternatively, diagrams produced from the evaluation version (which will remain active for a month) would be acceptable (I will ignore the markings in printouts which say it is the evaluation version). See the Sparx Systems website for details.