Program Flow

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Albert Ahtenberg

    Program Flow

    Hello,

    I had some bad experience with code organization and script
    functionality in writing my php based applications. And as the applications
    get bigger in scale it gets even worse. Therefore, I am trying to build a
    general schema for data flow in a php/mysql application.

    What I has in mind is to design a three major units. To handle the
    input, processing and data access. Plus another unit to generate the output.

    What I have now is one script that resolves the operation to be done
    according to the parameters send to it and the call the processing unit to
    do the rest of the job. However, as I add more functionality to the system
    this dispatcher script gets bigger and bigger...

    1. How can I arrange my program/data flow in an efficient and easily
    maintainable way?

    2. And how should I implement the output generation unit to be
    completely seperate from the others (I have lots of forms and outputs I have
    to show the user when necessary)?

    Regards,
    Albert Ahtenberg


  • Jochen Daum

    #2
    Re: Program Flow

    Hi !
    On Thu, 26 Jun 2003 22:50:38 -0400, "Albert Ahtenberg"
    <donotcontact@t his.address> wrote:
    [color=blue]
    >Hello,
    >
    > I had some bad experience with code organization and script
    >functionalit y in writing my php based applications. And as the applications
    >get bigger in scale it gets even worse. Therefore, I am trying to build a
    >general schema for data flow in a php/mysql application.
    >
    > What I has in mind is to design a three major units. To handle the
    >input, processing and data access. Plus another unit to generate the output.
    >
    > What I have now is one script that resolves the operation to be done
    >according to the parameters send to it and the call the processing unit to
    >do the rest of the job. However, as I add more functionality to the system
    >this dispatcher script gets bigger and bigger...
    >
    > 1. How can I arrange my program/data flow in an efficient and easily
    >maintainable way?
    >[/color]
    I have pretty much the same problem, which I solve by dividing the
    dispatch script into smaller logical portions. But thats not nice.

    I thought you would want to model it in a database or an array, so
    that a script could output the program flow as well. You could capsule
    that with a class, so that the dispatch script can ask for the
    appropriate task for this input.
    [color=blue]
    > 2. And how should I implement the output generation unit to be
    >completely seperate from the others (I have lots of forms and outputs I have
    >to show the user when necessary)?[/color]

    Isn't the output dependent on the action? In my scripts the output
    pretty much follows the structure ofthe code.

    Jochen
    [color=blue]
    >
    >Regards,
    >Albert Ahtenberg
    >[/color]

    --
    Jochen Daum - CANS Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    • Albert Ahtenberg

      #3
      Re: Program Flow

      Hi,

      I didn't really understand what you mean when you say capsule in within a
      class.

      And regarding the output, sure it depends on the current action but I though
      to maybe use some kind of templating or at least seperate the HTML from the
      PHP to keep the code more organized.

      Albert Ahtenberg

      "Jochen Daum" <jochen.daum@ca ns.co.nz> wrote in message
      news:3vcnfvog3a 551hn3mdsr9nslc 8ukcjm0r9@4ax.c om...[color=blue]
      > Hi !
      > On Thu, 26 Jun 2003 22:50:38 -0400, "Albert Ahtenberg"
      > <donotcontact@t his.address> wrote:
      >[color=green]
      > >Hello,
      > >
      > > I had some bad experience with code organization and script
      > >functionalit y in writing my php based applications. And as the[/color][/color]
      applications[color=blue][color=green]
      > >get bigger in scale it gets even worse. Therefore, I am trying to build a
      > >general schema for data flow in a php/mysql application.
      > >
      > > What I has in mind is to design a three major units. To handle the
      > >input, processing and data access. Plus another unit to generate the[/color][/color]
      output.[color=blue][color=green]
      > >
      > > What I have now is one script that resolves the operation to be done
      > >according to the parameters send to it and the call the processing unit[/color][/color]
      to[color=blue][color=green]
      > >do the rest of the job. However, as I add more functionality to the[/color][/color]
      system[color=blue][color=green]
      > >this dispatcher script gets bigger and bigger...
      > >
      > > 1. How can I arrange my program/data flow in an efficient and[/color][/color]
      easily[color=blue][color=green]
      > >maintainable way?
      > >[/color]
      > I have pretty much the same problem, which I solve by dividing the
      > dispatch script into smaller logical portions. But thats not nice.
      >
      > I thought you would want to model it in a database or an array, so
      > that a script could output the program flow as well. You could capsule
      > that with a class, so that the dispatch script can ask for the
      > appropriate task for this input.
      >[color=green]
      > > 2. And how should I implement the output generation unit to be
      > >completely seperate from the others (I have lots of forms and outputs I[/color][/color]
      have[color=blue][color=green]
      > >to show the user when necessary)?[/color]
      >
      > Isn't the output dependent on the action? In my scripts the output
      > pretty much follows the structure ofthe code.
      >
      > Jochen
      >[color=green]
      > >
      > >Regards,
      > >Albert Ahtenberg
      > >[/color]
      >
      > --
      > Jochen Daum - CANS Ltd.
      > PHP DB Edit Toolkit -- PHP scripts for building
      > database editing interfaces.
      > http://sourceforge.net/projects/phpdbedittk/[/color]


      Comment

      • Jochen Daum

        #4
        Re: Program Flow

        Hi Albert!

        On Fri, 27 Jun 2003 00:04:54 -0400, "Albert Ahtenberg"
        <donotcontact@t his.address> wrote:
        [color=blue]
        >Hi,
        >
        >I didn't really understand what you mean when you say capsule in within a
        >class.
        >[/color]

        I meant one could tore the actions against certain input in an array,
        or a database, or xml or whatever. Maybe build a class with methods:

        function get_action_func tion_for_input ($inputfield, $inpuvalue)

        which returns a function name. And a similar set_function.

        Maybe the set function should append it to a list of action functions.
        or even run the functions from within the class.

        The class should just be a level of indirection, so you can change the
        data format. Maybe there is a common format for workflow systems,
        which you want to use.

        I'm just making up these ideas now, so it might all be quite rough.
        [color=blue]
        >And regarding the output, sure it depends on the current action but I though
        >to maybe use some kind of templating or at least seperate the HTML from the
        >PHP to keep the code more organized.[/color]

        There was just a discussion regarding the use of templating systems
        some days ago in which I participated. You'll find the names there.

        HTH, Jochen

        BTW: I'm deleting the old parts of your threads, because in two years
        people will be unable to understand them, because they are upside down
        or all mixed. Some people say, its better to quote correctly
        (http://learn.to/quote) and I like it better that way. How you do it
        is your call.
        --
        Jochen Daum - CANS Ltd.
        PHP DB Edit Toolkit -- PHP scripts for building
        database editing interfaces.
        Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

        Comment

        Working...