|
Posted by Steve on 11/09/06 14:54
"sTony" <rWorldDesigns@yahoo.ca> wrote in message
news:ZqG4h.48307$P7.15123@edtnps89...
| Ok, so my website is comming along just fine, but now I find my lack of
| knowledge weighing down on me. I'm at a position where I can either store
| some data about files in my database, or, I can just add the information
| into the filename, but which is faster? Understand that I'm not always
| opening the file, but I'm going to need to list info about the file, such
as
| who wrote it and when. So which is likely to be faster? Storing the
| information in the database (mysql) or in should I add it to the filename
of
| the file. Either way will work, I'd just like to use the way thats faster
so
| as to not slow my site down unneccessarily. ohh.. and how fast is php
| itself.
it's not always about speed, tony. in this case, not only would it be faster
to store your info in a db but, it also reduces the amount of code you must
write in order to get the information you want. further, interfacing with a
db gives you a unified and common methodology for doing so...meaning, those
you work with on a project don't have to guess at how to interpret your
home-brewed naming convention - they simply write an easily understood
select query.
most of us know what you're trying to do. it is so common that it has a
term - "magic values". it's practice has NO place in sound architectural
software design! the ONLY exception that i've found where such a thing is
half-way palatible is naming tables in a db...and this ONLY because of
licensing costs. ex.,
$sql = "
SELECT *
FROM " . $company . "_billing
";
this is magic at its finest. however, doing this saves thousands of dollars
per year should you license by instance or by user...i have oracle in mind
here. EVEN STILL, one could, and should, have created that table to include
a "company" column in it. again, the only way i can justify this is
performance should one have multiple companies with millions of rows each.
all that to say, DON'T be a magician! be a PROGRAMMER who designs GOOD
underlying architecture.
[Back to original message]
|