PHP, Python, Ruby.

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP, Python, Ruby.

Post by Christopher »

I think a better question for any programmer might be:

Is there another programming language/system that would be better for some of the applications I typically have to build -- given my tastes, programming style and experience level?
(#10850)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: PHP, Python, Ruby.

Post by alex.barylski »

I remember when I started visiting the BASIC forum on Compuserve, there would be the occasional zealot who would drop by and suggest VB was for wimps and real programmers used C/C++. Some 10-15 years later and the same type of mentality exists.

Each is a tool which solves a certain problem better than others.

When comparing ASP.NET to PHP you are almost comparing apples to oranges. One is propritary the other open source. One has support for an advanced editor, the other forces you as a developer to find one you like.

Personally, I switched from ASP to PHP because from what I could tell at the time (some ten years ago) PHP seemed more flexibile and Linux hosting was half the price. Although ASP was probably superior as a language/technology at the time (Microsoft always has awesome IDE's) I desired the flexibility of open source. I actually think it was the requirement to buy a Mailer activeX control in order to send mail in ASP that finally forced me to switch to PHP.

I liked PHP because of it's resembelence to C syntax. So that is nother reason one might choose PHP over ASP.

My point is, there are many factors that will influence any developers choice in development language, not just the language itself. Technical, political, emotional, etc.

I like open source, not because it's free (although that helps) but because of the flexibility I am offered. I love being able to take multiple small tools and construct my own tool chain. Closed source tools tend to try and be everything to everyone and you end up with monolithic giants -- although this happens frequently in PHP applications (ie: SugarCRM).

I would like to see operator overloading similar to C++ in PHP -- I have some cool ideas I'd like to implement that require that funcitonality.

I would also like to see forced type checking. I don't think loosely typed languages are very sexy. If I pass an object where a function expects a string I wanna know about it cause that leads to annoying bugs which can be difficult to find. Basically type hinting should be type checking and everything should be an object.

Not everyone would agree with me on that one, many PHP developers still insist on writing procedural code. While there was a time I would argue until my face turned blue that using procedural code was the devils work...I would be wrong to do so. Whatever works for you as a developer you do, even if it's considered bad practice by others. Hell I do have a single functions.php file in my own projects where I have generic functions that would look ugly when called statically inside a class.

__autoload()
a2b() - Array to Bitfield
b2a() - Bitfield to Array
deep_stripslashes()

And about 20 other functions. So I can see why some might still want to keep proecudral programming live and well.

PHP is by far the more popular web programming langauge. I think Python and Ruby have their place but their position is not to trump PHP but instead satisyf those who cannot live in a PHP environment.

I can't remember which one but I'm sure one was based partly on Smalltalk which I believe is a purely OO language (I think it's Jenk who uses it regularly so he can agree or correct me if I'm wrong).

Use whatever tools floats your boat. I've always been a huge C++ fan and I still am...I love that language but there are many things you can accomplish more elegantly in PHP and I don't mean just web applications. The fact that PHP lets you do something like:

Code: Select all

<?php
 
  include 'somefile.php';
 
  $res = mysql_query('SELECT * FROM table');
  
  // TODO: Iterate over resultset
  foreach($arr as $record){
    echo '<div>Some record</div>';
  }
Is such a bad practice except in all but the simplest cases...but it's what attracts newbies to web programming because you don't need to learn about headers and HTTP you just GO...

PHP is an excellent learner's language as the basic syntax is all one needs to understand to get rolling. However it also offers the developer plenty of room for improvement and has countless frameworks one can use if your so inclined to test the water.

Basically I don't personally think any language is superior to the other. Like when comparing PHP frameworks I guess. They each solve problems from a different perspective...maybe some are more security focused, whereas others are more RAD focused and other more on good design.

What language you pick really relies on what YOUR requirements, desires, expectations and long term goals are...

Cheers
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Re: PHP, Python, Ruby.

Post by Maugrim_The_Reaper »

I think if selecting a language you get two categories of responses.

X is better than Y
X and Y are both good but Y could use some improving

Those who are absolutely certain (option 1) I have to disagree with - we live in a world of frameworks where almost any recent language can become a very useful innovative way of creating web applications.

As to popularity, why use Google Trends when you can use the respected TIOBE Programming Community Index? http://www.tiobe.com/index.php/content/ ... index.html

Sure it's still search rankings based, but it covers more ground and the data is more enlightening. It shows Ruby basically peaked in 2007 and has been remaining static ever since with little movement at 2.735% (#10), with PHP at 9.525% (#5). Python is at 4.973% (#7).

If you want language activity comparisons, you can watch open source activity in terms of number of commits using Ohloh Statistics. http://www.ohloh.net/languages/compare? ... mit=Update
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP, Python, Ruby.

Post by Christopher »

Maugrim_The_Reaper wrote:X is better than Y
X and Y are both good but Y could use some improving
I added "X and Y are both good but Y is more suitable for this application."

It is interesting about the three languages being discussed. PHP has seen it reputation improve because the language has improved and simply because of its tenacity. Much as some people dislike it, the bottom line is that it is one of the easier ways to develop web applications and its problems were shown to be oversold.

A lot of the growth of all three languages has come from people realizing that Java is not the magic one-size-fits-all bullet that it was once thought to be.

Ruby is a cool language, but seems to only have gotten niche traction and will probably stay that way. There will be a strong group of users who simply love it. It appears to be the Mac of programming languages.

Python is the most interesting to me at the moment. It keeps growing and I see it becoming much more of the systems programming language. Django is very cool for web apps but PHP still has a deployment edge. I see Linux distros starting to included Python as a standard like they include Perl. It seems like a real improvement over C++ and Java for boring programming. It may become the C or Fortran of our age.
(#10850)
User avatar
vargadanis
Forum Contributor
Posts: 158
Joined: Sun Jun 01, 2008 3:48 am
Contact:

Re: PHP, Python, Ruby.

Post by vargadanis »

In fact, Ubuntu developers ask the community to submit python code to them as it is easier for them to implement.
Python is a great language and I fall in love with it. I learned the basics of socket programming with it and now I can implement that kinda knowledge in other languages. I personally prefer C/C++ over any of the languages as it provides me the power I desire.
However, I use PHP most often to write web application as it is really easy and fast to develop. If C++ had similar flexibility, PHP didn't exist.
As of Java.... I'd better not say anything cause I don't wanna hurt the Java-funs.

So which one is better all comes down to you. IF you like C++ and it's syntax, you will most likely chose C++ or PHP. If you like purely OO languages, you will most likely pick python or ruby. In fact it doesn't matter which one you chose cause all of them can be for web services as FactCGI or simple CGI. What matters is what you want...
Off: Guys, we should create a survay or a wizard like website where people can get the answer which language is the most suited for them by answering multiple choice questions :) /off
So for me C++ is better than the others just because I like it's speed.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: PHP, Python, Ruby.

Post by Kieran Huggins »

I heart Ruby, but I've heard great things about python as well.

It doesn't hurt to learn all 3... in fact many people recommend it!
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: PHP, Python, Ruby.

Post by onion2k »

vargadanis wrote:So for me C++ is better than the others just because I like it's speed.
99.9% of PHP developers wouldn't be able to make their scripts faster by rewriting them in C++. I know I couldn't. In fact, I imagine if I tried the C++ ones would actually be slower.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: PHP, Python, Ruby.

Post by Mordred »

onion2k wrote:
vargadanis wrote:So for me C++ is better than the others just because I like it's speed.
99.9% of PHP developers wouldn't be able to make their scripts faster by rewriting them in C++. I know I couldn't. In fact, I imagine if I tried the C++ ones would actually be slower.
Duude, you would not. You would simply die before that, precisely at the point where you have to concat a couple of dozen substrings into a mysql query. Boo...(o)...oring. With lots and lots and lots and lots of o's.

Languages are tools. We are supposed to know how to use several and pick the most appropriate one: the one that will do the job better, faster, and will offer more fun while doing it. C++ is the undisputably best language in many situations. Web dev is not one of them.

Also, a crappy, slow and buggy app can be written in any language. A better, faster and more correct application can be written in same language. "C++ is faster" is therefore nonsensical.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: PHP, Python, Ruby.

Post by Eran »

I would like to stress what mordred said about speed of development - which is a very important point. Development time is money and lost opportunities, and time to market is everything on the web. That is the reason people also use frameworks which might run slower than pure code, but allow them to develop faster.

A faster programming language usually means a lower-level programming language - which in turn means more development resources to implement the same functionality. You can always optimize higher-level languages when needed - just follow the rules of optimization:
1. First Rule Of Optimization - Don't.
2. Second Rule Of Optimization - Don't... yet.
3. Profile Before Optimizing

(taken from wiki wiki web - http://c2.com/cgi/wiki?RulesOfOptimization)
Post Reply