-- editor's notes (me, John) .. message date .. accepting ranges for reading/deleting messages - e.g. 1-4) -- use a string as a delimiter instead of character -- see dev plan notes for that -- no limits to be set on message length -- this is the email --- Diary 1: Preliminary Outline and Thoughts for Grim Message Keeper Public Methods Message.Edit number Message.Delete number Message.AddNew Message.ListAll Message.Expand number Private Method Message.Title number Message.Body number Message.SaveAll Message.Quit Message.ParseAll Method of storing invisible text file ie .messages Messages should be delimitered by a character not being used. So comma, semi-colon, or carriage return is out of the question. To make things simpler I will use for the time being the '|' to delimit messages and will see if we can have a truly unusable/untypable character that we can use. (Temporary) Constraints: Title should not exceed 255 chars (MAX_TITLE_LENGTH) Body should not exceed 65535 chars (MAX_BODY_LENGTH) (no logic on the above just pure random choice) --------------------------------------------------- Object Oriented Analysis (trying to refine the OO logic) [Grim Message Keeper "Class" will be named as Messages here for simplicity sake The name of the program won't change.] - The collection "Messages" is made up of 0-N "Message"(s) Class CMessages Class CMessage - The object "Message" is made of two distinct parts Title and Body Class CTitle Class CBody - Title and Body are "String" so these will be made into "Properties" of the object Message Message.Title Message.Body - The collection is "ordered", when one is deleted/added it naturally reorders everything so we still have messages 1, 2, 3, 4 .. etc - When the collection of messages is zero; a special case should raise the exception "There are no messages yet" We will probably use to group the collection of messages. "Vectors" to my understanding is akin to "collection" where you can freely add/delete without having to reserve more or less memory in the process. -------------------------------------------------- Defining which methods and properties belongs to which "Object" The Object "Messages" will expose the following methods: void Messages.ListAll Reads from text file .messages and Lists tje messages titles in the format: 1 - Title Number One. 2 - Title Number Two. etc void Messages.SaveAll Saves whatever is in the array/vector back to .messages void Messages.AddNew(string sTitle, string sBody) First Checks both parameters conforms to the rules (ie length) And adds a Message of Title sTitle, and Body sBody. We probably do a Messages.SaveAll here void Messages.Edit(int iNumber,string sTitle, string sBody) Checks both parameters conforms to the rules AND that iNumber exists in the listing. Edits accordingly We run a Messages.SaveAll (Note: since arrays and vectors starts at 0, we will have to do some arithmetical offsetting) void Messages.Delete(int iNumber) Checks iNumber is indeed valid. Asks user for confirmation: "Would you really like to delete message '3 - Buy some Coke for Judy' (y/n) " And deletes if y, Y, or yes or YES is entered and echoes: "Message Deleted." And run a Messages.SaveAll string Messages.Expands(int iNumber) Return the Body of message number iNumber void Messages.ParseAll() Reads the .messages file and convert the contents into an array/vector. ---------------------------------------------------------------------- Things becoming clearer - the fog is now a slight haze :) Forget the single "Message" Object, all we need is 2 string arrays: string[] sTitle string[] sBody (Note I use arrays/vectors so I don't forget that its really a vector we should use, but the term "array" makes me see better, after all a vector is a "kind of" array) -------------------------------------------------------------------------- Finalizing the first cloudy analysis (and repeating some things again) If its C++ then we are talking Object-Orientation and so Classes. Our main Class is the CMessages. The following are its (public) methods: public void edit(int i); public void delete(int i); public void addNew(); public void listAll(); public string expandMessage(int i); The following are its (private) methods: private void parse(); private void save(); private string getTitle(int i); private string getBody(int i); The following are the (private) constants: private const int MAX_TITLE_LENGTH = 255; private const int MAX_BODY_LENGTH = 65535; The following are the (private) members: /* Need work! I forgot how to apply the vector template and there is also a string template! This is just a mock idea for the time being: private CStringVector m_sTitle; private CStringVector m_sBody; */ --------------------------------------------------------------------------- Console functions: The program is designed in such a way - that the object CMessages really doesn't care how you call the GrimMessageKeeper. The Program GrimMessageKeeper will manipulate how instructions are read from the console, query the object CMessages and then echo back to the console. So basically GrimMessageKeeper will act as the middle layer. More thought should be done in making sure CMessages is truly "interfaceable" ----------------------------------------------------------------------- Wrapping up for today. These are very preliminary thoughts - I wanted to dedicate no more than 15-30 minutes. I made no attempt whatsoever at this stage to look back at what I wrote, consult books and edit 1000 times in an effort to sound as if I think perfectly from the word go :) For me its an interesting exercise as how the brain works too. From deep clouds, to fogs, to haze .. to well - perhaps a shiny day one day. I also didn't read much what anyone wrote yet because I think it would confuse me more than help. I will carry on developing in parallel - and see what happens. This is stage 1 .. and I think/estimate we are between 8-12 stages to completion. More soon. Posting this may cause flames as the above are "thoughts" jotted down instead of a polished specification. And many points will be seens as "blasphemous" to any Object-Orientated Purist or Technical-Pedantic Let's see where it leads to.