10

I've always used PHP, but recently I've been reading about why it's bad. I love Python, but I don't know how it works with the web. I've never even seen Ruby... what is worth learning? Should I stick to PHP?

97

Gmail is written in Java.

Wikipedia is written in PHP.

Many parts of google.com are written in Python.

Slashdot is written in Perl.

Twitter is written in Ruby.

Stackoverflow is written in C#.

The list goes on...

As you can see, there is no best language, a language is only what you make of it.

9

Like any software tool, it depends on the task.

7

Obviously, it depends on what you want to get done, what your team is working with, if you have other dependencies on other libs, etc

Look at Django. I've been around the block a few times with web frameworks and it's my favorite web solution bar none. It has in-built XSS protection, you don't have to worry about SQL injection anymore(mysql_real_escape_string or whatever can go to hell), the ORM is slick as hell and it's overall just a pleasure to work with. If you like Python, try it out. Look at pylons and web.py too. See which one you like the best and use it.

7

If you love python you should check out the django framework.

I think it's the best option for web development, but that's very subjective of course.

6

The best language is a subjective question that depends on the type of app you are considering, the scalability, speed to market (how long it takes to code), and other variables.

I have used PHP, Python, and Java (j2ee in an ATG framework). Java is a techie dream - it is hard to setup, requires vast knowledge of the particular framework you are using, takes much time to code/compile/migrate/test, and breaks very easily with cryptic error messages. Very, very high learning curve. The end result - the same as any other framework - except one noticeable exception - AMAZING caching ability at the lowest object level you need - making is scale very, very well.

PHP is by far the easiest to set up (servers, db connection, [ see 'WAMP Server' ] etc), learn, and develop with (a Zend infrastructure is good, but beware of the MVC learning curve). The language is fairly intuitive, and the object model in V.5 resembles Java quite closely (sans the dot) It scales well, but caching must be done with a third party app or Apache.

Python is plain fun. I don't have the setup experience with python, so I cannot comment on the infrastructure needs. It is very, very fast, and has a plethora of libraries available for almost any need (including C++ libs - faster yet!). As a first web language, Python would be desirable. At a system admin level, as an alternative to the more cryptic shell scripting and PERL, it rocks!

Just my humble opinion,

Bill.

5

PHP being bad is subjective. Beware the almost infinite stream of language snobbery out there concerning PHP. Some of it is valid, some of it might be valid in certain rare circumstances, but most of it is just plain old snobbery*.

Weigh your pros and cons up carefully before swapping to an alternative would be my advice - if that's in favour of PHP, or equal, wouldn't you get more benefit from your time by learning something that you can use in conjunction with PHP? Javascript & jQuery, for example, which opens up a whole new world of webdev with Ajax.

*Just watch the downvotes come flooding in for pointing that out to those who practice it :)

3

the best is a matter of opinion. i like groovy and grails. ruby and rails is popular. there are lots of java based web frameworks. also, there is c#/.net.

2

It depends on how rich the Framework libraries are. If there are rich libraries in the platform then your job will be very easy and interesting. But again everything depends on what you really want to achieve.

I feel that the latest .NET3.5 framework is one of the best. It supports AJAX and JQuery Try ASP.NET MVC. More over that when you learn C# or VB.NET you can apply that knowledge in many other places not only for Web side programming.

2

Python and the .NET languages have an advantage over PHP and Ruby in that they have thorough in-built Unicode support. It's embarrassing seeing all the PHP webapps today that still fall over when you send them a non-ASCII character; a good language should be taking care of that for you.

(So does Java, but Java in itself can be rather cumbersome for web scripting and can need a bit of help from a scripting language like Groovy or Jython.)

2

There aren't really any bad choices for the web...

