RE: Re: Suggestions for class design

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> on 09/19/2005 02:33 PM Chris W. Parker said the following:
> > Let's take for example a class called 'Customer' that (obviously)
> > manipulates customers in the database. Here is a very basic Customer
> > class. (Data validation and the like are left out for brevity.)
> 
> This is a basic object persistence problem.
> 
> 
> > (Unless I've already got some major design flaws I think we should be
> > good to go.)
>  >
>  > Where I get tripped up is when I realize I'll need to at some point
>  > get more than one customer at a time and thus I want to add a method
>  > called 'get_customers()'.
> 
> 
> Yes, there is a problem. You are trying to retrieve objects into memory
> before they exist. It makes more sense that you retrieve objects using a
> factory class.
> 
> That is the approach of Metastorage. You may want to take a looka at
> Metastorage before you reinvent the wheel.

Hi Manuel,

I very much understand your desire to promote your various projects, but the
original poster is asking a question that is basic to any programmer's
development in object-oriented coding.

Once he understands how to solve class abstraction problems such as the one
he is asking about, he will be better equipped to deal with a wider range of
application development tasks.

This is not to trivialize your Metastorage project (or, to be more accurate,
I know nothing about it, so it's not my place to trivialize it or
otherwise), but to point out that 'out-of-the-box' solutions to fundamental
coding development problems probably ultimately makes for a poorer
programmer. I could well be wrong, but it seems this is a case of "give a
man a fish" as opposed to "teach a man to fish".

Also, and separate from above, I don't understand the relevance of your
comment, "You are trying to retrieve objects into memory before they exist".
Unless I'm horribly mistaken [1], the original poster has developed a class
that abstracts a single customer, and is asking the list for suggestions in
how to best approach a need to be able to abstract collections of customers.
This is a normal application development issue, and for the life of me I
can't grasp how your comment relates.

Much warmth,

Murray
---
"Lost in thought..."
http://www.planetthoughtful.org

[1] And it wouldn't be the first time!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux