Re: [Saute-develop] Code Split II
Status: Alpha
Brought to you by:
heiseltc
|
From: Conan H. <hei...@ya...> - 2001-09-07 05:43:02
|
I've been reading a lot this week about object oriented Perl
programming and getting some into the Extreme Programming methods.
I'm thinking this is the way to go. This is going to be my main
focus for the next week, so I won't be doing any CVS commits or
releases.
So far, I see that there are two ways to go: few modules or many
modules. Either way, I'd like to implement object oriented methods.
I'm not sure if anyone is very familiar with them. To me OO seems
_really_ useful but WAY too hiped. That kind of turned me off at
first, but now that I know more, I think it would be really good in
our situation.
Back to the ways to go. Having many modules would make working as a
group _much_ easier, but would be a lot of files (although that may
not be that bad). It also allows whoever is working on one to only
have to deal with his/her module. Also, people when working on a new
feature to add, can do so without having to worry about if it
conflicts with what someone else is doing. Or we could go the
few-modules way, which seems simpler on the outside but more complex
in a cooperative environment. So, I'm leaning heavily on the having
more modules side.
My idea so far (I'm still reading and learning so my opinion may
change) is to have is set up somewhat like this:
1. saute.pl - main window and associated calls
2. database.pm - the only one that handles interaction with the
database
3. recipe.pm - add, edit, view recipes
4. search.pm - performs the searches
5. [more in the future] - print, meal plans, nutritional value, etc.
The basic idea is for none of these programs to care how the others
do their job. Instead they will each have a set of functions that
others can call with a set return. For example if the main program
wants a list of programs to display, it may call search and ask for a
list of all recipes with certain requirements:
@recipies = search::getlist("category=Soup");
search.pm would then in the getlist sub call on the database module
to return to it the items it needs, which it would return to
saute.pl. This may sound a bit round about, but makes it way easier
to develop when all you need to worry about when getting the main
list is one call (maybe two) and the parameters.
Now, all of this is going to require some serious designing and some
code rewriting, but I think that doing it now will make it better for
all of us in the future.
Hopefully, I will have some code for everyone's review in a week.
thanks all,
conan.
--- "Olivier.Roch-Vilato" <Oli...@wa...> wrote:
> I've followed the answer to your question in Perl Monks
> and did a sauteDB.pm (I will add comments) module which is an
> interface betwen saute.pl and MySQL
>
> For the rest of the code i'm still wondering,
> i'm thinking of a UI module which deals with all windows but don't
> know yet how to implement it
>
> What's your opinion ?
>
>
>
> A+
>
> Olivier
>
>
>
> CHANGES
> -------------
>
> Modify saute.pl to work with sauteDB.pm
>
> sauteDB.pm public methods :
> new : to create a new instance
>
> getCategories : retreive categories list
>
> hasCategory : is 'category' in database ?
>
> addCategory : add 'category' to database if not there
>
> delCategory : remove 'category' from database
>
> getIngredients : retreive ingredients list
>
> hasIngredient : is 'ingredient' in database ?
>
> addIngredient : add 'ingredient' to database if not there
>
> delIngredient : remove 'ingredient' from database
>
> getUnits : retreive units (measures) list
>
> hasUnit : is 'unit' in database ?
>
> addUnit : add 'unit' to database if not there
>
> delUnit : remove 'unit' from database
>
> getCategoryRecipes : get IDs of all recipes which are in 'category'
>
> getRecipes : get IDs of all recipes
>
> getRecipe : get a recipe (ex get_recipe_info)
>
> addRecipe : save / update a recipe (ex save_recipe)
>
> delRecipe : remove a recipe from the database
>
> searchRecipes : search recipes (ex search_function)
>
>
>
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
|