[SOLVED] When should one create a new class?
This may strike you as a strange question, but when is it acceptable to create a new class?
For example, in an assignment I am currently working on I need to take in a list of words in a .txt file (each word on a new line and the file always ends with an empty line). I then need to sort the words in alphabetical order and output them into a new text file with the amount of words in the top line.
My idea currently (may change at a later stage depending on how I approach this), is to read the input file into an array, sort the array, and then write the array contents to an output file.
What I am having a problem with is when is it right to create a new class? Do I create a new class that manages the details of the input file, one for the output file and one as a Driver? Or do I merely keep it all bundled together in one class?
If you could please provide reasoning for what you are suggesting that would be great. I mean, my own thoughts are that I keep it all in one class, because I can't really see the input file or the output file as separate entities, how do you decide what to do?