OOP and database for business site
Moderator: General Moderators
OOP and database for business site
Hi. I'm going to write an online web site and have the following questions.
1 - Which language is recommended to do so, php or asp?
2 - Is it secure to do it with php?
3 - I've already write a few sites in plain php. Would it be better to use OOP php instead, since the web site is hoped to be constantly growing, with lots of new features every month?
4 - How good is OOP implemented in php?
5 - Does anyone know any online guide which explains how to design an UML diagram for a php-based web site?
6 - Which database is recommended for a large web site, MySQL, Postgre or Oracle? I've already worked with MySQL, but I would like to know if it is recommended for a website that manages, for example, 60000 users. It's recommendable or should I use another db?
I would like someone tell me what's the best choice for each point and WHY.
Thanks
1 - Which language is recommended to do so, php or asp?
2 - Is it secure to do it with php?
3 - I've already write a few sites in plain php. Would it be better to use OOP php instead, since the web site is hoped to be constantly growing, with lots of new features every month?
4 - How good is OOP implemented in php?
5 - Does anyone know any online guide which explains how to design an UML diagram for a php-based web site?
6 - Which database is recommended for a large web site, MySQL, Postgre or Oracle? I've already worked with MySQL, but I would like to know if it is recommended for a website that manages, for example, 60000 users. It's recommendable or should I use another db?
I would like someone tell me what's the best choice for each point and WHY.
Thanks
1) PHP.
It's got a much wider support base. If you have any problems, it's much easier to get help (just look at this forum).
It's open source - cheaper to run/upgrade
I'm not sure, but I think it's more powerful in that it has more built-in, useful functions. It has many tie-ins with other libraries as well.
(Honestly, I don't think anyone here will recommend ASP over PHP - this is a PHP forum after all
).
2) I'm not versed in this too much, but I have read articles that said the main security flaw in PHP is PEBKAC (Problem Exists Between Keyboard And Chair). In other words, PHP is secure, you just need to be secure in the way you use it (IE, don't store password in the DB, don't store CC info in a text file in the web root - stuff like that).
3) Object oriented programming is only good if the application needs it. If the site will be large, and have dynamic features, I would recommend using it, as it's much easier to upgrade when things are abstracted a little.
4) PHP 5 has massively improved object implementation over PHP4 to help it get more in-line with the Java implementation. I use 4.3.3, though, and I've never found myself wanting any more OOP features than what it has.
5) UML is the devil*.
6) MySQL is certainly one of the easiest DB's to administer, from what I've worked on.
Postgres is much more difficult, though that may just be because I don't have as much experience with Postgres.
I'f you've got the resources for Oracle, I'd be tempted to use it. At the very least, you can put on your resume that you've worked with Oracle. However, I don't really think the power of Oracle is needed for a website - really only for organizational intranets and online stores and the ilk. Regardless of which one you pick, I strongly recommend creating a DB abstraction layer so if you decide to change your mind later, you only have to change one class, not every file that accesses the DB.
* I had a bad experience with it in university. It seems way more complicated than is necessary. As a result, I haven't looked into how to use it to diagram a site.
It's got a much wider support base. If you have any problems, it's much easier to get help (just look at this forum).
It's open source - cheaper to run/upgrade
I'm not sure, but I think it's more powerful in that it has more built-in, useful functions. It has many tie-ins with other libraries as well.
(Honestly, I don't think anyone here will recommend ASP over PHP - this is a PHP forum after all
2) I'm not versed in this too much, but I have read articles that said the main security flaw in PHP is PEBKAC (Problem Exists Between Keyboard And Chair). In other words, PHP is secure, you just need to be secure in the way you use it (IE, don't store password in the DB, don't store CC info in a text file in the web root - stuff like that).
3) Object oriented programming is only good if the application needs it. If the site will be large, and have dynamic features, I would recommend using it, as it's much easier to upgrade when things are abstracted a little.
4) PHP 5 has massively improved object implementation over PHP4 to help it get more in-line with the Java implementation. I use 4.3.3, though, and I've never found myself wanting any more OOP features than what it has.
5) UML is the devil*.
6) MySQL is certainly one of the easiest DB's to administer, from what I've worked on.
Postgres is much more difficult, though that may just be because I don't have as much experience with Postgres.
I'f you've got the resources for Oracle, I'd be tempted to use it. At the very least, you can put on your resume that you've worked with Oracle. However, I don't really think the power of Oracle is needed for a website - really only for organizational intranets and online stores and the ilk. Regardless of which one you pick, I strongly recommend creating a DB abstraction layer so if you decide to change your mind later, you only have to change one class, not every file that accesses the DB.
* I had a bad experience with it in university. It seems way more complicated than is necessary. As a result, I haven't looked into how to use it to diagram a site.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
1) PHP. Same as pickle.
2) As for the base language, PHP is secure. However, keep in mind that anything you code is only as secure as *you* make it.
3) OOP. OO programming in a large scale environment is better since it is easier to come back and make changes to.
4) PHP's OO model is fairly well defined (as of php5) for a full list of php OO features you should check out http://www.zend.com/php5/articles/engin ... hanges.php
5) Check out http://uml.sourceforge.net/documentation.php. Or for a really long, and drawn out text: http://www.comptechdoc.org/independent/ ... index.html or: http://www.jeckle.de/uml_pub.htm (among hundreds of thousands of other links).
6) MySQL I'm sure can handle all of your needs. I've tested mysql with databases (combined.. for one site) totaling over 500Gigs and Mysql has had no problems (at all). No need to waste time or resources setting up/testing/learning any other db's if you already have experience using Mysql (Unless you're trying to put a few more lines on your resume).
2) As for the base language, PHP is secure. However, keep in mind that anything you code is only as secure as *you* make it.
3) OOP. OO programming in a large scale environment is better since it is easier to come back and make changes to.
4) PHP's OO model is fairly well defined (as of php5) for a full list of php OO features you should check out http://www.zend.com/php5/articles/engin ... hanges.php
5) Check out http://uml.sourceforge.net/documentation.php. Or for a really long, and drawn out text: http://www.comptechdoc.org/independent/ ... index.html or: http://www.jeckle.de/uml_pub.htm (among hundreds of thousands of other links).
6) MySQL I'm sure can handle all of your needs. I've tested mysql with databases (combined.. for one site) totaling over 500Gigs and Mysql has had no problems (at all). No need to waste time or resources setting up/testing/learning any other db's if you already have experience using Mysql (Unless you're trying to put a few more lines on your resume).
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Re: OOP and database for business site
1 - I recommend using the language your are most comfortable using and that's appropriate for the project. If that's ASP so be it.
2 - PHP.org seems to be rather quick to fix any potential security holes. However, your security is only as good as the weakest component.
3 - Use whatever methodology that fits your project, if your talking 100000+ lines of code then OOP may be a good chose. Just remember PHP isn't Java there's no run-environment.
4 - Either PHP4 or PHP5 should be sufficient to implement OOP.
2 - PHP.org seems to be rather quick to fix any potential security holes. However, your security is only as good as the weakest component.
3 - Use whatever methodology that fits your project, if your talking 100000+ lines of code then OOP may be a good chose. Just remember PHP isn't Java there's no run-environment.
4 - Either PHP4 or PHP5 should be sufficient to implement OOP.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
pro asp
pro php
response to the pro php
pro asp security
and many others..
Now i'm in no way a traitor (would never go over asp.net.. php suit me very well)
but I also look at the facts
pro php
response to the pro php
pro asp security
and many others..
Now i'm in no way a traitor (would never go over asp.net.. php suit me very well)
but I also look at the facts
Thank you all for the suggestions, they were very usefull.
Good that idea about DB class, but I think i'm not going with OOP. (although I will split the access functions from the rest)
I have another question regarding MySQL. I see it is capable to handle large databases. How good is to handle multiple connections (or it depends solely of the server it is installed in?) I would like to ad I will work on an acution web site, so there will be features involving money managment.
Does anyone know any site (not mysql site) were I can see full features of MySQL and maybe a benchmark?
Changing subject, please advice me about the admin panel. Where would it be better to place it? In the same server than the website or in a different, so it would be less reachable and vulnerable?
And the last thing, I would like to read a guide about how to structure php programming? (not the syntax, I mean advices of how to do clean and organized programming with php)
Thank you all again and if you have further suggestions I would like to hear them.
Good that idea about DB class, but I think i'm not going with OOP. (although I will split the access functions from the rest)
I have another question regarding MySQL. I see it is capable to handle large databases. How good is to handle multiple connections (or it depends solely of the server it is installed in?) I would like to ad I will work on an acution web site, so there will be features involving money managment.
Does anyone know any site (not mysql site) were I can see full features of MySQL and maybe a benchmark?
Changing subject, please advice me about the admin panel. Where would it be better to place it? In the same server than the website or in a different, so it would be less reachable and vulnerable?
And the last thing, I would like to read a guide about how to structure php programming? (not the syntax, I mean advices of how to do clean and organized programming with php)
Thank you all again and if you have further suggestions I would like to hear them.
My advice would be that OOP (and unit testing - see http://www.lastcraft.com) is essential for anything much more complicated than "hello world".pìsterman wrote:but I think i'm not going with OOP
Structuring code well requires a knowledge of design patterns - see http://www.phppatterns.com.
As well as helping to create reliable, bug-free classes, unit testing is also a design tool. Using mock objects (see the lastcraft link) can allow you to design top down without initially writing any code for the mocked classes.
All this stuff takes a while to learn but if you plan to do any serious programming OOP is an essential skill.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
I've been reading pros and cons of using OOP against procedural and can't make a decision.
From one hand, by doing it procedural will I code it faster (and as I've read the performance is better).
On the other hand, it would be easier to maintain the code by going with OOP.
The site will be an auction site. So I will have buyers, sellers and bids on products.
The interaction between these three parts would it be easier to write with OOP?
Since I'm a newbie in OOP, I can't see if it's appropriate for what I'm planning to do.
From one hand, by doing it procedural will I code it faster (and as I've read the performance is better).
On the other hand, it would be easier to maintain the code by going with OOP.
The site will be an auction site. So I will have buyers, sellers and bids on products.
The interaction between these three parts would it be easier to write with OOP?
Since I'm a newbie in OOP, I can't see if it's appropriate for what I'm planning to do.
I'd take any criticisms of OOP you might hear with a pinch of salt. They are often made by people who don't understand it and have too narrow a perspective on what makes for good or bad code. The usual complaints that OOP is slower is not true, for example and there are precious few serious programmers who would consider building a site of the kind you have suggested without it.
Speed isn't the issue anyway - that's looking in entirely the wrong direction. The aim is to write code which is easy to work with, which you can change and adapt (and optimise properly..) as your site grows. The real skill is in creating a good design: I'd say at least two thirds of my time goes into writing code that is easy to read and work with rather than the relatively trivial task of making computers do stuff. That means nice modular OOP code where each class does just one thing.
Initially you will code faster doing it procedurally (not least because it will take you at least a year of hard study to get a grounding in OOP). You lose out - big time - when you try to add new features or make other changes. I have an old site to maintain which I wrote early on and I dread getting a call to fix a problem. I haven't got a clue how it works, and I wrote it. I'll typically spend an hour or two just trying to figure it out before I can even begin to start working on it.
With a well-designed OOP site on the other hand, different aspects of functionality are encapsulated in separate classes allowing you to focus quickly on the task at hand. You can swap bits in and out easily. With unit tests (I can't recommend strongly enough that you start testing as soon as possible) the test cases provide precise documentation on what all the different bits are supposed to do. When you refactor code, the tests stop you breaking the site. With mock objects, you can even use testing as a design tool.
It will take a while to learn but if you want to learn to program well, or just well enough to create a managable site, that's what you have to do.
The only shortcut I can think of might be to build your site with one of the exisiting OOP frameworks. You'll still need to take the time to learn about OOP & design patterns in order to understand the framework, but you will at least save on the time of developing your own. That's a good learning exercise but it will get torn down and rebuilt many times until about version 5, when you really start to get a grasp on OOP design.
Best of luck (and avoid PEAR like the plague).
Speed isn't the issue anyway - that's looking in entirely the wrong direction. The aim is to write code which is easy to work with, which you can change and adapt (and optimise properly..) as your site grows. The real skill is in creating a good design: I'd say at least two thirds of my time goes into writing code that is easy to read and work with rather than the relatively trivial task of making computers do stuff. That means nice modular OOP code where each class does just one thing.
Initially you will code faster doing it procedurally (not least because it will take you at least a year of hard study to get a grounding in OOP). You lose out - big time - when you try to add new features or make other changes. I have an old site to maintain which I wrote early on and I dread getting a call to fix a problem. I haven't got a clue how it works, and I wrote it. I'll typically spend an hour or two just trying to figure it out before I can even begin to start working on it.
With a well-designed OOP site on the other hand, different aspects of functionality are encapsulated in separate classes allowing you to focus quickly on the task at hand. You can swap bits in and out easily. With unit tests (I can't recommend strongly enough that you start testing as soon as possible) the test cases provide precise documentation on what all the different bits are supposed to do. When you refactor code, the tests stop you breaking the site. With mock objects, you can even use testing as a design tool.
It will take a while to learn but if you want to learn to program well, or just well enough to create a managable site, that's what you have to do.
The only shortcut I can think of might be to build your site with one of the exisiting OOP frameworks. You'll still need to take the time to learn about OOP & design patterns in order to understand the framework, but you will at least save on the time of developing your own. That's a good learning exercise but it will get torn down and rebuilt many times until about version 5, when you really start to get a grasp on OOP design.
Best of luck (and avoid PEAR like the plague).