views:

2887

answers:

15

I found myself struggling with me every time I am asked, which language to prefer for a web-application. Most people dismiss the importance of a good architecture. That why a answer that architecture is more important than the language. Afterwards sometimes I sompare the advantadges. But that is always not about the language but im most cases:

  • about the IDE
  • about tools
  • about costs
  • about a community and distribution
  • about existing frameworks and libraries

etc.

So I am currently asking myself: Is the advantage of the comfortable Visual Studio, the tools, the framework, ... worth chooing ASP.Net over PHP or Perl? Are the higher licence and hosting costs worth the ease of coding?

+9  A: 

There are a couple of issues to consider:

  • Maybe it's just me, but I'm just not diligent enough to produce really maintainable PHP code, or at least, I find doing so much easier with C#, so for an application with a longer lifecycle it might worth considering the maintainability issue
  • With ASP.NET you get the whole .NET Class Library and the thousands of third party components as well. There are definitely much more third party components out there for .NET than for PHP.
  • Even though the server (Windows Server) and the IDE (Visual Studio) are much more expensive, this is usually nothing compared to hosting costs, etc. Also, you get the best IDE available for your money.
  • I think the community is not really an issue; the PHP community is really great and very active and so is the .NET community (just look around on this site)

I don't know much about Perl so I can't really say anything about it.

DrJokepu
I agree with most of your answer, but I would mention that in my experience, most ASP.NET projects would do perfectly well with Microsoft's free Visual Studio Express editions (http://www.microsoft.com/Express/).
Matt Peterson
@Matt: I have never tried Visual Studio Express editions so I don't know much about them. My problem with them is that I believe that, for example with MSVCEE Web Deceloper you can only create web projects, that is, you cannot refactor some of your code to a separate dll. Is that true?
DrJokepu
I agree on maintainable code and PHP. Its just _too easy_ to cut corners. Though, MVC frameworks do help keep one in line, if you can resist 'improving' their structure differently on every project :)
Tim Post
+17  A: 

So I am currently asking myself: Is the advantage of the comfortable Visual Studio, the tools, the framework, ... worth chooing ASP.Net over PHP or Perl? Are the higher licence and hosting costs worth the ease of coding?

I think this is really going to be a question of personal preference. If it were me, I would consider the Windows platform and IDE a disadvantage. Anything that's not emacs is junk.

For me, that would narrow it down to something like Perl, Lisp, Haskell, Python, Ruby, or PHP. Since you mentioned PHP and Perl, and I know both, I will speak to those.

PHP is easy to get started with. You drop a file in the directory, and it works. Copy it to the server and it works.

Unfortunately, the language is missing many essential modern features. All variables are global. The OO system is broken. There is no (coherent) Unicode string support. There is no culture of writing libraries. There is no culture of automatic testing.

Perl is pretty much the opposite. When you deploy your apps, you will probably need to install a bunch of CPAN modules. Perl programmers LOVE library reuse. So, when you're getting started, you'll need to learn how to install libraries, because you won't get far in Perl without them. When you deploy your application, you'll have to choose between plain HTTP + Reverse Proxy, or mod_perl, or FastCGI. There are a few major web frameworks (though Catalyst is generally recommended as the Standard). There are even different object systems (but again, Moose is what you want). You'll spend a bit more time configuring your system, and a bit more time choosing libraries with Perl.

But, the idea is that Perl will give you much more choice than any other language. Things will work exactly as you want them to. The community is super-active (there is an independently organized Perl conference at least once every month, and the irc channels and mailing lists are always busy and always helpful). Every module ships with a test suite, to ensure that the library is working correctly on your exact machine and configuration. (No guessing!)

So basically, if you are willing to trade a higher learning curve for better libraries and community, use Perl. If you don't care much about what you are doing, and just want to be done, pick PHP.

