Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Why Would I Write Web Apps In Anything Besides PHP?
33 points by citizenkeys on May 12, 2011 | hide | past | favorite | 69 comments
I recently considered moving all my web apps from PHP to something else, mainly because I was bored and it was an excuse to get proficient with another language. However, the alternatives were not written with web scripting in mind. Python and Ruby were both designed as stand-alone programming languages with web wrappers added later. Beyond those two, I couldn't even think of a third language that was even worth considering. So I stayed with PHP because PHP was designed specifically for web scripting.

My question is: What benefits are there to writing web apps in any of those other languages that weren't designed specifically for web apps?




Eh, I don't really get your question here.

Why would you rewrite all your apps with something other than PHP? You wouldn't, of course.

Why would you consider a language that wasn't "designed specifically for web scripting"? Because that's an irrelevant criteria for choosing a platform. It makes no difference if something was(n't) designed for a single purpose, only that it is effective for the purpose you require.

A third language worth considering -- how about JavaScript w/ Node.JS?

Benefits to writing web apps in a language other than PHP? Well, you get the benefits of that language - whatever those might be. Benefits might include anything from technical superiority (and what 'technical superiority' means is based a lot more on the application than the fact it's web-based) to it being easy to find developers who know a platform in your city when you need to hire, availability of documentation, or even the general progressiveness of the whole ecosystem (is new stuff happening? is there community interest?).

I think that discounting everything but PHP just because they aren't pigeonholed into web apps (of course, PHP can be used for more than just the web, but let's gloss over this fact) is pretty... close minded.

A counter question: if you like PHP and are productive/happy/etc using it, why would you go out looking for new languages to replace it? You will only discover that they aren't PHP.


"designed specifically for web scripting" is worth a lot.

PHP's standard library has a function called htmlspecialchars() which escapes special characters in HTML. If you don't use a function like this, your HTML forms can be destroyed by ' and " characters and crackers can f- up your web site by putting <script> elements on your pages.

There is no function like this in the Java standard libraries. Nothing like this comes with JSP or JAX-RS. You can get one in the Apache commons lang project, but a Java web developer who doesn't know this (or write his own) is in deep trouble.

PHP is a great tool; it's creators have gotten many details right, and it offers developers the chance to get started without running into gotchas. On the other hand, other languages have things going for them too.

Ruby gems and Java's maven are incredible package managers that put PEAR to shame. There's a lot of junk software written in Java, but some of the best open source projects are there too. People are doing interesting stuff in web frameworks in Python, Ruby, Java, C# and many other languages, even PHP.


I basically read this as, "I want everything I could every possibly use in the global scope so I don't have to think about imports". Modern web development revolves heavily around open source frameworks. You can't escape the need to know about libraries outside the core language you program in, even with PHP.

If you are writing a trivially simple webapp, then you would be correct that you could hack together something with just the core language features of PHP.


Who cares if it's in a "standard library", as long as it's available in a library?


but you have know about it, and Java programmers have a lot of things clamoring for their attention. Programmers in all languages, including PHP, fail to escape characters correctly. But PHP programmers have no excuse: you can tell them what to do and they don't have to mess with the build system, think about licenses, all that.

In a large Java system, you might find you're using 4 different JSON libraries... because 2 of them are used by other Open Source projects your project uses and 5 of your subteams picked 2 different JSON libraries.. Now you've got to deal with bugs in 4 different libraries and if you're doing cross-functional coding you've got to know the idiosyncratic APIs and you can always get your panties in a knot about which library you should use in who's turf.

PHP programmers use json_encode() and json_decode() and avoid bugs and wasted time.


Modern frameworks and platforms have incorporated and improved a lot of ideas (some would consider) made popular by PHP. Spend some time getting to know Rails for instance and you'll find that none of the problems you just described apply, and they've solved the same problems -- but better.

No need to manually escape strings, no build system, 4 different JSON libraries!? Seamless (you don't even need to call it most of the time) to_json. The list goes on.

Yes, you have to know about appropriate libraries to use Ruby for webapps, just like you have to know about the functions available in PHP. It's fortunate that PHP has some of that core stuff built in, because it's package manager blows. If I need to encode json I just incant `gem install json` (but it's probably installed already, or maybe I would have to start right at the beginning with `gem search -r json`?) and call `to_json`.

The point is, use what makes you productive. Not being 'designed for web scripting' is meaningless today.


rails 3 makes strings safe by default. PHP doesn't.


Rails 3 is a web framework. PHP isn't. I am always puzzled by the apple to oranges comparison: Rails vs PHP.


I normally would agree. But I think this is a unique discussion because the OP is asking why he should use something other than PHP. One might use Ruby because of Rails. So it's not a comparison of PHP and Rails directly, just reinforcing the point that languages/platforms other than PHP (and it's frameworks) are just as useful for web work as PHP is.


and Java programmers have a lot of things clamoring for their attention

This seems like a great problem to have.


Who would suggest using Java, of all things?

It makes perfect sense to point out that most anyone using a normal alternative to PHP such as Python or Ruby is probably using a framework where output is escaped by default, such as Django. How about that - a system that does it automatically, you don't need to call htmlspecialentities.... or html_special_chars.


Cleaner code, powerful libraries, frameworks with vibrant communities (django/rails), and so you have friends to sit with at lunch. Really, it's a personal preference. If you have existing sites in PHP and you're really comfortable with it, why waste time porting things over? Go create something new in the most efficient way you can!


Cleaner code? Really? While I admit that a good percent of php code is sloppy, when done well it can be very clean. One of my attractions to PHP is its straight-forward C-style syntax. I like my curly braces and my switch() keyword, thank you very much. Never been much of a fan of python/ruby/perl/lisp syntax.


Preface to this comment: I started life as a PHP programmer (a core committer for many years to the KohanaPHP framework too) and stayed that way for 5 years - I am now a professional Python, Erlang, and Scheme programmer and will never go back to PHP.

This statement indicates your ignorance and lack of experience with those languages. Each of those languages you just listed has different syntax, styles, idioms, and cultural influences.

Lisp's s-expressions are the best representation you can have for a language-as-data and data-as-language programming language (if you don't know how powerful that paradigm is, then go learn it because I won't waste my time trying to explain it).

Python's whitespace significant syntax makes readable consistency of source code a language feature. If you don't know how cool that is, then you haven't spent enough time digging through other people's PHP/Perl code (which is typically a complete mess).

Ruby's syntax is influenced by Python's and Perl's. It takes the readability of Python's syntax (minus the whitespace significance) and joins that with Perl's symbols - symbols are used a lot in Ruby to make statements very terse and short. I'm not personally a fan of this style of syntax, but it does have its merits.

Perl's syntax is great for what the language is great for: text processing. PCRE came from Perl, that in itself should speak to the power of Perl. But is perl great for readability and large maintainable projects with multiple people working/reading the source? Not really, IMHO.

PHP's syntax is interesting. I find some of it to be friendly, some of it to be offensive, and some of it to be downright stupid. Why the schizophrenic nature of the syntax and API? (functions names aren't consistent, order of arguments are wtf) Because PHP has been cobbled together by a large mix of professional programmers, amateur programmers, and people that never knew what they were doing.

Erlang's syntax, people think is very ugly. But after you get used to the language you realize how absolutely perfect for the language it is! It is extremely simple, powerful, and side-effect free. The syntax is amenable to writing large, fault-tolerant, and concurrent programs. I actually think Erlang's syntax shouldn't be changed - it's so well suited for what facilities the language itself offers I don't really think it could be offerred up in any better way (although people are trying with different front-ends to the Erlang VM)

----

Here's my subjective opinion on each language with respect to web application programming. I will begin with PHP because that's the language I first learned how to program in:

PHP is great for precisely what it was built for. This isn't it's acronym but Personal Home Page sums it up well - PHP is really well suited for small projects. Projects that need to get thrown up quick. Say you want little website for your daughters soccer team with a guest list form - I wouldn't pick anything else but PHP to do such a small task in. Getting everything setup in Python or Ruby would not be a trivial task; in PHP it is trivial. PHP absolutely sucks for really big projects (again, just my HO) most PHP frameworks end up spending 40% of their "feature set" development on compensating for PHP's own shortcomings as a language and most PHP programmers learn methodology and processes that are PHP specific because most of it is "getting around" the warts in the language that are simply common sense and intuitive in other languages.

Oh, Python/Ruby don't lose because they "wrap" the web request as an "after thought" - even PHP has to "wrap" the web request. It just does it behind the scenes for you. With Python and Ruby, you're exposed to most of that so you actually have far more control than that which PHP gives you. PHP's strength is, ultimately, its weakness.

Python is wonderful for web applications - Python + Pyramid (framework) is probably the cleanest, logical, and innovative combination I have seen for web application programming yet. Python is easily readable by other people. Python has more high quality and easy to use standard and 3rd party libraries than just about any language in existence (remember, I said "easy to use"). Python also has a wonderful mix of functional features (list comprehensions, anonymous functions, etc...) and imperative features as well as a really powerful set of standard data structures.

Want to test to see if the letter "h" is in the string "hello"? Well, in PHP you would do this:

  if(stristr('hello', 'h') !== FALSE {echo "found!"}
in Python:

  if 'h' in 'hello': print('found!')
Python has had a lot of thought put into its design and it is evolving every single day to become an even clearer and better language. Still, Python is not a silver bullet for everything (although it is definitely used as glue in just about everything). Python does not support concurrency well at all (you have to goto stackless, but even then, it doesn't compare to Erlang).

Erlang is like LSD - it's so wonderful is such a strange way. Concurrency, fault-tolerance, hot code loading, and it's a functional language - Erlang uses pattern matching exclusively (if you haven't used pattern matching, you don't know what you are missing), tail recursion is something I love to use, and I love the naturalness of this:

  dolist([H|T]) ->
    do_something_to_the_first_list_element(H),
    dolist(T);

  dolist([]) ->
    io:format("List has been processed!").
Whereas in Python that would have looked like this (no recursion):

  def dolist(lst):
    if not lst:
      print("List has been processed!")

    for i in lst:
      do_something_to_the_first_list_element(i)
  
    print("List has been processed!")

Scheme? Oh man. Scheme is my favorite language - data-as-language, functional. That is all I will say.

I'm babbling on now - what I will say is this: if you're closed minded, this whole thing was wasted on you - but from one PHP programmer to another: broaden your horizons. Every language has pros and cons. Every. Even PHP. PHP's strengths are its wide adoption and low barrier to entry it's the perfect html templating language (honestly). But you won't become a better programmer because of PHP. You won't learn the beauties that I've seen in all of the languages I've described. There's more too - more languages that can stretch your mind in ways you probably can't even appreciate right now.

Get out of your pidgeon hole and learn something. Appreciate the fact that every tool has its application and that there is no "one size fits all" language.


I would say you're not a fan because you haven't tried them. For one, perl is very similar to php.


cleaner code is just a matter of coding standars, not a language feature.


I agree that for the most part this is correct. But, I also would argue that some aspects of a language can lend itself to more organized code. The include statement is one example where I think PHP doesn't help keep code organized. An actual module system with packages helps a good deal here.


unless you are talking about python, then readability is in fact part of the syntax.


As long as your talking about your own code, that's fine. However, a lot of people have found that the majority of code they encounter in the wild is really, really ugly.

So if you look at it from that angle, it makes sense to code in a language that tends to have pretty code, rather than one that doesn't.


One major advantage to using Python especially is the availability of many libraries and apis. I think that the main reason for the growth of PHP (at least in the beginning) was the good interface with SQL (LAMP). Now that there are good alternatives (MongoDB, Riak, Redis, etc.), PHP's SQL support isn't a must. I think that the simple nature of the ruby language is a good thing. The code is easy to understand and the libraries aren't a mess cough cough.

All in all, it comes down to personal preference.

Personal Plug for Python: I have used python for some major statistical analysis (over the web) and Django interfaces well with sciPy and numPy. Python also has much better native access so R works well with it.

AFAIK: Node.js was written for webapps. Also javascript is interoperable in most major browsers so you use the same language on client and server side.

Personal Plug for Node.js: I love node. It is really simple to use especially with coffeescript and express. The tools available are constantly growing and there are so many modules available. Also, node.js moves a lot faster with major releases and updates as well as the availability of any existing javascript library available.


This is the same advantage as Ruby - the community for both languages has been more vibrant and interesting than PHP for years.


Hardly. The PHP Drupal community alone is bigger than Ruby and Python COMBINED. Ruby is in decline and neither community has the innovation coming out of projects like HipHop, Wordpress, etc etc.

PHP is a mature language and isn't trendy, but it is far more vibrant, broad, and interesting than Ruby or Python.


The PHP Drupal community alone is quite a mess. I know - I'm using it every day. It's not that the developers are bad, but documentation and testing are not tenets of the platform.

Security updates routinely break functionality with no warning or knowledge on core and modules, and the community is architected to make it far more difficult to contribute new modules than necessary (not to mention submitting patches). I won't even update the Date module - ever (http://drupal.org/project/date); I can't count the number of times an update has introduced more bugs than it fixed. It's irresponsible.

PHP is a great language, and there are a lot of great tools, frameworks and websites written with it, but it doesn't mean it's the only game in town. What is most important is using the right tool for job, whatever it may be. Sometimes it's Drupal/Wordpress, sometimes it's Rails. Github's language page illustrates that pretty well: https://github.com/languages

Size doesn't matter. Utility does. Lots of good languages exist, but they're all just tools to be used by the programmer. I use Ruby because the community is rapidly developing fantastic, useful gems and tools that meet my needs and make my life as a developer easier. PHP does not meet my needs in the same way. Thankfully, the existence and usefulness of one language/platform does not negate the existence and usefulness of many others.


Just a few quick points.

First, PHP is a great language. It definitely has its strengths. It was the second language that I ever used to create web sites (right after Perl).

With that said, the number of people using something does not inherently make it superior to all of the other choices. PHP, Python, Ruby, etc all have their proponents and they all have their valid use cases. Which one someone chooses to use is largely a matter of personal preference.

Drupal is a great package, but I found it to be cumbersome and unwieldy for my purposes, which is why I started fiddling around with Django. Choices are good - HipHop, Wordpress, etc do not innovate in a vacuum.

Innovation is facilitated by maintaining an open mind and looking to offer improvements and variations on existing solutions. There is no war between the languages. Everyone can learn from each other - and they often do.

Now, as to maturity. Both PHP and Ruby have been around since roughly 1995. (People sometimes mistakenly believe that Ruby did not exist until Ruby on Rails, but it was around for quite a bit of time before that.) Python has actually been around (publicly) since 1991. All three languages are mature by any definition of that word.

As to broadness, I think that it is worth noting that Python has really come into its own in the area of scientific and mathematic applications. I have always found Ruby to be an amazing general purpose text processing and scripting language (in addition to web programming). PHP, on the other hand, I have not actually seen in extremely heavy usage outside of the web environment. I would be pleased to know of any though, but you must admit that the usage of PHP in developing web sites fairly drowns out its usage in more general cases.

As to community size, I believe that quality not quantity is what counts. Both Python and Ruby have a lot of bright people working on a lot of really great projects. Of course, PHP does as well, but there is no reason to be outright dismissive of alternatives (you know, Perl is actually pretty neat too, but I rarely use it nowadays).

Additionally, where do you have numbers to support your assertion that Ruby is in decline? That is a rather strong statement - you should have numbers to back it up, and TIOBE is not a very good source of data for this.


Where can I get some of that kool-aid?


Get me some as well, installed ubuntu server today...

apt-cache depends a* | grep -c python: 18711

apt-cache depends a* | grep -c php: 1596

apt-cache depends a* | grep -c ruby: 2839

Not that it proves anything but it might be an indicator.


There is no benefit.

PHP is great for doing rapid prototyping for web applications, and will suffice even for the final version in most cases.

Most here are concerned with producing something of value, so if it's easier to do in PHP, then do it! Your final product on the web will speak for itself, no matter what framework it was written in.


Good luck applying your PHP knowledge outside of the tiny sliver of software engineering domain that is web apps. Learning Python and arguably Ruby (now with JRuby out there) is a wiser long-term investment if you want to be able to use your skills towards solving other types of problems.


That's like telling a brain surgeon their skills are useless elsewhere in medicine. True, perhaps, but still a pretty stupid argument. You can make a pretty good living (and be perfectly happy and fulfilled) as a brain surgeon even if your skills won't let you become a radiologist.

I'd love to hear why Python and Ruby are going to prepare you to solve all sorts of problems but PHP isn't. The particular syntax isn't the important bit of coding - the problem solving mentality is.


It's a cultural thing and a library thing. I'm not well tapped into the Python community (which seems to have a healthy breadth of work going on), but with JRuby you have full access to the Java ecosystem which (needless to say) puts you in the position to solve all kinds of problems beyond web applications.

Your analogy is flawed since people go to school to become brain surgeons with the expectation of a life-long specialized career. This isn't the case with most web application engineers, who usually have a more general computer science background. You'd be hard pressed to find a PhD, our version of specialization, whose dissertation focused on the types of problems PHP is generally used to solve.


> with JRuby you have full access to the Java ecosystem which (needless to say) puts you in the position to solve all kinds of problems beyond web applications.

Putting aside for a moment the fact that PHP is Turing-complete, are there any examples of these amazing things you can do in JRuby that you can't do in PHP? Even the JRuby wiki talks mainly about how awesome it is to be able to run Ruby on Rails via a Java interpreter.

To extend the medicine analogy, being a surgeon isn't about how awesome the particular scalpel you're using is. It's about knowing where and how to cut. The same is true with code. Someone who's a really good coder in PHP likely isn't going to have much trouble learning other languages if they so desire.


Like I said, it's a cultural and a library thing.

First, the cultural.

PHP's community is largely focused on web applications, and has lots of folks that do not have a background outside of PHP or web applications. The PHP culture is generally one of "I'm not interested in understanding why its broken, just give me the code to fix it." If you browse the PHP documentation, you'll notice the comments are riddled with errors, bad advice, hacks, and so on. It even bleeds into print, I'd argue "PHP: The Good Parts" is the worst software engineering book I've ever read.

The Python and Ruby communities have their problems, for sure, but you're more likely to find good advice and altogether more competent people when asking for help there. There is a focus on constant improvement, elegance, and craftmanship while maintaining pragmatism in the Ruby community that fosters more of a joy for learning and building things than I think you'll find in PHP.

On the library side, I can't speak for Python, but my point with JRuby is that you have access to not only the Ruby ecosystem but the Java ecosystem. For the purposes of arguing the breadth of applications I can simply stop at the Java ecosystem, full stop, since it's arguably the largest set of libraries available on a single platform ever built. To start, just look at the Apache projects, Hadoop, Lucene, Solr, Mahout, and more give you access to state of the art machine learning, IR, and data analysis algorithms that are beyond your wildest dreams in PHP. And this, of course, is just the surface of what is available to you.


Putting aside Quercus, a PHP implementation on top on JVM, Zend at least provides a proper Java bridge into their Zend Server line of products, including the Community version: http://www.zend.com/en/products/platform/product-comparison/...

I tried to use Quercus, but besides templating, it pretty much blows at everything else PHP related. http://www.caucho.com/resin-3.0/quercus/

Therefore this isn't a sole feature of the J-something language implementation on top of JVM.


"are there any examples of these amazing things you can do in JRuby that you can't do in PHP?"

A big one, you can use native threads.

you can also grab a java machine learning library and use it directly in jruby, you can use lucene directly in your process, you can write hadoop jobs in jruby without using the streaming api, etc, etc.

Just think of java libs that don't exist in php and that's the benefit.


I started with pascal, moved to c and c++, and finally to PHP. If you know the concepts of one language, you can pretty much learn any of them.


IMO, a language derives the most of its real-world utility from (good, updated, relevant) supporting libraries. This is a great reason to learn python AND ruby.

(Personally, I have a project where I'm debating the two. I've decided Ruby for now but may move to Python. I hope I never do PHP again.)


I realize that this does not have much to do with the topic of this thread, but I wanted to share a quick tip with you from the perspective of someone who spent a fair amount of time debating Python vs Ruby.

I love Ruby because it is really an amazing language (and I knew about and loved Ruby before Rails ever came into the picture). I also love Python - it was the first language that I ever finished a major project in, and it is an equally amazing language.

They are both similar enough to make favoring one over the other an extremely difficult decision. At the same time, the differences between the two languages are strong enough to make it so that you will miss the features of one language when you choose the other.

I literally spent weeks agonizing over which one to choose for a major project that I was about to begin. Finally, I realized that I would have to make a decision if I ever hoped to get anything done.

In order to make my decision, I simply made a list of the libraries/modules that would be helpful to me in completing my project. Then, for each item on this list, I looked at the status of the pre-made solutions that were available in each language. Where there was no library available in either language I just crossed it off (I'll write it myself).

When I was done, I looked at the list and choose the language that satisfied the most of my 3rd party library needs. For that project it was Python. When I repeated the process for a different project, then it was Ruby.

The important thing was that I was able to overcome paralysis by analysis and finally get some coding done. I don't know the size, scope, or nature of the project that you are working on, but I hope that my experience is able to help you in some way.


I'd say a good reason to try writing a web app using other tools is because a) you don't know why because you have no experience and b) lots of other people are doing it.

Isn't that enough reason? While languages like Ruby and Python were not designed 'with the web in mind', PHP wasn't designed _at all_. You won't understand this until you've had some reasonable experience with real programming languages. Enjoy!


I know PHP pretty well and enjoy it. I just started learning Ruby on Rails and it is VERY fun. It is simple and with rails it is quick to launch apps. I don't think i'm experienced enough yet to see the downside with RoR...but for now I'm happy with what I see.


Most of the time, when people have problems with Ruby on Rails it's because they fight with it instead of doing things "the Rails way".

It used to be that a big downside of Rails was deployment, but with things like Passenger, Moonshine, and Heroku, deployment is a snap now.


I've been building web applications for almost 10 years. I can build a Rails app about 5 times faster than a similar PHP app. I know there might be some PHP frameworks out there, but even with those in-mind, I would say Rails is probably 2 times as easy to develop and deploy because of things like Heroku.

I know these are rough numbers from my perspective, but the efficiency and effectiveness of the framework really adds up.


You can deploy a php app just as easily on dotcloud :) http://dotcloud.com

(Disclaimer: I work there)


Even without things like dotcloud, setting up a PHP app takes about 15 minutes on Linode/Slicehost. `apt-get install php5 apache2 mysql-server` and you're about 75% of the way there.


To really answer your question you pretty much have to write your own Django/Rails app. Why don't you give it a try in a new project?


I would echo this advice as well. As a mainly PHP developer I have learned a lot of cool ideas and techniques from Ruby on Rails that I have brought into my PHP code.

For example, the idea of the "flash" and how to properly do MVC.

Just learning another language (programming or not) opens your mind to new ideas and ways of looking at things. If those aren't reasons enough, then what about increasing your work skills and marketability?


I completely agree with this. Up to a couple weeks ago, I had only programmed in .NET and php. I got bored one day, and decided to learn python. I loved it right away, and now I'm learning Django and building my first web app in python. You can ask other people about which they think is better, but you're going to always get different opinions, so the best thing to do is try to figure it out yourself.


Because modern web apps are more than just a thin layer over the database.

Here's my recent experience:

1. An image server cobbled together using RabbitMQ, OpenCV, and Imagemagick. ElasticSearch is used for title/description searches.

Sure this could technically be done in PHP, but 80% of the code has nothign to do with the web in particular so its better to use a general purpose language that was designed from the start to be that rather than PHP which was a domain specific language that evolved to where it is today.

2. Hedge fund manager using Quantlib and NumPy. There's no equivilent in PHP. There's no easy way to interface with C-code. Cython and Cytpes make it easy. Doing so in PHP means hand writing a C-extension. I've done that before and let me tell you the Zend Engine not a pretty thing to work with.

3. Any project that has a rich client side interface built in javascript will get gains from using Python over PHP. At that point your server is really just a message backend controlled via REST or JSON-RPC.


Productivity with PHP peaks near the time when you start your project (when it is great and beats out a lot of other technologies) and without a lot of work, goes downhill from there. Put simply, it is not designed to scale well in terms of code size and complexity. It is very concrete and doesn't encourage any use of abstraction by default. For some types of apps & sites this is no problem and the simple and flat design of PHP will actually be of benefit.

There are frameworks that alleviate some of these issues (Cake, etc.) but they are really compensating for the language deficiencies that cause the problem rather than solving them. Other languages give you a little more overhead, are a little more generic, but in return they give you far stronger tools to deal with the complexity burden that (inevitably) hits at some point for many projects.


If you're going to write a well-designed PHP web application (and that's subjective, but I believe most people would have a similar idea of well-designed,) you're going to end up writing or using a "web wrapper" (or in other words, framework) anyways.


For me the issue isn't whether another language or framework is better for the job at hand than the tools you've spent time building up an expertise in. The thing that matters is that you don't develop a closed mind which prevents you from looking at ANYTHING else out there.

Evolving your sklls and constant learning is the hallmark of a good developer, not whether they learn Rails or Python now. Curiosity and a willingness to admit that something new and better might be out there matter more than pseudo religious battles between ardent users of one or the other piece of tech. That's going to keep you in software development for the next 25-50 years.


For me, I started using Python because I could write the front end (web-facing) and back end code in the same language.

Meaning I can write back end services like mail server and share models and other code across both.

You could argue that you can write back end services in PHP, however, it was no designed with that intention and in my honest opinion it does not translate very well because the infrastructure in terms of open source libraries just don't exist as PHP is primarily a web language.


My experience is diametrically opposite to this.

What infrastructure and open source libraries don't exist for PHP?


Full stack web servers like Mongrel or CherryPy.

Server fabrication and automation tools like Chef, Puppet, Fabric.

Process management tools like God.

Parallel worker systems like Resque or Celery.

PHP is great for web apps, but the further I've gone into systems programming, the more I need Python/Perl/Ruby (or C).


You are not answering the question that was asked. ianl's post was directly in reference to web application development, not systems programming. Of course you wouldn't do that with PHP. That's like saying "yeah, it's a great knife, but it can't change my oil." Well...sure. Nobody's saying it can. But it does what we're actually talking about just fine, and I am skeptical of ianl's claims that there are missing pieces of the infrastructure for web development.

(BTW: Puppet not playing nicely with PHP is new to me as I use it regularly. And I don't think you get much with Mongrel that nginx/FPM don't do well enough.)


How about evented frameworks like Tornado (python) or Goliath (ruby)?


That's actually a good point, and I'm a big fan of Tornado and Manos (C#) myself.


Agreed. For example, I've worked on apps using the phpmailer library for nearly a decade, delivering 100 million optin emails without issue.


Yep. And if you use something like Thrift ( http://wiki.apache.org/thrift/ ) building a SOA that includes PHP service components is fairly simple.


It is interesting to think of a language specifically designed for web apps as different from a general-purpose language. This would of never occurred to me unless I only knew PHP.

I suspect if you tried to make a good web app language it would look like ruby or python, and really good web app language -- one very scalable -- look like haskell or scheme.

But to answer your question directly there are too many benefits to mention and they are language specific. I think transitioning to ruby and rails environment would be rewarding. I myself like Scala much better than ruby even though it's static typing is painful at times, and choose the rails-like framework Play! (http://scala.playframework.org). The front page shows you examples of the language expressiveness.


A nice side-effect is that you'll come out of it knowing another language that is useful for more than just web stuff.


You can't really say PHP was designed for web scripting... for the most part, PHP wasn't designed at all.

By the time you get to more advanced apps, the advantages of PHP disappear and all you're left with is a somewhat messy language.


There's really little reason to not use PHP, except in special usecases, like real-time services, or massively multiplayer, for example.

Facebook is, even today, basically still a monolithic PHP script.


This isn't really true. Facebook has some PHP (although a lot of their PHP is actually compiled to C++ - it isn't in a meaningful way "a PHP script," but rather "a PHP program) and a pretty wide variety of technologies in their service layer (and any website that actually has a service layer is difficult to call "just a script").

It is certainly not "monolithic."


In a conversation with a couple FB devs a few weeks back they mentioned that their codebase is now less than 50% PHP.


I got that literally from a recent presentation from a FB engineer. Here it is: http://www.infoq.com/presentations/Evolution-of-Code-Design-...


That same presentation walks through some OO code patterns they use; that's far from "a giant script".


There is nothing related to web development that you can do in other languages that you can't do with PHP. That should suffice for your first question: Do not rewrite any of your apps. If you want to learn another language, there are tons of stuff you can do with Python, from numerical programming to openGL.

There is a widespread opinion that PHP is not as sexy as other scripting languages, and that it is too domain specific. That may be true. There is another opinion that with PHP you can only write spaghetti code. That one is false, it's up to you to organize your code. I 've been maintaining PHP scripts for years and didn't have that problem. Plus achieving good performance is easier with PHP, and that comes handy with high traffic sites.

I like python for non-web projects. If only Android or iOS was written in python.


"I recently considered moving all my web apps from PHP to something else, mainly because I was bored and it was an excuse to get proficient with another language."

It's just about the worst excuse going if your apps are of any value whatsoever


Because you're not a blathering imbecile with an IQ under 60.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: