Re: new keyword combined with other things...

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

 



On Wed, Dec 8, 2010 at 9:31 AM, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx>wrote:

> I agree. My advice for SQL is always to learn SQL rather than use a
> bunch of active record functionality. But I'm sure people think I'm just
> a curmudgeonly old turd. ;-}
>

Yes, absolutely learn SQL so you understand what's happening under the
covers, AND then use a framework to abstract much of it away. I cannot speak
to ActiveRecord, but ORM frameworks like Hibernate in the Java world save
countless man-hours of work every day, time that can be spent on making
better applications.

On Wed, Dec 8, 2010 at 7:14 AM, Tommy Pham <tommyhp2@xxxxxxxxx> wrote:

> The only need I see for this is to build the query dynamically...
> which should be very rare since all those function calls are
> expensive, IMO.
>

Function calls haven't been expensive since 1992. ;) The cost of running the
SQL query itself will dwarf any function calls made to build the query. The
gains in developer productivity vastly outweigh the small gains to be had by
micro-optimizing away function calls and other abstractions, and developer
time is much more expensive than CPU time.

Start with code that is easy to understand, write, and debug. Measure the
performance if it is too slow, find the slow parts using a profiler, and
optimize them. Nine times out of ten you can gain more by changing your
algorithm than by removing function calls.

David

[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