CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Logic for a routine - Suggestions??

    Not sure if this is the right place so apologies in advance if not.

    However, I have a routine which I need to code (no problems with the coding side, just want the logic sounding out if possible)

    Visualise 3 Releases
    R1, R2 and R3

    R2 and R3 are dependent on R1
    R2 and R3 are dependent on each other (referred to as circular dependency)
    R1 is not dependant on anything

    Imaging they have stages, (Dev, SysTest, UATTest, Live for example)

    R1 can go ahead of any stage
    R2 or R3 cannot go ahead of R1
    R2 and R3 can go ahead of each other up to Live where R1 must be live before R2 or R3 can go to live.

    Hope that makes sense, this is some quasi logic I have come up with which I think encapsulates this logic, I'd appreciate some suggestions or comments on this...

    The trigger for this code is sign off of any of the releases (1, 2 or 3)

    Code:
    //Are there dependent releases?
                //Yes
    
                    //Are any of these a circular depenandancy
                    //Eg: R1 is dependent  on R2 and vice versa
                    //Yes
    
                        //Will sign off result in this signoff stage > circular dependent stage || dependant stage?
                        //Yes
    
                            //HOWEVER, Live Cascade Sign Off
                            //Is the current stage LiveReleaseSignOff = 7 
                            //and all circular dependent releases at LiveReleaseSignOff = 7
                            //and any non circular dependant releases = LiveAcceptanceSignOff = 8
                            //Yes
                                //Cascade sign off of circular dependant releases automatically     
    
                            //No
                                //Is the current release < LiveReleaseSignOff = 7
                                //and any dependant release
                                //But not any circular release
                                //Yes
                                    //Allow sign off
    
                                //No
                                    //Message to say that dependant releases are not at correct stage
    
                        //No
                            //Allow sign off
    
                    //No
                        //There are dependant releases but not circular dependnancy
                        //Will sign off result in this signoff stage > dependant stage?
                        //Yes
                            //Do not allow sign off
    
                        //No
                            //Allow sign off
                //No
                    //Allow signed off

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Logic for a routine - Suggestions??

    Quote Originally Posted by javelin View Post
    However, I have a routine which I need to code (no problems with the coding side, just want the logic sounding out if possible)
    I didn't read your pseudo-code, because it's way too long for this problem. :P However, you can model this as a graph where each stage of each release is a node and each dependency between stages is a (directed) arc. Then the problem is to find a topological order of the nodes. The algorithm to solve that is very simple.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    May 2009
    Posts
    2,413

    Re: Logic for a routine - Suggestions??

    Quote Originally Posted by javelin View Post
    R1 can go ahead of any stage
    R2 or R3 cannot go ahead of R1
    R2 and R3 can go ahead of each other up to Live where R1 must be live before R2 or R3 can go to live.
    To me I seems like the third statement above is redundant. At least if "live" is the final state of the R's.

    So R1, R2 and R3 are independent except that neither R2 nor R3 may go ahead of R1.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured