View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
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


ParcelImage.jpg



2.Determine what class or classes you want to store your data

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

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

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.
SaveImage.jpg


5. Load the data back in using these steps


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.
LoadImage.jpg


6. Other Notes

http://coweb.cc.gatech.edu/cs2340/uploads/6598/BOSS.pdf

Link to this Page