[pmwiki-users] Ingredients . . .

Ben Wilson dausha at gmail.com
Tue Feb 7 07:33:52 CST 2006


On 2/7/06, pmwiki-users-request at pmichaud.com
<pmwiki-users-request at pmichaud.com> > Message: 3
> Date: Mon, 6 Feb 2006 22:32:13 -0700
> From: "H. Fox" <haganfox at users.sourceforge.net>
>
> On 2/5/06, christian.ridderstrom at gmail.com
> <christian.ridderstrom at gmail.com> wrote:
> > On Sat, 4 Feb 2006, Ben Wilson wrote:
> >
> > > That said, I've scripted a few recipes and tinkered with a few more.
> > > I've noticed certain bits of code are used repeatedly throughout
> > > various recipes. I would invite the community to cull through the code
> > > and find which routines are more commonly used and may be worth
> > > pulling out of individual recipes and turned into "ingredients." I
> > > think so doing would reduce the size of code, improve the authoring of
> > > new code, and produce more maintainable recipes overall.
> >
> > This sounds like an excellent idea to me... How about calling the page
> >
> >         Cookbook.CodeIngredients
>
> That's a good name for it.
>

While it is good to document these ingredients, my focus is more on
the code reusability. I like Pm's idea of 'scripts/ingredients.php' so
that routines commonly used by us cookbook authors can be centralized
and out of our scripts. That is, rather than four or five of us either
1) writing code to do the exact same thing or 2) borrowing code from
one another; that code is set aside. Pm's offer to put it "sorta" in
the core by creating an ingredient library fits that bill perfectly. I
find myself doing this same thing in my own code as recipes I write
tend to be variations on a theme.

Of course, as I write this I realize that there are going to be
one-liners that would not need to be put into such a library. Although
I snipped them out, the suggestions you made are what I would describe
as one-liners. The Cookbook.CodeIngredients would be the ideal place
to put these calls. It would also be a good place to document the
various functions that are large enough to find their way into
"ingredients.php" in Cookbook.CodeIngredients.

--
Ben Wilson
" Mundus vult decipi, ergo decipiatur"




More information about the pmwiki-users mailing list