A simple method for saving a data structure
Issue: 8.2 (January/February 2010)
Author: Marc Zeedar editor-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 41,209
Starting Page Number: 23
RBD Number: 8210
8210.zip Updated: Monday, January 4, 2010 at 1:36 PM
Related Link(s): None
Known Limitations: 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 work done. 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 of REALbasic 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.
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 create EditField or Listbox 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 a Listbox, some in an EditField, 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.
Article copyrighted by REALbasic Developer magazine. All rights reserved.