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

Some Information on BOSS - Ibrahim Moreno

To begin, the purpose of BOSS (binary object streaming service) is to store, in an external file, objects in binary form. The reason it is so useful is because it is able to store object instances. Once stored, they can be retreived.

Please read up on: BOSS

in order to better understand the way it works and how it can be used.

Some things I'd like to point out are that circular references, besides being poor design/implementation, should not be present if you want to implement BOSS.

BOSS is intended to store data objects and once they are stored they can be either retrieved partially or in their entirety.

Now, the main point I would like to get across is that BOSS can be used to store a collection of classes, and they are sorted in superclass order. When BOSS writes its information, it writes expressions that initialize the class if there is such a method in the class.

Why do I think this is important? Because BOSS can be very appropriately used, for example, in our case, for the save/load function of a game. The way to make things much easier on you is by implementing a facade design pattern. This way, boss will store that facade class and with it everything that was initialized by it. In team 33k!'s case, this class was "Game." Game has a special initializer for Oregon Trail's purposes:

Sample Code

"game object initializer- it creates instances of all the game components"
wagon := Wagon new.
map := Map new.
eventManager := EventManagerOT new.
eventResponder := EventResponder new.
wagonCollection := OrderedCollection new. "for future multiplayer"
wagonCollection add: wagon. "for future multiplayer"
curDate := Date newDay: 1 month: 'May' year: 1848.
eventResponder registerGame: self.
huntFlag := 0.
state = #ready.

As you can see, game is in charge of initializing everything else. Now the code for saving and loading will be minimal.

Sample Code

saveGame: aWriteStream game: aGame
"Saves a game to the given stream"

| bos |
bos := BinaryObjectStorage onNew: aWriteStream.
bos nextPut: aGame


loadGame: aReadStream
"Loads a game from the given stream"

^(BinaryObjectStorage onOldNoScan: aReadStream) next.

Here is a picture of our UML class diagram. This one is missing a few classes, but looking at the outline, you can see how it is a facade design, and since you understand BOSS now, you'll know how much time this will save you if you need to implement it.

Links to this Page