Re: [PHP] Re: Where to start!
I doubt this will have any sway on the contributors to this thread, but I ran across a db normalization rule of thumb yesterday in a tutorial for another language: Normalize until it hurts; De-normalize until it works. I lean towards finding a middle ground, so this makes sense to me. --David. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes wrote: I do not agree that creating a database which is normalised to3NF is a waste of time. It isn't always, but it is sometimes. When time is a (significant) factor, getting something up and running (which has acceptable performance) may be more impotant than creating a technically perfect solution. In fact creating something that is technically perfect is often just a pipe dream for programmers. On the contrary, a totally un-normalised database is nothing but a problem waiting to bite you in the a**e. So you can: a) Create something that gets you to market as fast as possible that is good enough. b) Optimise/adjust the structure later. IME though, b) rarely happens. Computer systems have a habit of growing over time Really? ...and if you don't follow the rules of normalisation your database will end up as the biggest bottleneck. Granted it's more likely, but not a given. You just need developers who have discipline, oh and a good memory helps. Anyone who doesn't know how to reach 3NF shouldn't be designing databases. Rubbish. It helps, in particular for how you can optimise you structure without duplicating data (too much), but shouldn't be a requirement. Me personally I've always found it very productive to take a few hours before I begin coding a project, to roughly flow-chart the basics of the application, and then layout the db on paper to get a graphical view of the tables I'll need, how they relate or don't relate to one another. That way when I do actually create the db I'm usually at 3NF. -- Mark - the rule of law is good, however the rule of tyrants just plain sucks! Real Tax Reform begins with getting rid of the IRS. == Powered by CentOS5 (RHEL5) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Where to start!
As a person who has been developing database applications for several decades my advice is to ALWAYS start with the database design, then build your code around that. The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. OO purists will say that you should start with your class hierarchy and leave the database till last as it is a mere implementation detail. This usually results in a software structure which is different from the database structure - known as Object-Relational impedance mismatch - and requires the addition of an extra layer of software known as an Object Relational Mapper (ORM). I consider these to be EVIL, as discussed in http://www.tonymarston.net/php-mysql/object-relational-mappers-are-evil.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org Jorge [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] First I would like to say that I have had PHP experience but not enough to say I am a PHP developer. I want to use PHP to build a site that uses MySQL, I am building it from scratch so I don't know where to start, should I start with PHP and design a database around my code, or should I designs the db and design the site are the db. is it just a matter of preference or is there a recommended way to do this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. Not true. If your needs are simple for example, normalisation can increase the complexity of a schema, hence increasing development time needed. Sometimes for example you could use something like a SET type, and search for something in it using FIND_IN_SET(). -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. Not true. If your needs are simple for example, normalisation can increase the complexity of a schema, hence increasing development time needed. Sometimes for example you could use something like a SET type, and search for something in it using FIND_IN_SET(). I disagree. The database should ALWAYS be normalised to at least the 3rd normal form. Sometimes going beyond that to 4NF, 5NF or 6NF becomes too complex. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Tony Marston wrote: Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. Not true. If your needs are simple for example, normalisation can increase the complexity of a schema, hence increasing development time needed. Sometimes for example you could use something like a SET type, and search for something in it using FIND_IN_SET(). I disagree. The database should ALWAYS be normalised to at least the 3rd normal form. Sometimes going beyond that to 4NF, 5NF or 6NF becomes too complex. Sometimes it's just a waste of time. If your site isn't that busy, and speed isn't crucial, why waste the time using a more complicated database structure? I do not agree that creating a database which is normalised to3NF is a waste of time. On the contrary, a totally un-normalised database is nothing but a problem waiting to bite you in the a**e. Computer systems have a habit of growing over time, and if you don't follow the rules of normalisation your database will end up as the biggest bottleneck. Anyone who doesn't know how to reach 3NF shouldn't be designing databases. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Tony Marston wrote: Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. Not true. If your needs are simple for example, normalisation can increase the complexity of a schema, hence increasing development time needed. Sometimes for example you could use something like a SET type, and search for something in it using FIND_IN_SET(). I disagree. The database should ALWAYS be normalised to at least the 3rd normal form. Sometimes going beyond that to 4NF, 5NF or 6NF becomes too complex. Sometimes it's just a waste of time. If your site isn't that busy, and speed isn't crucial, why waste the time using a more complicated database structure? -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
I do not agree that creating a database which is normalised to3NF is a waste of time. It isn't always, but it is sometimes. When time is a (significant) factor, getting something up and running (which has acceptable performance) may be more impotant than creating a technically perfect solution. In fact creating something that is technically perfect is often just a pipe dream for programmers. On the contrary, a totally un-normalised database is nothing but a problem waiting to bite you in the a**e. So you can: a) Create something that gets you to market as fast as possible that is good enough. b) Optimise/adjust the structure later. IME though, b) rarely happens. Computer systems have a habit of growing over time Really? ...and if you don't follow the rules of normalisation your database will end up as the biggest bottleneck. Granted it's more likely, but not a given. You just need developers who have discipline, oh and a good memory helps. Anyone who doesn't know how to reach 3NF shouldn't be designing databases. Rubbish. It helps, in particular for how you can optimise you structure without duplicating data (too much), but shouldn't be a requirement. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
On May 5, 2008, at 6:21 AM, Tony Marston wrote: Anyone who doesn't know how to reach 3NF shouldn't be designing databases. Just out of curiosity... How many Records do you need to have in a database before you'll start seeing a performance boost from doing that? I have written a few database apps that work quite well with no formal training in PHP or Database design.. Don't want to start any wars here... I'm just curious :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Anyone who doesn't know how to reach 3NF shouldn't be designing databases. Just out of curiosity... How many Records do you need to have in a database before you'll start seeing a performance boost from doing that? There's no hard and fast rule. When it becomes a chore to maintain I suppose (which you could say, is more than one...). -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I do not agree that creating a database which is normalised to3NF is a waste of time. It isn't always, but it is sometimes. When time is a (significant) factor, getting something up and running (which has acceptable performance) may be more impotant than creating a technically perfect solution. In fact creating something that is technically perfect is often just a pipe dream for programmers. You obviously do not understand what technically perfect means when it comes to data normalisation. 3NF is considered to be good enough while 4NF, 5NF and 6NF is considered to be perfect. But there is such a thing as too perfect which is why even C J Date (the father of relational theory) said that de-normalsation is an acceptable practice. Every database designer worth his salt should be able to achieve 3NF without breaking into a sweat, while 4/5/6NF are entirely optional, and only worth it under paricular circumstances. On the contrary, a totally un-normalised database is nothing but a problem waiting to bite you in the a**e. So you can: a) Create something that gets you to market as fast as possible that is good enough. b) Optimise/adjust the structure later. IME though, b) rarely happens. That's why solutions which are thrown together are often incapable of being expanded to include new requirements. If you create a throw away solution then never try to expand it, simply throw it away and start again. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Computer systems have a habit of growing over time Really? ...and if you don't follow the rules of normalisation your database will end up as the biggest bottleneck. Granted it's more likely, but not a given. You just need developers who have discipline, oh and a good memory helps. Anyone who doesn't know how to reach 3NF shouldn't be designing databases. Rubbish. It helps, in particular for how you can optimise you structure without duplicating data (too much), but shouldn't be a requirement. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Jason Pruim [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On May 5, 2008, at 6:21 AM, Tony Marston wrote: Anyone who doesn't know how to reach 3NF shouldn't be designing databases. Just out of curiosity... How many Records do you need to have in a database before you'll start seeing a performance boost from doing that? I have written a few database apps that work quite well with no formal training in PHP or Database design.. Don't want to start any wars here... I'm just curious :) It is not the number of records which is the deciding factor - it is: a) is the data want in the right place (for easy access)? b) can it be upated easily? For example, many years ago I had to take over maintenance of a database which was designed b someone who was not technically competent. There were 2 paticular tables, order_header and order_lines. The order had a status value, as did each of the order lines. So where did this twit choose to store the order status? - you've guessed it, on the order_line record. His rationale was that when traversing the order_line recods it was easier to have the order_status on that record instead of having to perform a separate read of the order_header record. The flaw in this argument was that when you wanted to change the status of an order you had to update every order_line record. Problems arose later when a software bug (introduced by him, BTW) left different values for order_status across different order_lines. The rules of normalisation dictate that order_status goes on the order_header record, and is not dupliacted across several order_line records. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
You obviously do not understand what technically perfect means when it comes to data normalisation. Obviously. That's why solutions which are thrown together are often incapable of being expanded to include new requirements. I've never adovocated throwing together a solution. Merely that the solutions proposed by programmers or database designers aren't always necessary. If you create a throw away solution then never try to expand it, simply throw it away and start again. For what reason? If you create a working solution and never try to expand it, chances are you don't need to, so what's the advantage in throwing it away and generating work for yourself in reproducing it? -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
On Mon, 2008-05-05 at 10:31 +0100, Tony Marston wrote: Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. Not true. If your needs are simple for example, normalisation can increase the complexity of a schema, hence increasing development time needed. Sometimes for example you could use something like a SET type, and search for something in it using FIND_IN_SET(). I disagree. The database should ALWAYS be normalised to at least the 3rd normal form. Sometimes going beyond that to 4NF, 5NF or 6NF becomes too complex. I'd have to agree for the most part. There are times when you specifically will include redundancy for speed, but as a newbie you probably won't be thinking about that. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
On Mon, 2008-05-05 at 11:10 +0100, Richard Heyes wrote: Tony Marston wrote: Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The database must be properly normalised otherwise it will be difficult to get at the data you need in an efficient manner. Not true. If your needs are simple for example, normalisation can increase the complexity of a schema, hence increasing development time needed. Sometimes for example you could use something like a SET type, and search for something in it using FIND_IN_SET(). I disagree. The database should ALWAYS be normalised to at least the 3rd normal form. Sometimes going beyond that to 4NF, 5NF or 6NF becomes too complex. Sometimes it's just a waste of time. If your site isn't that busy, and speed isn't crucial, why waste the time using a more complicated database structure? Hmmm, my last post should have clarified I agreed primarily with 3rd normal form. Higher levels don't usually have the same kind of payoff. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
On Mon, 2008-05-05 at 13:51 +0100, Tony Marston wrote: Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I do not agree that creating a database which is normalised to3NF is a waste of time. It isn't always, but it is sometimes. When time is a (significant) factor, getting something up and running (which has acceptable performance) may be more impotant than creating a technically perfect solution. In fact creating something that is technically perfect is often just a pipe dream for programmers. You obviously do not understand what technically perfect means when it comes to data normalisation. 3NF is considered to be good enough while 4NF, 5NF and 6NF is considered to be perfect. Perfectly tedious ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You obviously do not understand what technically perfect means when it comes to data normalisation. Obviously. That's why solutions which are thrown together are often incapable of being expanded to include new requirements. I've never adovocated throwing together a solution. Merely that the solutions proposed by programmers or database designers aren't always necessary. I never use databases which have been designed by others, especially DBAs who have fancy but often unrealistic ideas on how databases should be designed. I design the databases myself, then write the code to access them. If I later find that I need to change the database design then I can do so without having to ask anyone's permission. If you create a throw away solution then never try to expand it, simply throw it away and start again. For what reason? If you create a working solution and never try to expand it, chances are you don't need to, so what's the advantage in throwing it away and generating work for yourself in reproducing it? Your experience in the real world must be very limited as it is often the case where a customer starts off with a simple requirement then keeps expanding it as time goes by as he dreams up more things that the system should do for him. If at day #1 you say these reqirements are very simple, therefore require nothing more than a cheap and chearful solution which can be thrown together in a few minutes you end up with a system that is not designed to be expanded. As soon as the first enhancement request comes in you will find yourself on the tail of a snake. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Your experience in the real world must be very limited Clearly. as it is often the case where a customer starts off with a simple requirement then keeps expanding it as time goes by as he dreams up more things that the system should do for him. If at day #1 you say these reqirements are very simple, therefore require nothing more than a cheap and chearful solution which can be thrown together in a few minutes you end up with a system that is not designed to be expanded. As soon as the first enhancement request comes in you will find yourself on the tail of a snake. Alternatively you make a solution that fulfils the requirements of the customer, without being cheap and cheerful and is designed well to accomodate future modifications, and make it resolutely clear that any future modification may take longer since schema changes may be required. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Your experience in the real world must be very limited Clearly. as it is often the case where a customer starts off with a simple requirement then keeps expanding it as time goes by as he dreams up more things that the system should do for him. If at day #1 you say these reqirements are very simple, therefore require nothing more than a cheap and chearful solution which can be thrown together in a few minutes you end up with a system that is not designed to be expanded. As soon as the first enhancement request comes in you will find yourself on the tail of a snake. Alternatively you make a solution that fulfils the requirements of the customer, without being cheap and cheerful and is designed well to Then surely designed well would include a normalised database? -- Tony Marston http://www.tonymarston.net http://www.radicore.org accomodate future modifications, and make it resolutely clear that any future modification may take longer since schema changes may be required. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Then surely designed well would include a normalised database? Not necessarily. You could for example have a database that accommodates future needs without being completely normalised. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Where to start!
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Then surely designed well would include a normalised database? Not necessarily. You could for example have a database that accommodates future needs without being completely normalised. That depends on your definition of completely normalised. Up to 3NF is normally sufficient, whereas up to 6NF might be excessive. But any degree of normalisation is better than not having any normalisation at all. The point I am trying to make is that a totally unnormalised database is something which a competent designer will tend to avoid like the plague. Only a complete novice will throw together a database which has 0NF. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Where to start?
www.php.net is a beauty for function reference Your best place to start is here: http://www.devshed.com/Server_Side/PHP/PHP101/PHP101_1/page1.html 5 tutorials on the basics, plus devshed has 100s of tutorials on everything. Simon Thurtle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I am looking into learning PHP, I have a good understanding of HTML, JS and I know a little Perl. Firstly I know PHP is all server side and so a damn sight different from the above, but will they help me at all? Secondly where do I start? Are there any good on-line resources and or books that anyone knows? I am plannig to develop an E-comm solution us Oscommerce, does anyone know if this is any good or is naff? Any hints, tips or pointers would be greatly appreciated. Thanks, Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Where to start?
Knowing any kind of programming language will help in learning PHP. If you understand variables, arrays, if/else structures, etc., it allows you to skim over some of the basics quickly. I had very little programming experience, but, learned a lot from the book PHP and MySQL Web Development by Luke Wellington and Laura Thomson. This was a about 2 years ago, though, and if they haven't come out with an update, then it's probably a little too outdated by now. Also, I learned LOTS from a number of guys on this newsgroup who generously offer their advice and wisdom. The sites that a few others mentioned are also helpful. Once you start programming, ALWAYS check out the online PHP help on php.net. It's really excellent and is chock full of input from users who offer sample scripts and solutions for all kinds of things. It's the best resource anywhere. I also get PHP Architect (phparch.com), a PDF publication that has some good and helpful stuff in it. As you can see, there are lots of online resources for PHP and MySQL. Monty From: [EMAIL PROTECTED] (Simon Thurtle) Organization: Mainlink Reply-To: Simon Thurtle [EMAIL PROTECTED] Newsgroups: php.general Date: Thu, 5 Jun 2003 13:36:14 +0100 To: [EMAIL PROTECTED] Subject: Where to start? Hi all, I am looking into learning PHP, I have a good understanding of HTML, JS and I know a little Perl. Firstly I know PHP is all server side and so a damn sight different from the above, but will they help me at all? Secondly where do I start? Are there any good on-line resources and or books that anyone knows? I am plannig to develop an E-comm solution us Oscommerce, does anyone know if this is any good or is naff? Any hints, tips or pointers would be greatly appreciated. Thanks, Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php