Re: Modular PHP

From: Henk Verhoeven (news_at_metaclassREMOVE-THIS.nl)
Date: 03/01/04


Date: Mon, 01 Mar 2004 01:29:50 +0100

Alternatively you could do it the XP way, i mean:
- think of a metaphor of what the system should be like
- write down some requirements,
- Write unit tests first
- Build the simpelest thing that could possibly work
- extend to meet more requirements
- Refactor whenever you find youself writing the same or similar code a
second time

With XP there is no difference between development and maintenance, so
when later you find new requirements, just go on extending and
refactoring. So far it's all on http://www.extremeprogramming.org/
and http://www.xprogramming.com/

If you want plugins, after some time you can do meta-xp: See if there
is a pattern in your extensions and refactorings. Analyze it, design a
plugin api for it. Make it the simpelest plugin api that could possibly
work. Write plugin api tests, refactor to make the new tests run (and
the old ones too, of course). Extend and refactor as new patterns emerge.

Of course all this does not tell you how to design & code. But all
design really comes down to getting rid of repeated code. You could just
start doing it and learn as you go. (But reading some books and articles
  will probably pay of soon enough, so you can do that too)

Greetings,

Henk Verhoeven, MetaClass.

CountScubula wrote:

> "Hayden Kirk" <spam@spam.com> wrote in message
> news:xSE%b.28642$ws.3224053@news02.tsnz.net...
>
>>Hey guys
>>
>>I am about to write some back end software for my business. I want a
>
> system
>
>>that I can create invoices, clients etc... I can do this no problem.
>
> However
>
>>I want to write it in modules so its extendable in the future.
>>
>>Like someone else can write a module for it and it can plug stright into
>
> my
>
>>system. I can't figure out a good way to do this in php. I was thinking of
>>hooks or something, but PHP does not support this.
>>
>>Does PHP 5 have anything like this? Or does anyone else know a good way to
>>do it in PHP 4?
>>
>>Any info appreciated.
>>
>>Thanks
>>
>>
>
>
> Well, you first need to outline what kind of things you will want to have
> available as a plug in, and define a way of comunicating with them, sorta
> like an API. you cant just have people writing code and expect it to
> intergrate. An example would be photoshop, you can write a plug in for
> images, but you can not write a plugin to change the way the photoshop
> interface works.
>
>
> So, you must decide what you want others to be able to controll, and define
> a way to pass data back and forth. Also, you must define how you want that
> module to be active, 2 aproaches:
>
> Aproach 1:
> have an ini.php file and have a lines that read such as this:
> $modules['style'] = "genaric.php";
>
> And allow people to edit the ini file and change the module 'generic.php'
>
>
> Aproach 2:
> set up a loader function, that will include all files in a directory
>
> This way, one only has to replace the style file in that directory.
>
>
> Now this is to replace functionality to a site, if you want to add
> functionality you will need to decide how you want to add items, for
> example, tools, addition pages etc.. This basicaly meens you need to do a
> good outline of what you want to acomplish first, then go from there.
>
> --
> Mike Bradley
> http://www.gzentools.com -- free online php tools
>
>



Relevant Pages

  • Re: Modular PHP
    ... Make it the simpelest plugin api that could possibly ... refactor to make the new tests run (and ... Extend and refactor as new patterns emerge. ... I can't figure out a good way to do this in php. ...
    (comp.lang.php)
  • Re: Ruby PDF text extractor
    ... > PDF::Reader will probably be released in early 2006, depending on how ... > long it takes to refactor the code that already exists, ... > extend it, and get the necessary PDF::Writer code finished. ... Prev by Date: ...
    (comp.lang.ruby)
  • Re: Extend compiler (pre compile)
    ... Refactor! ... | Is it possible to some how make the complire produce the code by reading ... Is it possible to extend the compiler some how? ...
    (microsoft.public.dotnet.framework.clr)