Click here to Skip to main content
15,891,136 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Abstract factory Pin
Richard MacCutchan17-May-11 2:36
mveRichard MacCutchan17-May-11 2:36 
GeneralRe: Abstract factory Pin
Phil00517-May-11 3:06
Phil00517-May-11 3:06 
GeneralRe: Abstract factory Pin
Shameel17-May-11 4:21
professionalShameel17-May-11 4:21 
GeneralRe: Abstract factory Pin
Phil00520-May-11 22:09
Phil00520-May-11 22:09 
QuestionUML state diagrams Pin
Phil00510-May-11 7:39
Phil00510-May-11 7:39 
AnswerRe: UML state diagrams Pin
Gerben Jongerius10-May-11 21:19
Gerben Jongerius10-May-11 21:19 
GeneralRe: UML state diagrams Pin
Phil00515-May-11 1:22
Phil00515-May-11 1:22 
AnswerRe: UML state diagrams Pin
Keld Ølykke24-May-11 3:16
Keld Ølykke24-May-11 3:16 
Take a look at this.

If this is the type of state diagrams you are talking about then you can make 1 type of implementation as follows in code:

1) Create a class e.g. MyState.
2) Add a string property State with a private setter and a public getter.
3) Add a public transition method e.g. Transition that takes an argument e.g. Target
4) Let the transition method set property State to Target.

If you instantiate MyState, you have the means to encapsulate a state diagram into an object.
Identify the transitions in other code and let those transitions call Transition of MyState.
In this setup you have a state object that is able to report the state of others.

Sometimes you see MyState as a property on another object. Sometimes MyState is just part of another object.

The later means that an object e.g. MyFoo encapsulates its own state information, which is quite a virtue in OOP.
Example: As a OOP developer you expect that a File object is able to tell if its read-only or closed. You don't want to shop around by other objects to figure that out.

If MyFoo not only encapsulates its state information, but also its state transitions, then MyFoo becomes quite handsome.
In this case the Transit method must implement all possible transitions with their conditions and throw an exceptions (or similar), if it cannot make a transition.
If you let MyFoo make some transitions by it self then it becomes partly autonomous.
If MyFoo becomes 100% autonomous then make the transition method private.

Usually the Transition method is a set of methods e.g. File.Open, File.Close, etc.
Usually the State property is an enum or similar. Some OOPs prefer however the State pattern.

Regards,
Keld
GeneralRe: UML state diagrams Pin
Phil00527-May-11 1:04
Phil00527-May-11 1:04 
QuestionStored Procedures Pin
Leslie Sanford9-May-11 17:38
Leslie Sanford9-May-11 17:38 
AnswerRe: Stored Procedures Pin
Gerben Jongerius10-May-11 21:27
Gerben Jongerius10-May-11 21:27 
AnswerRe: Stored Procedures Pin
jschell24-May-11 8:43
jschell24-May-11 8:43 
QuestionThinking about the Future Pin
John D. Sanders6-May-11 8:53
John D. Sanders6-May-11 8:53 
AnswerRe: Thinking about the Future Pin
Pete O'Hanlon6-May-11 9:26
mvePete O'Hanlon6-May-11 9:26 
GeneralRe: Thinking about the Future Pin
Sandeep Mewara6-May-11 17:41
mveSandeep Mewara6-May-11 17:41 
GeneralRe: Thinking about the Future Pin
Pete O'Hanlon6-May-11 22:39
mvePete O'Hanlon6-May-11 22:39 
GeneralRe: Thinking about the Future Pin
Paul Michalik14-May-11 22:56
Paul Michalik14-May-11 22:56 
GeneralRe: Thinking about the Future Pin
Pete O'Hanlon17-May-11 1:23
mvePete O'Hanlon17-May-11 1:23 
AnswerRe: Thinking about the Future Pin
RobCroll6-May-11 16:51
RobCroll6-May-11 16:51 
AnswerRe: Thinking about the Future Pin
Shameel9-May-11 2:33
professionalShameel9-May-11 2:33 
AnswerRe: Thinking about the Future Pin
weberrich31-May-11 5:55
weberrich31-May-11 5:55 
GeneralRe: Thinking about the Future Pin
John D. Sanders31-May-11 7:06
John D. Sanders31-May-11 7:06 
QuestionAbout Three -Tier and N-tier Architecture? Pin
maruthimaru29-Apr-11 22:58
maruthimaru29-Apr-11 22:58 
AnswerRe: About Three -Tier and N-tier Architecture? Pin
DaveAuld29-Apr-11 23:08
professionalDaveAuld29-Apr-11 23:08 
AnswerRe: About Three -Tier and N-tier Architecture? Pin
Sandeep Mewara30-Apr-11 0:22
mveSandeep Mewara30-Apr-11 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.