|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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...-are-evil.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""Jorge"" <japreja@msn.com> wrote in message news:E0.C0.40102.C04BE184@pb1.pair.com... > 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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mon, 2008-05-05 at 01:15 -0600, Jorge wrote: > 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? Database first. You can tailor it when you write your code if you've missed stuff, but in a "from-scratch-project" it should be 90% determined before you write the code. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> 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 | +----------------------------------------+ |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Monday 05 May 2008 09:15:29 Jorge wrote:
> 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 I did it all from scratch (both the learning, and creating), did it the other way around, I started with PHP, REGRETTED that for some time. Start off with the db structure, then go over it again, and again for good measure. -- --- Børge Holen http://www.arivene.net |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"Richard Heyes" <richardh@phpguru.org> wrote in message
news:481ED03B.7090200@phpguru.org... > > 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 | > +----------------------------------------+ |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
I usually start with the code, en create the db as soon as i have code that
uses it. Coz of this i dont really think about the db design, what results in a huge and uneffective database. I think you could best start with writing down the functions your site needs, then creating the db and then finally write the code. ticom/timothy de vries ""Jorge"" <japreja@msn.com> wrote in message news:E0.C0.40102.C04BE184@pb1.pair.com... > 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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Tony Marston wrote:
> "Richard Heyes" <richardh@phpguru.org> wrote in message > news:481ED03B.7090200@phpguru.org... >>> 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 | +----------------------------------------+ |
|
![]() |
| Outils de la discussion | |
|
|