Re: Method Names (was: Stolen Ideas)
[prev]
[thread]
[next]
[Date index for 2004/08/11]
On Wed, Aug 11, 2004 at 09:20:42AM -0500, Jay Strauss wrote:
> ** Please don't take this as criticism **, just since it seems like you're
> soliciting ideas, here is mine
Of course I take it as criticism!
I just happen to see criticism as a good thing :)
> I've always been sorta curious/befuddled about the CDBI method names.
> It seems like CDBI never went with standard OO methods or standard
> SQL, instead using both and neither.
I'll blame Schwern for this. :)
They don't really bother me; probably because I've been working with
them for so long.
I'm not really a fan of a select() method. Having it automatically
integrate with AbstractSearch is a possibility, but I'm still working
out my Grand Master Plans for search :)
> find_or_create should at least be retrieve_or_create (just to stay
> internally consistent)
find_or_create does seem slightly strange, but retrieve_or_create
doesn't work for me, either as a name, or as a description of what it
does, as it doesn't take the same arguments as create(). It's closer to
search_or_create(), but that would just be wrong.
> create vs insert or new
this one I agree with. It should probably be insert(). It'll make it
much clearer that it actually triggers the SQL INSERT command
straight-away, and doesn't need an update() like a normal set does.
> set vs update
This one I think is definitely fine as it is. set() changes the values
in the object. update() issues the UPDATE to the database.
> add_trigger vs new_trigger
> or ->new("trigger","before_insert",\&before_insert_code);
I don't see what's wrong here? This just comes from Class::Trigger.
There isn't a lot of point in changing its method names, [1]
->new(trigger ...) just seems wrong.
In general I'm not a big fan of massively overloaded methods like that.
> add_constructor vs new_select or ->new("select",recent_data,qq{create_date >
> ?});
add_constructor does exactly what it says on the tin - it adds a new
constructor. new_select() just doesn't do it for me.
> Then tackle the whole using database functions like sysdate elegantly in
> CDBI :)
Syntax, people, give me syntax!
Tony
|
(message missing)
|