Re: PHP MySQL object question



AqD wrote:
On Sep 17, 8:43 am, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
AqD wrote:
On Sep 16, 6:16 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
AqDwrote:
On Sep 16, 5:05 am, William Gill <nore...@xxxxxxxxxxx> wrote:
boxoft wrote:
Hi,
Ruby on Rails implements ORM very well.
As for PHP,you might be interested inhttp://www.doctrine-project.org/.
Regards,
Box
boxoft...help people, serve people.
Both interesting, but I'm at a point right now where learning a new
language, or application would be next to impossible.
It's easier to learn & use ORM rather than to write object<->db
interface by yourself ;)
Nonsense. Writing simple db objects such as this is quite easy.
Simple objects, yes.
How about this:
class Car
class SpecialCar extends Car
SELECT * FROM Car where color = 'red';
The list of result should include SpecialCar(s) and have them in
correct type (and all derived classes from 'Car').
And the driver (another class) and other properties in 'Car' should be
fetched, too. Being fetched with the result list (by join) or later
when they're actually accessed. The laziness of related objects must
also be customized, in model classes and/or in query.
And a .save method to save this object and all related ones (also
check for modification), and make inserts if needed.
That is what ORMs like Hibernate are supposed to do for you.
That's one way to do it. There are many others.

But even here you don't need an ORM to do your work. It is quite easy
to do it yourself.

Easy but a waste of time.

Why bother to write code by yourself when you can just use some
frameworks?


No waste of time at all. It takes me very little time to create the classes I need for a database. I've got a lot of skeleton code handy. But then I've been doing it for many years.

And my classes do what I need them to do efficiently. None of the extra overhead of your ORM, and custom validation of data is very easy.

I suspect it takes me less time to create the classes from my skeletons than it does you to implement the same code in Hibernate.

Products like Hibernate are good for beginning programmers; they are OK for programmers with fair experience. But few experts I know use them.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

.



Relevant Pages

  • Re: PHP MySQL object question
    ... class SpecialCar extends Car ... correct type (and all derived classes from 'Car'). ... The laziness of related objects must ... But even here you don't need an ORM to do your work. ...
    (comp.lang.php)
  • Re: PHP MySQL object question
    ... class SpecialCar extends Car ... correct type (and all derived classes from 'Car'). ... The laziness of related objects must ... But even here you don't need an ORM to do your work. ...
    (comp.lang.php)
  • Re: PHP MySQL object question
    ... Ruby on Rails implements ORM very well. ... class SpecialCar extends Car ... correct type (and all derived classes from 'Car'). ... The laziness of related objects must ...
    (comp.lang.php)
  • Re: PHP MySQL object question
    ... class SpecialCar extends Car ... correct type (and all derived classes from 'Car'). ... The laziness of related objects must ... But even here you don't need an ORM to do your work. ...
    (comp.lang.php)
  • Re: Object Relational Mappers are evil (a meditation)
    ... programmers seem to be allergic to typing SQL. ... to make bad database designs. ... if you want, I'll stick to my ORM, tyvm. ...
    (comp.lang.python)