Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

Comment use state machines and context objects (Score 3, Interesting) 229

Globals are simply a first order abstraction when it comes to storing a program's state.

They get unwieldly fairly fast - as soon as you start hitting any complexity.

Try state machines (see GOF) and lots of singleton classes with 'Context' in the name.

The state machines and context objects can save their own state as the change - and read the state back in as necessary. They can save their state to an in-memory object or straight to a database whether it be a file or otherwise. A 'load' would just work the other way...

Just how I'd approach it.... (it and about anything else non-trivial ....)

Slashdot Top Deals

All your files have been destroyed (sorry). Paul.

Working...