Home > Problems and Solutions > Maintaining State

Maintaining State

Maintaining state in a web application is always interesting. Typically developers will start programming knowing they will need to maintain state here and there for a particular action or a particular controller. But as developers often do, they fail to see the larger picture or pattern until after the application has already been half way coded (and by developers I mean Me :-D). Well this particular developer finally got tired of ugly code and developed a "better" solution. Let's see the ugliness first.

The Ugly Code

Maintaining State the Hard Way

The Pretty Code

Maintaining State the Easy Way

Introducing LC_Controller_Action_Helper_State

How does it work?

Basic Usage Example...

Demo Usage Example...

Something's Still Aggravating Me?

The thing that's still bothering me is that I can feel a connection between this idea and the Memorable doctrine behavior under the Hackery section. There is a pattern for sure. Maybe some form of a "Persistence Pattern". I'm not sure but it'll occur to me eventually.

I invite you to send me feedback on any real world applications, questions, or comments. And as always peer review is encouraged. ~mrBurly.

© Lance Caraccioli 2008-2017. Design: spyka webmaster