Diary 3 It's very easy to give up. To find an excuse is even easier :P I have had other challenges and loads of work to do but I reckon that 15 minutes a day won't hurt. The discipline of it - of course can be hard. ADDING CONSTRAINTS ================== Even a simple project like this can be hard. Specially if C++ is not your new language and Linux your new operating system. To make the project more manageable for myself I am going to add one constraint (which can then be removed/expanded). That being: No multilines for the messages. This way we can use the "cin" function which when entered adds our new notes. The database then could be very readable with the first line being the title and the second line the message (and a third blank line to add readability) ADDING MORE CONTRAINTS (sorry! lol) ====================== I want to get the engine going. Please note these constraints are TEMPORARY!! :) But they will make it easier for me to see the app as a whole rathen then getting lost in details. We won't have many of the commands (yet) and no read/unread But just: We will have then: > grim show_all Displays all messages > grim read 1 Expands message 1 > grim delete 1 Deletes message (then very soon grim edit ) So let's use this: > grim show_all 1. Cook Dinner 2. Phone Betty 3. Pay Rent > grim read 2 2. Phone Betty You haven't phone Aunt Betty in ages, you should otherwise you will get into trouble. > grim new Write new note: This is a new note. I am having just these 3 for the time being (and then will add/change as specified plus adding ranges, etc) > grim delete 2 Are you sure you want to delete message "Phone Betty"? ... PROGRAM STEPS: ============= > grim show_all A1. Checks for file .grimdb if not found create one A2. If .grimdb is empty then message is "There are no messages" (end) A3. Sanity check file .grimdb with every third line should be blank: bool ThirdLinesBlank() A4. Sanity check file .grimdb first and second line should *NOT* be blank: bool FirstSecondLinesNotBlank() A5. Parse files into vectors first line is Title / Second line is Message A6. Run loop displaying the messages. > grim read perform instructions A1-A5 like before. B1. Display vector if not existent raise exception. > grim new C1. (Can't be empty) Add line like "Write new note .. Title:" << new_Title (read about strings/cin/cout/parsing text-files) C2. Same thing but with "Message:" (Can't be empty if so raise exception(?)) C3. If both steps C1&C2 then write to .grimdb and confirm. > grim delete D1. performs instructions A1-A5 like before. D2. Raise exception if no vector position exists. D3. Otherwise ask for confirmation (displaying full title+message) D4. (Tricky) delete vector at position and compact the array (I can't remember if vectors are self-compacting like Collections or not). CONCLUSION: =========== I think that if I get a working copying of the above program then it will make it much easier for us to add the extra features. Points to study: * Parsing Text Files (new line is the delimeter) * Recap vectors (do they auto-compact?) * Recap CIN/COUT * Read syntax for command line parameters (ie grim etc)