Several Environment Groupings - Good Architecture Question RRS feed

  • Question

  • Hello,


    It may be a little hard to explain.  I have an application I'm developing that has several environments that you can request work for, so say you have the following environments:






    These events have to occur in a specific order, so you specify a date with the environment you want to do work for.  I was trying to think of a clever way to represent this.  I just most recently thought of the state/strategy pattern; however, I was wondering if something else may be better because I am working with a fixed set of environments.



    Monday, May 14, 2007 1:52 PM

All replies

  • What makes the strategy pattern appealing from the perspective of the application you're developing? Please tel us more about the business case this application is trying to solve.

    Monday, May 14, 2007 4:55 PM
  • Hey,


    I think because each environment has the same properties, and each environment is really the same object (an environment), but with different attributes (the name of the environment and date).  Having a common inherited base allows me to have a common interface that I can use to add to a collection, or other object, which I'm not sure how that will work.


    The thing is there can only be one instance of that object at a time, which can be a little more work to control.  Because of derived types, you can control that more easily, but with state/strategy, it can make it a little confusing.


    I also need to validate each of these objects with each other to ensure they occur in the correct pattern, meaning the one is requested before the other, so they appear in the correct chain of events.  But not all of those environments are required; at least one is, and not necessarily the first one (could be middle environment).



    Monday, May 14, 2007 5:05 PM