Article Preview
Buy Now
FEATURE
Saving Data
A simple method for saving a data structure
Issue: 8.2 (January/February 2010)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 57,444
Starting Page Number: 23
Article Number: 8210
Resource File(s):
8210.zip Updated: 2010-01-04 13:06:10
Related Link(s): None
Excerpt of article text...
I've written about "quick-and-dirty" programs -- apps meant for one-time use (e.g., convert uniquely formatted data to a different format) or internal use (not for public distribution or resale). These are low-value projects where you don't want to waste time thinking about the
how , you just need the workdone . I believe that REALbasic is an ideal platform for these kinds of projects: tasks too complicated for mere macro or scripting software, but not something that requires a Computer Science degree to write. I use a lot of this sort of apps (in fact, they are frequently used in the production ofREALbasic Developer ) and I've developed a number of shortcuts to make creating these apps simpler and faster, such as a library of pre-written routines and reusable classes I can just drop into my project. But one complex problem that often crops up is the saving of data.Introduction
For many programs, saving data is relatively trivial. Text in an
EditField
can be saved to a simple text file, or the contents of a listbox can be saved in a tab-delimitated file. Both of these tasks can easily be automated for simple reuse (for instance, it's not hard to createEditField
orListbox
subclasses that know how to save and reload themselves from a file). But many programs require a slightly more complicated data structure than mere text. Even if the data itself is fairly straightforward, it may be scattered apart in different areas of your program (i.e., some in aListbox
, some in anEditField
, some elsewhere), or it may simply be that you have different kinds of data (numbers and text and colors and pictures) and they can't all be easily stored in a single file.
...End of Excerpt. Please purchase the magazine to read the full article.