471,627 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Beginner design question

Hi,

I'm curious how others would deal with something I'm building.
The app itself is a form of diary; it allows the organisation of diary
entries and a number of other data types.
Each diary entry is listed under its title, and double clicking brings
up the full entry and options for editing.
Each entry and associated option is stored in a diary object instance.
I'm wondering how best to store the persistent data. One option is
to a file on the users HDD. Each time the app is opened the file is
read and all diary instances are recreated. But I'm worried that
storing every diary instance in memory will create an ever increasing
memory footprint.
The other option I've thought of is creating a db file on the users
HDD, and only reading what information is needed. For example, when a
list of diary entries is shown, just the title fields are read into
memory. On double clicking a title, the entire record is fetched and an
instance of diary object created.

Which one of these would be the best solution? Or is there something
else more suited?

Another quick question: Are there any pre-made controls for the
richtextbox control? E.g. bold, italic, font type, colour buttons etc?
Or do all have to be created?

Any help would be appreciated!

Paul

Dec 19 '05 #1
2 1104
Is this for personal / local use, or intended for a wider audience?

If this is for personal use, or use amongst friends, keep in mind that
most computers these days have enormous amounts of memory. It would
take one heck of a prodigious and dedicated writer to fill up 512 Mb,
IMHO.

That said, if this is intended as a commercial product then you have to
be pickier about resource usage.

In the former case, the quick-n-dirty solution is to simply place the
entries in an XML file. When you start the app, read the XML into
memory, add an edit entries, then write it out again when your app
exits (or do intermediate saves to guard against data loss on crashes).

However, if this is to be a "real" application, you really do need to
use a database. MS just came out with SQL Server Express, which I
believe is a freely-distributable mini version of SQL Server for the
desktop. This would be ideal. You could also use an Access database,
but personally I think that Access isn't long for this world, so I
wouldn't recommend that.

A database would certainly make for a longer-lived, better-functioning
application. The XML solution is just a quicky.

If you really wanted to be clever, you could design yourself a data
layer interface something like this:

public interface IDiaryDataLayer
{
DiaryEntrySummaryCollection GetSummaries();

DiaryEntry GetEntryDetails(DiaryEntrySummary entry);

void InsertEntry(DiartyEntry entry);

void UpdateEntry(DiaryEntry entry);
}

....and any other methods or properties you'll need from your data
layer. Then you could write the XML data layer:

public class DiaryXmlStorage : IDiaryDataLayer
....

in order to test your application, then, later, you could work on the
database layer:

public class DiaryDataBaseStorage : IDiaryDataLayer

and just plug it in in place of the XML data layer. In fact, you could
write any class you wanted and so long as it implemented
IDiaryDataLayer, your diary application could use it to store and
retrieve diary entries.

Dec 19 '05 #2

"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
desktop. This would be ideal. You could also use an Access database,
but personally I think that Access isn't long for this world, so I
wouldn't recommend that.


Note that MsAccess is also a stripped SQL Server internally.
But it requires a Office license and so I agree. SQL Express 2005 is a great
chioce.

- Michael S
Dec 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by z_learning_tester | last post: by
17 posts views Thread by C_beginner | last post: by
4 posts views Thread by Johs | last post: by
4 posts views Thread by subramanian100in | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.