PHP compared to other languages...
View Single Post
01-18-2008, 03:08 PM
Join Date: Jan 2008
Location: Birmingham, UK
I've just joined this site, it looks like it's pretty lively so thought I'd roll with you lot :)
I've been using php since version 3, I think, like yourself, it's a lot of fun, heck' I even use it for a living nowadays.
FooBarWidget kind of said the important stuff but I thought I could expand a little on a couple more points.
Php can be cool and easy to get into, but also difficult at times as there isn't any real standard in the core, more explicitly, function names such as those with underscore separation, and other's without.
There's also a big difference between 4 and 5 if you're an oop programmer, php6 is going further away from 4 as well (and that's the version a LOT of web hosts use on their shared servers), so if you're currently using 4, you're gonna have to do a lot of catching up if you ever want to get into a more recent version of php.
Oop is great, my impression is that oop can be overkill for small sites, but for big sites with/without multiple coders, it's such a useful way of working. Once you've coded your gazillionth site, it gets a bit less fun recoding a page to output news, etc. Code reusability is a core part of the oop mindset. Of course, you make a great point, you could have a script full of your most used functions, but that doesn't scale well. Over time, you'll have functions to do everything, and loading in that whale of a script is going to nail your loading times of a page.
An example of a good use of oop is a database util class. In the first example, you could just have your functions class that connects and queries a mysql db. Great. Now, if you want to connect to a Sqlite / postgre / oracle db, what do you do?
With oop, you could have a factory script, a sort of shell, that can extend one other script of your choosing. You know that you just need to call open_db() (or of that ilk), and whichever type of data storage you have, you'll be getting the same result. Without oop, you'll be writing functions like open_db_mysql(), open_db_postgre(), open_db_sqlite(), and so forth, then if you moved datasource at any time, you'll be recoding all calls throughout the site to the new function. "Portability" is the take-home message ;)
I think from a new person's perspective, oop can seem too overkill because that person looks at framework's such as zend, pear, etc. Those guys pack everything and the kitchen sink into their packages, so from an outsiders perspective who just needs an email validation function (e.g.), oop seems like this unwieldy beast.
As for other languages, I've never come across a problem that I couldn't solve with php, apart from recently! Ever done a file upload with a progress bar in pure php? You can't, it doesn't have the stuff out of the box to do it. You can extend the core with additional dll's/so's, or talk to an outside script such as perl/python using ajax, but out of the box, php can be limiting. That said, with the right extensions, php can solve anything :)
The Following User Says Thank You to flyingbuddha For This Useful Post:
View Public Profile
Send a private message to flyingbuddha
Visit flyingbuddha's homepage!
Find More Posts by flyingbuddha