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.
Michael S - 20 Dec 2005 14:47 GMT
> 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