jrockway
PHP: only special global vars are global, unless explicitly made global. OO system is not broekn. There is Unicode string support. Libraries do get written. 4/5 wrong.You obviously don't know what you're talking about when it comes to PHP.
orlandu63
Agreeing with orlandu63. PEAR is *huge* and completely OO. There is decent unicode support in PHP. And there are tons of testing libraries out there. There's a big distinction between the script kiddies who pick up PHP overnight and the professional PHP community.
Ryan Doherty
PEAR is average sized as library repositories go. Perl is at the top. This may not make a difference if you are just going to extract data from a database and put some HTML tags around it.
jrockway
As for OO, PHP has something that looks like OO, but so do C, C++, and Java. Where is multiple dispatch? Where are the metaclasses? Where are type constraints? Where are Traits?So sure, there is *some* OO, but it's incomplete.
jrockway
As for Unicode, it works in PHP because most apps process it as binary. Yes, PHP is 8-bit clean. Try the equivalent of this in PHP: perl -Mutf8 -e 'print scalar reverse("ほげほげ")'You will get garbage, not "げほげほ".
jrockway
I revesed that string here http://stackoverflow.com/questions/434250/how-to-reverse-a-unicode-string
OIS
You didn't really answer the question at all... your response was useful, but just pointing out that despite being the accepted answer, it doesn't explain any advantage for ASP.NET at all...
PRINCESS FLUFF
I don't use ASP.NET, so I can't comment on it.
jrockway
I don't know what you mean with "The OO system is broken". All members and all methods are public. By convention, members and methods starting with _ are private. Encapsulation exists only by convention. You are always able to cheat... IMHO POO with PHP 5.2 is very good.
Luc M
are you saying that visual studio is junk ?? and you compare it with a text editor !
Yassir
Clearly you do not even know what real OO is. "public/private/protected" has nothing to do with it. Read up on Smalltalk and CLOS, then you can talk about OO.
jrockway
@Yassir, UNIX is the IDE, Emacs is the text editing component. (Although I personally bring a lot of UNIX into Emacs; eshell, etc.) It is fine to use VB if you don't know any better, but ... you know, not everyone doesn't know any better...
jrockway
@jrockway Encapsulation is a basic principle of OO. I would like to know why you wrote "The OO system is broken". A day without a lesson is not a good day :-)
Luc M
The IDE is a disadvantage? Come on...
Stilgar
Maybe write your own answer instead of whining about mine? It's the Internet, you know... you are entitled to your opinion, and I can have mine.
jrockway
This answer is definitely personal preference. I don't see a single valid reference or point at all. In fact many of the PHP points are absolutely invalid.
bucabay
Which points are incorrect? Like I said, don't talk about OO until you understand that Java and C++ are not very good OO systems. Read up on Smalltalk, CLOS, and the CLOS MOP (there is even a whole book; the Art of the Metaobject Protocol).
jrockway
Necessity _is_ the mother of invention. While PEAR does try to provide what CPAN does, I find myself digging through sites like phpclasses far more often. Usually, what you find there are solutions to problems that other people decided PEAR just was not solving correctly.
Tim Post
+2  A: 

I develop in C# using MonoDevelop on OS X. It's definitely missing some polish, but most operations run much faster than Visual Studio. Like clicking "run" on a web app launched almost instantly, can be up to a minute on Visual Studio.

I've also have no problem deploying to Windows servers from this environment. But in short, you don't HAVE to pay the Microsoft tax. Novell based Linux supports Mono out of the box as well, as do many other distributions.

The language of C# is very elegant and easy to read. It's also incredibly fast compared to scripting languages. When I worked at CCBill, we had some contests and C# was of the magnitude 400x faster than Perl, which even surprised me.

If you want to think of your web app as a program that spits out HTML, using PHP and Perl. If you want to write a software application that just happens to deliver its content to the browser, use C#.

I tend to write my PHP/Perl as objects anyway.

Also, don't automatically do things the "one microsoft way". I've had Microsoft certified techs scratching their head how I was able to make things work by coming up with my own ideas on how to use c#. Investigate what Microsoft provides, then decide if you need to write your own solution, which you'll find you can do quickly.

that "one microsoft way" is what made me move away from .net toward other languages specially PHP, i know it is a big difference but it also depends on what you are developing
w43L
+1  A: 

So I am currently asking myself: Is the advantage of the comfortable Visual Studio, the tools, the framework, ... worth chooing ASP.Net over PHP or Perl? Are the higher licence and hosting costs worth the ease of coding?

