






Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Easiest way to save data - BOSS by Josiah Mangiameli
Introduction
Saving Data can be one of the hardest parts of a smalltalk project.
There are many different options but the easiest is definitely BOSS.
Boss saves data on an external file in a compact binary format.
In the small quantities that you use in this class, the data saves/loads quickly and easily.
Boss is only meant to save data and it cannot save interface (UI)
Steps
1. Load the BOSS Parcel in the Application Development folder

2.Determine what class or classes you want to store your data
- Ex. In our case, we stored all of our patient, doctor, treatment, and hospital data in our Hospital class
and we stored all of our login names and passwords in our UserSecurity class
3. Make sure that all classes that you plan to store are regular objects and not UI classes
- You can easily do this by checking your class definition, if its superclass is "Core.Object"
then you are ok, if it is "UI.ApplicationModel" then it is not a class you should be saving
4. Save your data using these steps
- Create the temporary variables for the dataObject, dataStream, and boss. Must be done at start of method
- Set the dataObject to the file you want to save
- Create a DataStream on a particular filename
- Create a BinaryObject with the data stream as an argument
- Store the dataObject using the nextPut message
This may seem confusing so here is an example
dataObject dataStream bos
dataObject := PointExample x: 3 y: 4 z: 5.
dataStream := 'points.b' asFilename writeStream.
bos := BinaryObjectStorage onNew: dataStream.
[bos nextPut: dataObject] valueNowOrOnUnwindDo: [bos close].
This is what our save looked liked. We store an array of the collection of hospitals and security data.

5. Load the data back in using these steps
- Create a boss readStream on your particular filename
- Read the data out
- Set it to the initialized data
bos array
bos := BinaryObjectStorage
onOldNoScan: 'points.b' asFilename readStream.
[array := bos contents] valueNowOrOnUnwindDo: [bos close].
This is what our load looked liked. Load an array of the collection of hospitals and security data.

6. Other Notes
- You must implement the save code first. This creates the file that the load code will be looking for.
- This PDF is a great reference.
http://coweb.cc.gatech.edu/cs2340/uploads/6598/BOSS.pdf
Link to this Page
- Cases last edited on 30 July 2011 at 2:33 am by r59h132.res.gatech.edu