views:

370

answers:

5

Though I come from a purely PHP background on the web development side of programming, I have also spent much time with C# and C++ on the desktop.

I don't really want to spark any flame wars, but:

When should you use scripting languages over compiled languages for website development?
(and vice versa)

Just to clarify, for the sake of this question, I define a "scripting language" to mean an interpreted language like PHP, Python, or Ruby, and a "compiled language" to mean a strongly typed, compiled language like C#, C++, Java, or VB.

+10  A: 

It depends :-)

On...

  • ...where and how you want to deploy the application
  • ...the skillsets of the engineers in your organization
  • ...what third-party components you want to integrate with or incorporate

Deployment

If you need to be able to deploy the solution on any of dozens of different possible platforms, you may find that you're better off with PHP than Java (for example). There are hundreds of thousands of Java hosting providers out there, but there are probably millions of PHP hosting providers. (And I say this as a Java-head who dislikes PHP.)

This goes to OS as well. Mono aside, .Net stuff is going to limit you to Windows-based deployment (or lagging behind the cutting edge and having to very, very rigorously test each and every 3rd party component you bring in, to ensure that it doesn't have Mono...issues).

Skillsets

Coming up to speed in an environment or language is non-trivial. For most of us, picking up the basics is pretty quick, but you may not be making the best architectural/design decisions because you're (comparatively) weak on the environment/language. Skillsets count.

Related to this: Skillset hiring counts. Is it easier (and/or cheaper) to hire PHP devs with 3-4 years of experience, or Java devs with 3-4 years of experience, or C# devs, or...?

Buying/finding/integrating vs. building

In your target area of development, which server-side components or packages will you want to integrate with? PHP has a vast array of things available for it, as does Java, as does C# or ASP.Net. But they're different things (by and large), so you'll want to look at what you actually want to use.

Conclusion

So I think it's less a matter of compiled vs. scripted (in today's world), and more a matter of what's the best fit by other criteria for what you're trying to do.

Addendum: Both/And

And of course, there's always "both/and". For instance, I do work in two main, unrelated environments right now, both using a combination of scripted and compiled resources. (One of them is Java + JavaScript via Rhino on Tomcat, the other is compiled COM objects + JScript [again, server-side] on IIS.)

T.J. Crowder
+1  A: 

I find it to be mostly a matter of opinion. At first I hated the pre-compiled web applications asp.net provides, but I've gotten used to it so I don't hate it anymore. It has advantages and disantages:

Pro

  • pre-compiled web applications are easy to deploy, often you'll only have to update the bin-directory
  • pre-compiled web applications perform well
  • you don't have to upload source code, which is nice imho.

Con

  • updating a pre-compiled web app generally means the web application is reset, so unless you've changed the session state, it'll end all sessions and log everyone out
  • rebuilding a large web application can take some time, which is added to the time it took you to write the changes in the first place. I am sometimes impatient.

I've always liked how easy it is to just update one file in a PHP project without having to rebuild a project or something like that, on the other hand, .net has a nice IDE that allows you to debug everying, from back end (C#, VB.net) to front end (Javascript), in one package. But again; both have advantages and disadvantages.

Rob
A: 

I'm a big fan of compiled languages everywhere, if for nothing more than the static typing. On the other hand, scripting languages are very convenient -- no binaries to deal with, only text files, which is a big win for web servers.

In the end, it doesn't really matter -- use whatever language you know and feel most comfortable with for the job.

zildjohn01
A: 

I think that speed is a key concern in a web application, in particular

  • how fast is it to write my code
  • how fast is it to fix my code
  • how fast is it to refactor my code
  • how fast is it to test my code

That is, I am concerned about the speed of the slowest link: myself. Anything else is fast enough for Twitter-like loads.

Today, the number one on my evaluation list for a new project would be Tornado and Python.

If I had a choice of platforms, of course.

Ah, Python is among the fastest in scripting languages.

mico
Ah, now you've got me interested in Tornado :). Reading through the documentation, it seems like a really nice, simple framework. Do you know of any good open source projects that use it? I would like to see some real-life use of it...
Austin Hyde
Oh, never mind, I found some examples: http://github.com/facebook/tornado/tree/master/demos/
Austin Hyde
And it was developed to power FrienfdFeed, particularly, it was developed with the goal of keeping up with a lot of persistent connections.
mico
igouy
+1  A: 

A programmer can write good/bad fast/slow scalable/unscable code in any language. Although, some language and technologies make it harder to do. In my experience, with scripting languages you can produce a small to medium scale application faster than you can with compiled languages like Java. However, as applications grow in size, compiled languages become more suited to the task I think this comes from strongly typing objects, deeper layers of architecture to manage tasks, and more QA frameworks to verify things are running as they should be as changes occur.

Jay