I use all of the three options that you have mentioned but you can enlarge your options like, Ruby on rails, Django or any of Java based frameworks. First of all web programming with Mason and Perl is pain in the ass (I haven't used Catalyst yet). Perl, php and .NET web frameworks are in different categories, I think. From my observations .Net web apps work faster than PHP, apache, and Perl mod_perl; and .Net is more secure, I guess. But PHP and Perl has superior parts on .Net too. If you want build blog, CMS or dating site I would choose PHP, Perl category but if you are planning to build a secure banking application I would choose Java-based frameworks (Spring, Struts, JSF).

I think java web frameworks are superior then the .Net for commercial and enterprise applications. They have very rich tools (netbeans ide has a wyswyg kind of web framework just like in .Net) many documents etc. .Net is again faster then Java frameworks and C# is a much more better language then Java again but imho as a technology Java frameworks are better and they are open source.

systemsfault
+1  A: 

Is the licensing cost really that high for ASP.NET that its worth using a language you are less familiar with like PHP or Perl? I have to recommend you go with the high level web language you are most familiar with. All 3 will do the job, if the programmers know what they are doing. Other languages like Java and Python could also be considered if that is what the programmers are most familiar and comfortable with.

For a personal opinion, I would stay away from Ruby (slow) and Lisp (difficult to find coders?) though.

OIS
+8  A: 

I use both PHP and ASP.Net on a regular basis, and I feel that they both have their advantages and disadvantages. My take on this is if you're starting from scratch and have access to the latest and greatest Visual Studio and .Net framework version, then that is a strong advantage to ASP.Net. I've always been more partial to PHP because I started working with ASP.Net 1.1 in Visual Studio 2002 and that was just pure garbage. If you want quick and easy and don't care too much what's going on at the low level (basically, if you're not expecting a tremendous amount of traffic for your web app) then the easy choice is ASP.Net. You get that huge class library and all sorts of 3rd party controls to just drag and drop to build your app.

On the other hand, if you want more control over the code and want better performance, it's my opinion that PHP is the better choice. It's just a matter of how well you can maintain your own code when the application gets bigger and bigger. If you want the structure of a framework and some built-in functionality to start with, then build your app around one of the open source MVC frameworks like CakePHP or CodeIgniter. Once you do that though you start introducing overhead the same way you do when you use .Net, however I doubt that the amount of overhead is anywhere what you'd get with .Net.

If I were to start a web app from scratch right now, and I was expecting it to have high traffic, I'd do it in PHP and make my own framework. When traffic is coming in like crazy, you want control over as much of the code execution as possible. If I wasn't concerned about traffic and just wanted to build something quick and dirty and get it out the door (and provided that the price of Visual Studio and the servers weren't an issue), I'd go with ASP.NET.

Rich
I though PHP was intepretted?
Christopher Edwards
+4  A: 

Catalyst is like all the other frameworks other people mentioned, but written in Perl. It lends itself to high levels of code reuse, and is very CPAN-centric. Also it's flexible enough to fold in legacy code without too without too much effort.

singingfish
A: 

I think tools, languages and IDEs are as good and useful that you can make of it. If you talk about cost you have paid and free tools and ides in both microsoft and non-microsoft world now, so there is no problem there.

In terms of hosting solutions *nix based solutions have been seen pretty cheap. But if you dont need the humungus storage or some of the features of the hosting but only reliability, I am pretty sure there are hosting providers who give assurance of 99% uptime.

So, look at your requirements, your resources and your skills. There is no point making an average ASP.net application if you have mad skills in PHP and can produce quality software in it.

Perpetualcoder
+5  A: 

ASP.Net will just paint you into a corner.

Unlike PHP, Python, Perl, Ruby, etc - ASP.Net is a product meant to make Microsoft money.

Perl was designed to solve everyday problems, and has continued to evolve in just that way - to solve everyday problems. That could be said for the other languages listed above as well.

The only problem ASP.Net was designed to solve was "How can Microsoft make more money?" No doubt it does have some nice points, and things like LINQ to SQL are really great, but all that is being surpassed by Perl6 (due anytime now - really).

If you don't mind having to completely change your development methods every time Microsoft's marketing department decides you should, then, well, go ASP.Net. On the other hand, if you would rather code to the beat of your own drum, choose open-source languages and platforms.

JDrago
I'm surprised the open vs. closed debate hasn't been more vigourous in the answers to this question.
RET
+1 for your note on MS Marketing Department
The King
+1  A: 

Someone mentioned O.O. support, and my first thought was it's a web app! Keep it structured. Class out things when it is best to do so, and don't over engineer. All three have some form of learning curve.

So anyways here's a list of the three languages from my "features" perspective.

All Three have:

  • IDE's you can use.
  • a wealth of libraries to utilize
  • great support. MSDN Documentation, PHP.net, Perl.org, IRC, Forums, and so on.
  • Religious Zealots

ASP.Net

  • has an IDE that you must use to get the most out of that language.
  • once learned, IDE knowledge will transfer to other V.S. languages.
  • cost money.
  • Requires a vendor lockin(unless using mono).
  • Is guarenteed to be around with Microsoft backing it.

Perl & PHP are

  • flexible and has some great frame works for web.
  • fast.
  • Well tested, with quick Updates.
  • Older, newer concepts have been added instead of being integrated from the beginning.

None Have:

  • The perfect language.
  • Every library function you will ever want.
J.J.
C# is the perfect language :)
Yassir
A: 

ASP.NET COST: If you are an university student, you can sign up for the Dreamspark program which gives you access to professional editions of Visual Studio which solves your cost problem until you have to release something publicly.

If you are in a small business making less than 1mil$ annually, your business can sign up for the BizSpark program for up to 3 years to get access to professional versions of Microsoft software, including server and database software for business use.

IDE: I assume that by now PHP has plenty of decent IDE. I like Visual Studio and I assume it will be equivalent.

Frameworks and libraries: ASP.NET has an advantage, but this is subjective.

The advantage is that not only does it has access to the full .NET framework, but on top the libraries are used in a consistent manner unlike PHP AND are strongly typed!

So you won't have foo(name, age) and bar(age, name) to the extent you may encounter this problem in PHP. And given that PHP is not strongly typed (I think), the above wouldn't throw you a compiler error if you used a name instead of the age.

There are probably other factors, so I just wrote a few that might interest you.

PRINCESS FLUFF
+2  A: 

I have used perl, php and the .Net framework 1.1,2 and 3.5. I love all the common arguments thrown out there by PHP/Linux fanatics.

Common arguments used by php/Linux nuts

1. Its OpenSource Yup certainly is .... but then there are loads of open source .net projects out there as well

2. There's a big community supporting it Again certainly is a community out there but again the bias towards php is showing because .Net has a great community and the big bad wolf MS also provides a huge amount of help and support.

2. Its Free Initially sure but just wait until you have to manage and maintain the monstrosity usually created with this language. You can certainly create crap code with .Net but with proper training it is much easier to stick to solid software development principles. We have all looked at short cuts from time to time which are just bad practise.... its like waving crack at an addict. The key thing is that if you are well trained it is much easier to create quality software with .net.

3. Its Faster There's nothing one can say to this kind of crazy talk ..... show me the proof dammit, compiled verses interpreted languages guess who will win out, it seems bloody obvious to me.

4. Its Easier Now here's the crux, yes it certainly is HUGELY simpler to pick up and use. Its great for those small little community websites which don't have a large budget and wont grow or change much. This is in my opinion the MAJOR reason that PHP has such a large following. If given some time I'm sure I could dig up my grandmother and show her how to mash something together using it. The amount of guys I talk too who take Joomla, tweak it a little to make these sorts of sites and then proclaim themselves professional website developers is infuriating. They somehow believe that moving from a hardware/networking background to PHP/MySQL and so think they know enough to trash the .Net framework or anything else outside of their experience gives me the @#$%. I wish they knew what the hell they were talking about because the amount of people I see taking their advice and getting the proverbial pole is annoying !!!

I started my professional career with Perl moved to PHP and then ASP out of these three puppies I would certainly choose to use PHP or Perl and never touch ASP.

I Moved to vb.Net (1.1 framework) after that and it was a case of yeah ok cool and went ahead to write some crappy code using the drag and drop functionality while trying to code .Net sites with a PHP style. This was a long time ago and since I have learnt learnt learnt on how .Net should be used properly as well as a continued improvement in the framework and languages themselves. Yeap I have put in the hard yards to understand .Net and now do consider myself a professional. It takes your typical tradie 4 years to learn his trade and a further 2 to feel comfortable to strike out alone, why should software development be any different ??? The fact it does take longer to master .Net to produce quality solutions is not a shortcoming. would you trust a builder who said "sure mate I learnt to build in 3 months and dam I'm good at it, I'll build ya a great house that your family will love !@! maybe a dog kennel (eg cheap small community website) but come on ..

I will NEVER go back to PHP, there is no comparison when it comes to an enterprise system. The value for money for your customer receives when the TOTAL COST OF OWNERSHIP is taken into account far outweighs the initial cheap price tag for a similar system in PHP. The only other combo I consider worth pursuing for enterprise systems is the Java/Oracle combo allot of my mates now use. They also have a background in PHP but also agree that PHP has its place but it should be nowhere near enterprise solutions.

Now fanatics feel free scream and shout I don't really care, a decade of experience sits behind my judgement using the teachnologies we are debating here and now so I don't care.

Caps abuse, punctuation overload, essay-length answer, referring to those who disagree as screaming nuts... God forbid we should get any fanatics in here.
Barry Fandango
A: 

I don't do PHP, but for web development, I would stay away from ASP.NET. The .NET is a strong-typed, rigid framework meant to be a business-logic language like Java. It doesn't go well with the dynamic-typed, flexible nature of web design. You will find yourself running through hoops to compensate for the fact that your data, and data-structures need to be able to handle anything you throw at them. ASP.NET tries to coax you into a "don't worry about it" with its datasets and gridviews, which tend to fall apart at inconvenient times, and are flexible as long as you don't try something clever, like changing a column.

And while at it, the front end side of ASP.NET is, at best, an bloody awful hack. .NET is supposed to be a "developer friendly" framework, which means it "abstractises" a lot of the less-friendly aspects of development. Web-development means you need to manipulate and present data using html, CSS and Javascript. ASP.NET hides that by creating mountains of crufty generated client code that is impossible to parse. HTTP is a state-less protocol, but ASP.NET acts like its not with its viewstates and session objects, this means you'll find yourself trying to guess a lot of times when do things actually occur, and override to abuse events like pre-render, data-bind etc.

Perl does this very well. Its data-structures are flexible and powerful, it has a very "Do What I Mean" approach to data types and adapts well as front-end, back-end and glue language than ASP.NET (VB or C#). It doesn't hide the ugly mess that is client-side scripting, but once you accept that, its much easier to wrap your head around, and it does mean you will use simpler, more stream-lined solutions rather than trying to have your cake eat it, and not get a sugar-overdose.

Erez
+1  A: 

I am somewhat concerned at the number of people saying avoid ASP.net because it is strongly typed!!!?! That is one of its advantages, any professional with a coding background should understand this.

If you know what SQL injection is then you'll know that you should always use parametrized stored procedures or queries in which the values going in are all strongly-typed. So if your values are going to have to be strongly typed at the db, it should provide no problem that the programming language is strongly typed too.

Anyone who finds strong-typing a hassle is almost certainly knocking up SQL queries by joining text together, and not going to the required steps to sanitize values (which is more hassle than dealing with strong-typing). Consequently, the sites they build are almost certainly wide open to SQL injection attacks. I've lost count of the number of sites I have seen where a quick hack of the ID parameter passed to a page reveals an untrapped error that would allow full access for me to run pretty much any DB query I please. This is true in PHP and classic ASP, but rarely in ASP.net largely because it is strongly typed (of course, ASP.net encourages use of parametrized queries that should avoid any risk anyway).

Spanky
A: 

I thought like many of the php supporters before I fully understood .net.

Most .net comments relate to pre 2.0 versions. .NET 4 is amazingly powerfull.

Using Microsoft WebsiteSpark program you get all software free.

Wayne