yeah, right

Story: PHP is dead. Long live PHP!Total Replies: 10
Author Content
cheshire137

Jul 19, 2006
12:49 PM EDT
I'm a big fan of Rails and use it like crazy when I see the slightest opportunity. However, PHP is not dead and I doubt it will be for years to come.

1) People are slow to change--why move over existing PHP apps to Rails when the PHP version works just fine?

2) PHP is easier to get off the ground with. While Rails is becoming easier to get installed and set up, it's still hairy to get going on Apache. PHP comes by default on a lot of systems, allowing the user to pretty much ignore server setup and just start coding. Fiddling with .htaccess and httpd.conf? No thanks, gimme the PHP!

3) Rails provides a lot of out-of-the-box functionality, but also a lot of extra stuff that you may not need. With PHP, you just write what you need, which may just entail a 100-line script. Rails, no matter how simple your idea, will come with lots of directories and auto-generated files. Some are going to look at that, decide it's unnecessary, and use the simple, ain't-there-unless-you-wrote-it PHP.

4) Rails is a framework built on the language Ruby. PHP is the language. This goes back to my previous point in that some will choose PHP because they don't need all the fancy-smanzy framework stuff.

5) PHP is quick to write in and quick to pick up. Do a simple phpinfo() and you're rolling. Rails, being a newer technology, has less documentation out there than tried-and-true PHP, not to mention it has several areas, upon initial setup, where you could be doing something wrong to cause that darn ambiguous 'Application error'. Is the trouble in my routes configuration? Did I name something incorrectly in .htaccess? Is Ruby Gems not installed in the right directory? Is the version of Ruby too old? Is the Alias/Directory setup in httpd.conf not right?
grouch

Jul 19, 2006
6:02 PM EDT
It is a well-known fact that steel is a more economical material for rails than ruby. However, steel is a terrible scripting language for webservers, which is why PHP is used.
Sander_Marechal

Jul 19, 2006
9:40 PM EDT
Hehe,

I'm sticking to PHP. I don't like Ruby too much. I have a "thing" against frameworks. If I'm ever switching away it'll probabely be to Python.
dinotrac

Jul 20, 2006
2:55 AM EDT
Well, python does have the advantage of being slow.
grouch

Jul 20, 2006
5:42 AM EDT
dinotrac:

Try "And now for something completely different". It has very few slow scenes.
tuxchick2

Jul 20, 2006
6:34 AM EDT
PHP gets a lot of attention for introducing big fat security holes. Is this a problem with PHP, or sloppy coding?
grouch

Jul 20, 2006
6:37 AM EDT
tuxchick2:

I think most are sloppy coding. It's so easy to get started, but has sufficient power to get the newbie (see me) into trouble.

C suffers the same fate; it will let you do things you shouldn't do.

Sander_Marechal

Jul 20, 2006
6:56 AM EDT
Quoting:C suffers the same fate; it will let you do things you shouldn't do.


I'm quite a good PHP coder. Maybe it lets you do things that you shouldn't do, but I know I can still do them safely.

And that's just the thing about programming languages. It cannot assume to know what the programmer is trying to achieve. If you do, you get a VB-like hell (where a popup comes up every time you make a typo).

Maybe programming languages need a n00b mode.

ini_set('beginner_mode', true);
number6x

Jul 20, 2006
7:04 AM EDT
The reasons for using rails and php are very different.

Rails strong point is Object Relational Mapping (ORM). The rails framework automagically sets up a connection between rows in your database table and instances of objects in your rails app. You get a whole slew of built in CRUD. Don't worry this CRUD stands for Create Read Update Delete, the basic functionality of relational databases.

If you want to write Object Oriented code and have its objects mapped to your database without constructing the connections by hand, rails may be a good choice. Ruby provides a way to inject dynamic contents into web pages (the V in MVC), in the way ASP or JSP does. In rails you can write most of your data base routines in ruby(migrations), your code to write dynamic content in ruby(erb), and the code for your project in ruby(uhh, ruby). You don't have to switch between jsp, asp, SQL and Java or php. Its hard to describe how much more efficient it is to not to have to switch mental tracks between different languages while trying to implement something.

Php is a language designed for web designers to be able to add dynamically created web content to their programs. php code is usually less database read write oriented and often just has the calls to read or insert or update as SQL embedded within each page. If you need to change a database call, you will probably have to do it in more than one place.

On large projects it is often usefull to break up functionality into the MVC, or Model View Controller design. This would group all database reads, writes, updates, inserts, updates, and deletes in the model code. The different web pages (views) would talk to the controller, and share the same database code.

Php has an object oriented implementation. It is as useful as object orientated perl or object oriented COBOL.

For rapidly creating dynamic content without intense database needs, php is ideal.

If you want the whole database backed app enchilada with Object Relational Mapping on top, rails is ideal.

Comparing them is like comparing motorcycles and automobiles. Yes they are both forms of personal transportation, but they have different features and uses.
cheshire137

Jul 20, 2006
9:31 AM EDT
sander: "I don't like Ruby too much. I have a "thing" against frameworks." I don't know if those two are related or just standalone comments that happen to be next to each other, but if they are related, then I want to point out that you can be a Ruby fan without liking a thing about Rails. Rails is a framework built out of the language Ruby. Ruby is one sexy object-oriented, interpreted language.
Sander_Marechal

Jul 20, 2006
3:38 PM EDT
@chershire: I should have written:
Quoting:I don't like Ruby on Rails too much. I have a "thing" against frameworks.


I have no special feelings about Ruby as a language.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!