I really like django's use of models and the build in admin console for applications, although I haven't gotten used to pythons syntax and the required indenting :( I want to like it, but I just don't.

At work, we use Java and Cold Fusion-

I really haven't found anything I can't do with Java, but it's a bit too much for small projects.

Cold Fusion is really nice for rapid web development- I can have a site working in hours that might take days in Java. Plus, the newest Cold Fusion servers are really Java based, so the cold fusion pages are compiled to java class files just like jsp. And, you have the option of running pure java on the server.

1

You can always start by writing Python CGI-scripts. You might want to look at the documentation for the CGI module. For more complex applications, you might want to think about using the Django framework for web applications, or some other Python web framework, like TurboGears or the lightweight web.py.

Ruby is a fantastic language, similar in many respects to Python. Ruby on Rails, another excellent web framework, is similar in concept to Django.

I would suggest starting with some simple CGI, so you can get a basic idea of what goes on under the hood, if you feel you need it. Then, learn one of the frameworks ? most of the concepts are shared between them.

Any are better than PHP, unless you're only looking for a basic templating system, which I think is pretty much all PHP is really good at. ;)

1

When you have ASP.NET, with many different languages that support .NET framework, and you see some huge web applications like Hotmail written with ASP.NET and its integration with Silverlight (which I think is going to become very popular) I don't see why one would choose any other tool.

Microsoft provides a giant and innovative collection of tools to work on the web, and its a good choice in my opinion.

If there is an area where .NET has not failed, that's the Web.

1

PHP is one of great language i found, i have been working in php since 2007, like it so much and its very flexible to do any thing we want. We can't find php like language, If you want to learn more advanced topics there are lot of things available in php to learn. I like to stick with php only.

1

Almost all languages are worth learning, if only to give you another perspective on how things are done. Learning another language almost always makes you a better programmer. I use PHP a lot, but it's certainly not the right tool for everything. Although many times it a sufficient tool.

Both Facebook and Yahoo use PHP, but generally for their front-end not for their core. You could do a chat system in PHP (there are some out there), but it would fail miserably on the scale Facebook does. So Facebook went with Erlang, for some very good reasons.

Systems like ICE (zeroc.com) and Thrift (Facebook) exist so you can mix and match languages and use the right tool for the job. With todays systems, any one language is probably not the right one for every part of a system. The more languages you know, even if not well, the better decisions you will be able to make.

Python seems to be replacing Perl as the sys admin language. So if you have a need to do admin work, Python may be a good choice to learn next.

1

Here is my belated take on all this. If you are just getting going, make sure you have the client side down (CSS, Javascript, frameworks like jQuery, basic HTML, DOM mannipulation, AJAX, all that good stuff). Also learn how to use Photoshop or a similar program like GIMP or Fireworks to learn how to make cool looking user interfaces. Read up on web design best practices. Those skills will carry over regardless of what server side scripting language you choose.

If you are new to programming, and you just want to take data from a user and store data in a database, maybe check out PHP and MySQL. At least learn the basics. I myself have never used PHP or MySQL, but from what I've seen it if really easy to store data and retreive data using PHP and MySQL. There are tons of examples out there on how to use PHP, plus there are plenty of open source projects that have gained a lot of traction like Word Press, Joomla, Drupal, etc... Knowing a little PHP will help you use and modify those projects, which will be helpful.

Once you have arrived here, then there are numerous avenues you can pursue to take you to the next level. Here are a few ways you can go.

PHP with memcached and frameworks like CodeIgnitor or Zend. Again, don't have personal experience here, but if you want to take PHP to the next level this has been what is recommended to me. Learn about how to optimize queries and use memcached.

Or you can go the Microsoft route. The pros of doing this is that although there aren't as many open source Microsoft projects out there to build off of (there are a few, but not like PHP), but there is pretty much an answer to any problems that come up a few google searches away. ASP.Net using either VB.Net or C# can get you a decent paying job as well, especially if you invest a little time learning about Test Driven Development and you know SQL Server fairly well. This is what I did and over time it paid off for me very well. Doing web development using ASP.Net web forms is both a blessing and a curse...there is a high level of obstraction between what you write and the output, some people find that cumbersome...but you can use the new ASP.Net MVC pattern instead of ASP.Net webforms to get closer to HTML.

Or you can do the Ruby or Python route. To be honest, I think Ruby is pretty hyped right now, I know that a lot of people have flocked to Ruby on Rails only later to flock away...but I also know a few people who swear by it. Then there is Python, again no practicle experience, but I'd say if it is good enough for Google it is worth looking into.

Java is also out there, and people are doing interesting stuff with it. Still today a lot of interactive Flash media sites have Java servers on the backend.

And now there is also the new stuff. Flex/Flash, Unity 3D, Silverlight...these things might be the future of the web, and might be worth looking at in conjunction with you quest to take your basic PHP server side knowledge to the next level.

One thing I found interesting is look at what people are actually developing with. If you go to sites like go2web20.net, you can see that almost all the start up companies aren't using MS tech, some are using PHP (like Facebook), others it is hard to tell. But if you go to a bank's website or step into a lot of medium sized companies, you will see Microsoft products dominating corporate web sites and intranets.

I think the server side is kind of a wash really. Your main hold ups will be how fast your database can server out data. Generally compiled languages like ASP.Net will run faster then interpreted languages like PHP or Ruby on Rails, but not always, depend on how good of a designer built the site. I've seen small ASP.Net pages that took forever to load because the developer didn't understand when to and when not to use viewstate, and I've seen "slow" PHP pages load amazingly fast because they have been cached and optimized.

So the skinny is, learn the client side well, then learn the basics of SQL and Server Side data storage and retrievel probably with PHP and MySQL. Once you get the basics of that down, experiment around with some other server side languages, pick one you like, and learn it very well. Also keep at least a finger into what is happening on the "Rich Internet Application" side by learning Flash/Flex, Unity 3D, or Silverlight.

My 2 cents.

1

The whole language debate is meaningless. There are so many facts to consider when choosing a web language; simply asking people in a forum ensures you'll get every imaginable language in response. If it's ease of learning for the beginner, then Python is the clear choice. If it's strength of development and sheer power, PHP and ASP.NET is it. What matters most is what you like. Look at all the languages out there, play around with each one, then decided. The best language to use is a language that is easiest to learn while not sacrificing power and flexibility. I myself chose ASP.NET after playing around with a few different ones. Not only because I felt ASP could accomplish anything, but because it is a much more marketable skill in the job market than others, hands down. Learning that language thoroughly has allowed me to be a six-figure web programmer and still allowing me the time on the side to work on my projects. But reiterating the obvious here, play around with all of them. Until you are skilled enough to need very advanced things with your web applications, any of the languages can do anything.

0

Javascript ... can't go wrong with that ;-)

Update : I was joking, but only partly. Javascript is an incredibly important language for web development. More and more functionality is moving to the browser where it's almost always written in Javascript.

There already are options for server-side Javascript and I bet it's way more likely that at some point, this will become a popular option, than that client-side Ruby or PHP or Python or Perl becomes a standard.

0

Learning a new language won't hurt. PHP works fine, but IMHO, both Python and Ruby are much better alternatives.

0

I've been programming for awhile on the web and I'm not really going a "job" - I'm just a kid messin' around on the Internet looking for sites to code. I just thought I would clear up the fact that I'm not looking for what language to learn first or anything... I've been programming for awhile I just never saw a reason to switch from PHP until I started seriously reading about it.

As for .NET stuff, I try to stay away from that. I think I got my three choices down to Ruby, Python, or PHP. I was looking at Django earlier today and I might try that. But here's another question: is Ruby On Rails just Ruby for the web? Or can Ruby run on the web by itself? Is ROR just a framework to Ruby like Django is a framework to Python?

Thanks.

0

"Best" is a very subjective qualification. Since you like Python, I would recommend Django (as have others on this question). Ruby is very nice, but I think Rails is too "sugary" for its own good. I use Ruby for a lot of bitsy server-side web scripting stuff.

I personally like Java for solid, large-application-ready web development. I have yet to see a framework which equals Wicket in terms of usability and architecture. Granted, Java is an annoyingly limited language, but you can always work around that by using other JVM languages like Scala and Clojure.

0

PHP is my choice by far, adn I highly recommend it to you. Especially with the release of the solid OOP PHP5. I have a blast writing PHP5 and it is fast. The online support for PHP is ebyond great as well.

ASP.Net drove me nuts. It seemed to over complicate the whole web coding process and make me think within the box. In the ASP.Net class I took, it only seemed like we were learning why things wouldn't work rather than moving on...and web.config? why? I absolutely detested it. I like full control over the look of a site, and PHP caters to that like I needed. Also, to reduce PHP to system of templates is very unfair. It is quite capable of larger web sites and doing almost anything you want. I wrote a page in PHP on our admin site than went in a stripped all of the HTML out of a description column in our product database that the punk before me put in. I was thrilled how easy that was to actually code.
Also for a quick comparison, a simple mail function in ASP.Net (VB not C#, so not a super strong arg) was 25 lines of code, in PHP it was only 8. I have been told PHP's syntax and C#'s syntax are not very different from each other...

Ohio State's website is PHP. Facebook is in PHP. My company's totally dynamic Website is in PHP. The big software houses like to snub their nose at PHP just like Windows fanatics like to snub their nose at Linux. Our Slackware web server ran 2 years and 4 months without a reboot, the IIS server needs rebooted and worked on about once every month or two. Another argument for PHP.

From what I have been reading in job postings, PHP is on fire out west. Hopefully that continue to spread eastwards so I dont have to ever touch ASP.Net ever again.

0

HTML </sarcasm>

0

what about JSP

0

I'm using PHP for several years. PHP has a huge community. So you can simply find lots of solution for nearly every problems. But it has some limitations for speacial expectations. For example, multi thread support and so much performance that python and java has. Also, PHP is a language for web development only. But you can develop native windows/linux/mac applications with python and java.

I'm planning to learn Python and use it some of my web projects. I don't like Java, because it needs a really big learning curve.

I never gave a change to .Net because of it's restriction of platform choosing(windows). I'm sure that I want to use a cross-platform language.

By the way, Ruby is a funny language that I want to try somethings on it...

-2

Assembly is the best! There is nothing like hand coding your CSS to be instruction perfect. However XML does get kind of messy if you are coding for an ARM processor ;)

-4

I do hand-code my CSS. :)