NYCPHP Meetup

NYPHP.org

[nycphp-talk] Database vs. Code

Gary Mort garyamort at gmail.com
Mon Nov 30 11:09:37 EST 2009


On Mon, Nov 30, 2009 at 3:30 AM, David Krings <ramons at gmx.net> wrote:

> matt at atopia.net wrote:
>
>> So that has made me want to use stored procedures, but that will limit us
>> to this specific database software (mysql).
>>
>
> The question is if this is a problem. In my experience, stored procedures
> can add performance and allow for code to run on a different server than the
> web server.
>

My experience is slightly different.  Stored procedures are great for making
code-independent business logic, but if they aren't fully documented and
everyone made aware of them, they can also create problems.

For example, if every time you create a user record, you also create some
empty user profile, customer profile, and supplier profile records to go
with that user via a trigger - you can very well have a coder who looks at
the action[create a user through the webform] and then the database
changes[4 records created], so in his new code in a different language he
duplicates the action - suddenly every user he creates has 2 customer
profile records, 2 supplier profiles, and 2 user profiles - 1 he manually
creates and 1 that the triggers create.

So, since you have to fully document what the result is anyway, in the end
it doesn't matter if you use stored triggers and procedures or have each
person code it individually.  It's more a matter of taste and less of
function.

-- 
----
Hudson Valley Sudbury School
What GPL is for application users
Our school is for students
Help your children grow, change, and learn
Let your child direct, control, amend
Check out http://www.sudburyschool.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20091130/aa681f7a/attachment.html>


More information about the talk mailing list