Ask Slashdot: Which Web Platform Would You Use?
New submitter datavirtue writes "I'm about to embark on developing active content (database driven, and web services) for the first time for my website and I have grown to love PHP. Knowing that there are other web development platforms available, and noticing some disdain for PHP in some circles, I'm curious to know which platforms slashdotters prefer along with the reasons why. Before I get started into heavy development I would like to get some opinions and more facts. Why shouldn't I use PHP?"
PHP is fine, but if you want to learn about a better, enterprise-ready languages I would suggest using ASP.NET. It integrates perfectly with .NET apps and libraries and comes with a comprehensive library (as it uses .NET). The great thing about ASP.NET is that you can use C# to develop for it. ASP.NET also comes with various functions to make state management easier - an important feature that is completely missing in other languages. It also has built-in cache management.
.NET. This means you can use VB.NET, C#, J#, Delphi.NET etc. And because you compile the code to bytecode, it runs significantly faster. On top of that Visual Studio is a great free (and commercial) development environment.
ASP.NET originally lacked templating engine, but Microsoft introduced it in 2.0 version. You can have master templates that have placeholders for the dynamic content, as well as all the HTML and JavaScript that is shared between all pages.
It is basically more than your off-the-shelf PHP/Python/Ruby. ASP.NET provides much larger library to use, has templating engine, error handling, controls and events (and hence is more familiar to Windows developers), caching, object-oriented design and session control which can even be saved in SQL Server. It's not just a language, it's the complete package.
One of the great things about ASP.NET is also that you can use your favorite language to develop for it, as long as it supports
Oh, and if you want to run ASP.NET under Linux servers, it's easy too. Apache has mod_mono module or you can use it via FastCGI.
Most hate towards PHP comes from elitist snobs who don't know how to use the language. PHP is perfectly fine language to use, and it is extremely powerful and flexible. If you are going to develop for web, I suggest using some framework, as it makes the process much more straightforward, faster and better. I personally use CodeIgniter, which is fast and has a good library of helpers and other essential framework stuff. CakePHP is often suggested for persons new to frameworks, but I would stay away from it. It's slower and it's more pain in the ass to learn.
There's also other good things about PHP. First of all, it works with practically every web host out there, and doesn't require you to play around with it to get it work. It has an extremely comprehensive library, amazing documentation and almost all API's have client libraries for it, if they just have some. PHP, being the #1 platform on the web, gives you that advantage.
...as Subjective and Argumentative.
Oh, wrong site.
Bitten Apples are still better than dirty Windows...
I've been using Django for a while now on my web app, having moved away from home-brewed PHP. Very easy to use, and encourages well-written and elegant code.
Ydco co
PHP is an ugly programming language. Just look at a comparison with some other languages to get a feel for its ugliness: http://hyperpolyglot.org/scripting
I use PHP for 90% of my work because it's the right tool for the job. We can also bring other developers up to speed on our own framework and projects pretty fast.
There are times when Python is a better fit. The fact that it remains running across page loads can be very handy (as opposed to every request to PHP being completely distinct, which has its own advantages). A continuously running app is often better for backend processing, especially when interacting with third party systems.
Developers: We can use your help.
It does have its flaws but there are a plethora of Java based frameworks out there.
The sheer amount of options you get at zero cost(some of it actually Free) and the quality of API documentation is simply astounding.
20 minutes into the future
Use the language of Money and buy someone to build it for you. Problem solved!
... well, not really. But there is such a thing for the web: http://www.runbasic.com/
Oh arse
Wt is the best one I have tried. I use the C++ version, although there is also a Java version (JWt).
What makes Wt unique is its approach: widgets. You develop web applications like you were developing desktop applications. Also, the API is Qt-like (but using Boost).
I gave up on Rails after I used Wt.
Want a virtualization console? Take Wt, libvirt and an HTML5 VNC client and you are done.
Need Active Directory authentication? Wt, Samba (or Windows APIs if you are on Windows), done.
Streaming? Wt, ffmpeg libraries, done.
Forgetting about bindings and being able to use the millions of C/C++ libraries out there was a huge relief.
Also, size: Rails, Django (and even PHP) just do not fit in an embedded environment. Wt does.
Wt ("witty") is a C++ toolkit that is modeled after Qt. It uses boost and STL, but you get to use familiar Qt concepts - signals & slots, Model view, etc. Basically think of Qt-based web pages. It fully supports AJAX and can handle the data server-side or on the client. It also has a C++ -> JS converter so you can just make a function for conversion to JS and have it exec on the client. Of course it runs as a module, or it comes with its own server. It fully supports CSS, DOM, etc.
I reall like this approach because my two complaints of PHP:
1. It is unstructured
2. it is ugly (both syntax, and having code embedded in pages)
are alleviated.
1. C++ object orientation encourages a structured approach.
2. The "it's 100% C++" ensures that you focus less on the presentation in PHP and just on the application logic. This helps encourage a model-view-controller approach. While you might have to write CSS, you will never have to write HTML and you won't ever have to mix the two in a CPP file.
Another reason is speed. Everything is compiled and runs natively, or compiled to JS and moved to the client.
Yet another reason is security. Wt has several protections built in. See the features link below.
If you're looking to do web pages entirely differently, this is it.
Additional features list
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
I've been doing a lot of web programming, and I evolved from PERL to PHP to Python. I happen to prefer Python these days, but there's nothing wrong with PHP. I wrote my company's PTO system using PHP (LAMP) and it works great. I would also suggest JQuery or similar for richer content.
Most "disdain" for any given language is mostly elitism and people self-validating their own choices. It's true PHP can be messy, but I recall having a Ruby developer look at my PERL code and be surprised at how readable it actually was... in other words, it's up to the programmer. I can make some pretty ugly programs in any language.
Stupid sexy Flanders.
You might as well ask which religion is the best one.
Nobody should be allowed to register an opinion in this topic without linking to their githubs.
Here's a little secret for you: Anyone that uses the word "enterprise" is full of shit. It is used by mediocre developers who work at relatively big corporations and have been forced through the years to work with a bunch of bureaucracy. This people can't release a fucking shell script without 10 formal test cases, 50 meetings, 10 flowcharts, and it's own repository.
Serious huge projects are written in C++. Serious huge projects that need incredible performance are written in C with assembly optimizations. When somebody tells you that you can't write anything if it's not done in Java, that guy is a corporate droid. If somebody tells you the same for Perl, he's an old monk. If somone tells you that for Ruby/Python/Brainfuck, he's a snob and a fan of that particular language, ignore him too.
Truth is, leaving aside the obvious differences, when it comes to features that help organize huge projects, C has nothing that PHP doesn't implement on some way. Don't get me wrong, I'm not comparing the base of all modern computing with a modern and not very well designed interpreted language, I'm talking about features that some idiots would call "corporate". And yet, there are incredibly HUGE projects written entirely in C. And yes, there are also huge projects written in PHP.
Truth is, if you are a good coder, you'll do a good job even if you have to use Basic. And if you are not, you'll write spaghetti code even in C++.
PHP is a simple, straight to the point language, with a very clear syntax, that is great for web development. It's syntax is very much C-like, just like Javascript, and that certainly helps when you are writting web apps. It's easy to find PHP coders, and that certainly helps too.
The problem with PHP's reputation is that it's incredibly easy to just write some script or modify an existing one, and call yourself a coder. So the amount of bad PHP code out there is incredibly huge and incredibly public. Of course, if you reviewed each of those Corporate-enterprise-mega-super-jumbo java apps, you would find as many WTFs as you could in your average PHP project, the only difference is that the assholes rooting for Java won't show you their code, and they'll act very dignified.
Also, avoid the motherfucking frameworks. You don't need them, at all.
WTF am I doing replying to an AC at 5 A.M on a Friday night?
Yes, it's still very actively developed. Especially if you throw in Moose and Plack.
So.. it has come to this
They all suck, which one sucks the least depends on the circumstances of your project (time, budget, techincal aspects, what you already know, what you would like to learn, performance requirements, scalability requirements).
I'd recommend that you start learning Python. I moved away from PHP to Python in late 2008 and have NEVER, even once, looked back. Its just a better engineered language and the community is more deliberate and professional. SQLAlchemy is the best database library/ORM ever! And there are plenty of web frameworks to choose from (start with Flask or Pyramid).
Here are some thoughts from 2008 that got me moving away from PHP towards python. The python web community has grown a lot over the last few years, so my comments about Python being hard to get started in can be considered somewhat deprecated:
http://old.nabble.com/Creole-is-Dead,-long-live-Python!-p20488959.html
http://propel.tigris.org/ds/viewMessage.do?dsForumId=1093&dsMessageId=88191
Finally, Python is much more general purpose than PHP, so the Python skills you learn while doing web development can be put to use in other programming areas (I do a lot of scripting and data manipulation with Python).
First, I should state that it's really not about the language, it's about the coder. You can build great and crappy things with any language. And every language has it's warts.
That said, the best language I've used in the past 20 years of programming has got to be Modern Perl. Not the chicken scratch Perl you saw 5 or 10 years ago, but Modern Perl. Here are some of the strengths of modern Perl:
It's object system: https://metacpan.org/module/Moose
It's web frameworks, especially Dancer: https://metacpan.org/module/Dancer
It's ORM: https://metacpan.org/module/DBIx::Class
It's package installer: https://metacpan.org/module/App::cpanminus
And so much more. Do yourself a favor and at least have a look at Perl.
I second the AC, you can use pretty much anything as long as you're good at it, but not ASP.NET. Every implementation I've seen has fared poorly when compared to similar projects done on other platforms. I can't really say why, after all it *seems* like it should do well and developers seem happy at first, but after a couple years, every one seems to falter and either start suffering performance wise (bloat? rot?) or climbing maintenance costs. It shouldn't be that way of course, but that seems to be the common trend.
PHP is fine if you enjoy working with it and can keep it up to date, particularly if you have a framework you like to use it with... to a point. If you expect the code to be maintained by a team of people in the future, and need the best possible performance you can squeeze out of it, then you might want to look at something else. It is nearly always easier and cheaper to buy more hardware than it is to rebuild code, but sometimes foresight before the project can give you better bang for the buck down the road.
From a developer standpoint, I've had really good luck with my own PHP. Years after it was written, I've been able to go back in and do maintenance with little effort. Mostly that's because my programming tendencies tend to be pretty static (stagnant?) and I do comment. Facebook is running on PHP and Wikipedia is running on PHP, so there is no question that it *can* handle the big jobs, just a lot of questions as to whether it is best suited or not.
The same can be said for Perl. If you can handle maintaining it well, and you're good at it, you can work with Perl for years and years and get good performance from it. It runs /. after all, so it can handle a pretty serious load and scale if it really needs to. It has much the same issues as PHP, it *can* but is it *best* is the question.
By far the best web experiences I've had from the consumer side were compiled code. C, C++, C#, Go, Visual Basic, or whatever floats your boat as long as you're good at it and can manage the support for it. Yet, the difference in performance isn't all that great, so I still do recommend Java or Python. I don't particularly love using either one, but both perform well and seem to be enterprise capable, in fact, I really recommend looking at AppEngine if you can stomach it because it will give you a good testing platform and huge scalability later if you need it.
B) Eliminate all the stupid users. This is frowned upon by society.
I've done professional projects with PHP and Python (Pylons specifically, with Mako for templates and SQLAlchemy as ORM; and a few small projects with web.py)
After a couple of years with Python, every week or two I'm still learning a wonderful new thing that makes me smile and makes life easier.
After a couple of years with PHP, every day (sometimes several times per day) I'm finding some bug, design flaw, or general retardation in the standard libraries that makes me want to simultaneously cry and punch a PHP developer. Taking a look down my commit logs for the past week:
6 WTFs and it's only Tuesday. This in addition to all the regular and well-known retardations, like how they thought it was a good idea to automatically escape all input data assuming that it would be inserted into a mysql database - but they escaped it in a broken way, so even if you did want to insert it into a mysql database you'd need to un-escape it and then re-escape it properly (remembering to use mysql_real_escape_string, because mysql_escape_string is buggy and insecure. Not that anyone should be building SQL strings by hand anyway...)
The one and only positive thing I have to say about PHP is that it has a low barrier to entry; any monkey can take your code and install it on their cheapo shared web host, and do simple modifications for themselves.
I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
ASP.NET or JAVA EE are all perfectly fine and their real advantage in Enterprise development is the ability to find good Professional Software Developers.
PHP as a language is a personal preference... However many of the PHP Developers do not do too much Enterprise coding so PHP code tends to be sloppy. While ASP.NET or JAVA EE Code seems to be written in more of a professional way.
You can write good PHP Code that does everything that ASP.NET or JAVA EE does and it may even be better and faster. However the people who tend to write PHP do not code thinking of enterprise teer development
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
So, you have a couple options, each with plusses and minuses:
1) PHP, with Zend or Cake (or some other framework). PHP is not the fastest executing, but it's easy to learn, easy to find developers for if your project grows, and is perfectly functional for front and back end coding. I strongly recommend going with Zend or Cake. There's a steeper learning curve, because you'll have to pick up some OO principles, but 5 years down the line when someone is maintaining your codebase, they will curse your ineptitude slightly less. Even if that person is you.
2) Railo with ColdBox. Railo compiles its code to Java Bytecode, and is extremely efficient. It's blazingly fast compared to PHP, still relatively easy to learn, and with the ColdBox framework, you'll still end up with some pretty clean, maintainable code at the end of it all. You have to run it on a Java Servlet Container though, which will have a large server footprint, and carries along with it some higher priced dependencies than just a simple LAMP setup.
3) Python with Django: Dead simple to get a development environment up, very fun language to code in. A lot of support in the open source community. Python/Django is a very popular choice. Just about any outside communication you want to undertake is well supported in Python, with native libraries often available from the API providers. Moving from PHP to Python may be a bit tricky though, and some people don't like the fact that Python is "whitespace sensitive", so the formatting of your code is very specific.
4) Ruby and Rails: A TON of support in the Open Source world. Very Sexy, though less so than it was 2-3 years ago. Very easy to code in and update. However, there are downsides: Ruby people are in demand, so hiring extra developers will be expensive, and the Rails framework itself is constantly in flux. Just looking at the last 5 years, Rails is very different today than it was then.
5) Microsoft Stack: ASP.Net MVC, Visual Studio, SQL Server, IIS. Look, a ton of people hate on Microsoft, but honestly, if you buy their stack top to bottom, a ton of stuff "just works". Building a simple app on MS Servers, with MS tools, in MS's recommended style can be done in no time flat. However, deviate from their master plan just a bit, and watch your house of cards fall apart. Want to run ASP.Net on a linux server? Mono is missing huge chunks of functionality. You'll probably have to re-write your app. Want to Connect to a MySQL or Oracle Database? Suddenly Entity Framework breaks down, and you're back to writing SQL in DAOs if you're lucky. Don't want to pay the $1200 license for Visual Studio? Sure you can try using MonoDevelop, but it'll take you 3 times as long to code your app, and any tutorial or blog posts you read you'll have to put through the "mental translation" of Visual Studio to MonoDevelop. Oh, and that's leaving aside the cost. Potentially tens of thousands of dollars sunk into the stack just for the software, not to mention the hardware that runs it.
If you write your program as a "FastCGI" process it's running as a normal process that accepts tasks one at a time from the web server and sends the results back for the webserver to forward to the client. Your process keeps running so you don't have the overhead of continually restarting your web program that you get with plain CGI.
It is, in theory, possible to have a FastCGI server using a shell script. But pointless because FastCGI is supposed to be used to eliminate cost of starting of processes. Otherwise any language that makes normal executable program can be used, if a library exists or you write something following the (pretty simple) documentation, but for really limited languages you may need a wrapper.
Once you're writing your own persistent program in your own choice of language to service the requests the rest is supposed to be easy. :-)
Each PHP release is better than the one before it, and it's getting close to being much like a "normal" language.
Close. It's not there yet, and probably never will be, due to compatibility requirements.
You can pretty much do anything in PHP you want, but the bigger your project gets, the more you're going to run into its weirdnesses. I don't have a list to enumerate for you, but please believe me, I run into "Holy shit, I don't believe this" language oddities every couple months, where PHP does something just plain weird and wrong compared everything else. After nearly 5 years maintaining some PHP code, I still get surprised once in a while.
Another thing to look out for is that PHP versions deployed on various web providers vary, so when someone says PHP 5.3 fixed something that had been totally fucked-up-beyond-belief in the language before that, they might be right, but are you sure you're going to be using 5.3?
Just look at the release notes to get some idea how bad things have been. I'm not saying that's a fair way to judge the state of the language as of the latest release, but when you see quotations from the past (as recently a just 2 years ago) about how great PHP is, and realize just how horrible PHP definitely was at the time the person said that, you'll realize that most PHP recommendations need to be taken with a shovelful of skepticism.
That said, if you inherit and have to maintain a PHP project, I wouldn't worry too much about it. Your brain will eventually get used to all the damn dollar signs in the variable names, you will be able to get your job done. I've never been in a position where I could say "It's not my fault, PHP just can't do it" because it always can. There's always a way around PHP's problems and it has never stopped me from accomplishing a goal, but you are going to occasionally be expending more effort than programmers who use normal languages.
Don't spread it. Don't start new projects in PHP, both for your own sake in case the project grows, and for the sake of whoever comes after you. There are plenty of not-broken languages out there.
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
I suggest your whole team takes some course on software architecture and design patterns. Contrary to what you say, .Net does not encourage that - you people simply don't know what you're doing. If you write that kind of crap in .Net I'd hate to see your PHP code.
AccountKiller