NYCPHP Meetup

NYPHP.org

[nycphp-talk] DataObjects generator

Kenneth Downs ken at secdat.com
Sat Nov 19 11:13:21 EST 2005


best of luck.

> My focus with the generator was to create a base DataObject. When using
> the
> DataObject in a project, if I decide to add methods that perform tasks
> outside of the core basics I would just extends the base DataObject for
> that
> table in another file. Tweaking/debugging of that other file doesn't
> affect
> the base. Now, If these methods are agreed to be common enough to apply to
> each table, you could hack another generator that by default extends the
> base DataObject for those specific methods common to each table.
>
> Running the generator against 170 tables shouldn't take very long and
> since
> you extends the base DataObject to add additional functionality when using
> it in a project. The impact should be little to nothing.
>
> In theory, after generating the base DataObjects script files, you should
> "never" have to edit those files again. The goal is to have a "standard"
> DataObject for every table. So, having to re-run the generator after
> fixing
> a bug in the base DataObject is required.
> Also, If I modify the database table(s) adding/removing fields I would
> re-run the generator on that table(s) only just to ensure I maintain the
> standard base DataObject for my project.
>
>
>
>
>
>
> On 11/19/05, Kenneth Downs <ken at secdat.com> wrote:
>>
>> I think I phrased my question badly.
>>
>> What I should have said was that as the complexity of your generator
>> increases, and as the table count increases, running the generator
>> becomes
>> more and more of a delay. If the generator produced an assoc array of
>> layout, you would only need to run it when layout changed, and your
>> system
>> would be much more flexible both in terms of development and deployment.
>>
>> I have a system of 170 tables and re-running the generator is just not
>> an
>> option when I'm trying to tweak a bug, I want to modify the code
>> directly
>> and see the effect. When it is fixed, it goes into the distribution tree
>> and all systems using that library file are affected w/o rerunning any
>> generators.
>>
>> > After tweaking the generator, a simple refresh of my browser allows me
>> to
>> > see the output of the script generated and the output from executing
>> each
>> > method in the DataObject. Since this refresh has the database and
>> table
>> > info
>> > already and the assoc array - $_POST is still available.
>> >
>> >
>> > On 11/18/05, Kenneth Downs <ken at secdat.com> wrote:
>> >>
>> >> Have you considered simply dumping out associative arrays that
>> describe
>> >> each table, and then having single library of code that handles them?
>> >> This gives you the flexibility to see the code's efficacy in
>> real-time
>> >> as
>> >> you work on it -- without having to run the generator for every
>> little
>> >> tweak -- and then having it save cached chunks of HTML as it goes.
>> >>
>> >> > I've developed a tool that creates a DataObject for each table I
>> have
>> >> in
>> >> > my
>> >> > MySQL database. When the script is executed against a particular
>> table
>> >> it
>> >> > generates a script containing OO code with a number of methods
>> defined
>> >> by
>> >> > default e.g. set_/get_ , getAll, get, insert, delete, update, and a
>> >> error
>> >> > method.
>> >> >
>> >> > It has also been fun finding ways to use the DataObjects. As a
>> result,
>> >> I
>> >> > have put together a couple of examples;
>> >> > Using a single DataObject :
>> >> http://cthorn.com/oodbigen/usingdataobject.php
>> >> > MVC wrapper for the DataObjects :
>> >> > http://cthorn.com/oodbigen/mvcwrapper.php
>> >> >
>> >> > Hope someone finds this useful. Feedback welcomed..
>> >> >
>> >> > Chauncey Thorn
>> >> > PHP App. Developer
>> >> > email: chaunceyt at gmail dot com
>> >> > url: http://www.cthorn.com/
>> >> > _______________________________________________
>> >> > New York PHP Talk Mailing List
>> >> > AMP Technology
>> >> > Supporting Apache, MySQL and PHP
>> >> > http://lists.nyphp.org/mailman/listinfo/talk
>> >> > http://www.nyphp.org
>> >>
>> >>
>> >> --
>> >> Kenneth Downs
>> >> Secure Data Software
>> >> 631-379-0010
>> >> ken at secdat.com
>> >> PO Box 708
>> >> East Setauket, NY 11733
>> >>
>> >> _______________________________________________
>> >> New York PHP Talk Mailing List
>> >> AMP Technology
>> >> Supporting Apache, MySQL and PHP
>> >> http://lists.nyphp.org/mailman/listinfo/talk
>> >> http://www.nyphp.org
>> >>
>> > _______________________________________________
>> > New York PHP Talk Mailing List
>> > AMP Technology
>> > Supporting Apache, MySQL and PHP
>> > http://lists.nyphp.org/mailman/listinfo/talk
>> > http://www.nyphp.org
>>
>>
>> --
>> Kenneth Downs
>> Secure Data Software
>> 631-379-0010
>> ken at secdat.com
>> PO Box 708
>> East Setauket, NY 11733
>>
>> _______________________________________________
>> New York PHP Talk Mailing List
>> AMP Technology
>> Supporting Apache, MySQL and PHP
>> http://lists.nyphp.org/mailman/listinfo/talk
>> http://www.nyphp.org
>>
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org


-- 
Kenneth Downs
Secure Data Software
631-379-0010
ken at secdat.com
PO Box 708
East Setauket, NY 11733




More information about the talk mailing list