
Ask HN: Why would anyone go for ASP.NET ? - ideamonk
"ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services."<p>While other alternatives like PHP, PHP based frameworks (CI,Symfony,Zend), then Rails etc... really make the job easier when compared to asp.net.<p>While in PHP you would be writing 5 to the point lines to do something, in asp.net the same would need you to have things that are irrelevant to the goal, in the code...<p>have a look - 
&#60;%@ Page Language="C#" %&#62;<p>&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&#62;<p>&#60;script runat="server"&#62;<p><pre><code>    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToLongDateString();
    }
 </code></pre>
&#60;/script&#62;<p>&#60;html xmlns="http://www.w3.org/1999/xhtml"&#62;
&#60;head runat="server"&#62;
    &#60;title&#62;Sample page&#60;/title&#62;
&#60;/head&#62;
&#60;body&#62;
    &#60;form id="form1" runat="server"&#62;
    &#60;div&#62;
        The current time is: &#60;asp:Label runat="server" id="Label1" /&#62;
    &#60;/div&#62;
    &#60;/form&#62;<p>&#60;/body&#62;
&#60;/html&#62;<p>Now how much of PHP would the same code require ?!
So, Why would anyone go for asp.net?<p>I understand that number of lines doesn't matter after reading some great comments, but don't you thing it slows down quick learning in some way... because you've to go through big chunks of code that do simple tasks... while on this front, other languages make learning really easy and fun with short straightforward codes.
======
yan
Your comparison is overly simplistic and doesn't really prove anything. I'm a
unix guy, so my exposure to ASP.NET, while existed, was limited. ASP.NET tries
to make writing large apps be a manageable process, tries to use the existing
.NET library and plugs well with other Microsoft technologies. I can't really
argue on much deeper levels, but comparing how many lines of code some mundane
task takes isn't really saying anything.

I can create my own DSL whose sole purpose in life is to send dates to a
browser, and all it takes is a file with the character "x" in it; that doesn't
make my language any better than Rails, ASP.NET, php or anything else.
Different languages and platforms exist to solve different problems and cater
to different markets.

~~~
ideamonk
I feel enlightened and awakened... Thanks :), seriously.

------
icey
Microsoft has done a lot of things wrong in terms of its various software
offerings. Visual Studio is one of the things that they have done a pretty
good job on though.

Asp.net is also very attractive to the legions of .Net developers who may not
have much exposure to the web way. It mostly abstracts web interactions away,
so that it's not a huge leap to go from client/server applications to web
apps.

Sure, there is a lot of code in the final result, but the IDE helps automate a
lot of that, and in combination with ReSharper, it's not a bad environment to
work in.

~~~
ratsbane
When you abstract away the web as .Net does you also miss out on the
subtleties - e.g. "Postback" - the .Net function that stores server state in
an encoded string which it embeds in a form on the web page and restores
state. It makes the web seem friendly to ex-Windows programmers but ignores
the HTTP RFCs and ends up as big non-REST-ful mess. .Net is full of features
that make it easy for Windows programmers to avoid learning how to use the web
properly.

~~~
jcapote
".Net is full of features that make it easy for Windows programmers to avoid
learning how to use the web properly." Upvoted for quote.

~~~
dangrover
This is an important point to consider in frameworks.

Does $abstraction make things easier because you don't have to learn about
$technology, or does it make things easier because it eliminates the
repetitive parts of $technology?

Keep in mind, the former reason is entirely fine/admirable -- so long as the
abstraction is not unnecessarily leaky. Why learn something you don't have to?

I hav skepticism over Cappuccino because, as someone who does a lot of web
_and_ Obj-C/Cocoa development, I see a lot of my Mac dev friends attracted to
it not for its merits as a solution for making web apps, but because they
don't want to learn anything about web technology. Still, I have a lot higher
opinion of Cappucino than ASP.NET :)

------
akronim
> So, Why would anyone go for asp.net?

Because they have an existing investment in C# and/or the microsoft stack, and
a team of developers who know C#/visual studio. In that situation it's pretty
hard to sell PHP.

------
DanielBMarkham
I've spent some time digging through the .NET internals (through books and
code) and have/had a good familiarity with IIS and the HTTP pipeline Microsoft
has set up.

ASP.NET is an oddball. It's roots, as many have pointed out, were to make web
programming look like windows programming. That's the crappy part.

The good part is that there is a heckuva lot of power under the hood if you
take the time to learn the mechanics of things. I can move from a drag-n-drop
GUI programming of the web into all kinds of other things depending on my
whims. I can go XAML, or Silverlight. I can go straight functional with F# or
some of the other functional languages for .NET.

And it all runs inside the same IDE with IntelliSense and debugging and
machine-level inspection if I want it. And all the applications, no matter
what their language, can easily interoperate with each other. And if I stick
to ASP.NET 1.1, I can run on *nix boxes all day long.

The list goes on.

Please don't misunderstand me. I don't have the religion, so I'm not trying to
pump it up more than it is. It has real problems as an architecture because
the winform idea doesn't fit into web programming. Having said that, however,
a good programmer can crank out ASP.NET applications as fast as anybody else
in any other platform. For exploratory web application programming it's on par
with any other platform. The new team stuff looks pretty cool.

I find that most people who dis ASP.NET failed at learning it or are just
blowing off steam. To say the same thing a different way, by the time you've
wasted years figuring out where all the alligators are, you don't see what the
big deal is any more.

Biggest plus? I can almost go to Seven-Eleven and pick up good ASP.NET
programmers. The market has a lot of them (cheap). Biggest minus? Just because
a bunch of stuff is hidden doesn't mean it goes away! Great ASP.NET
programmers can crank out Javascript, CGI, and StoredProc code with the best
of them. By "helping", Microsoft makes it a real pain to get under the hood
and take total control (but it's very possible to do once you get the hang of
it)

BTW, your example? You drag a label onto the form, double-click on it and type
one line of code in. I'd argue that it only takes one line of code (and about
5 seconds) to accomplish. The rest is framework fluff.

~~~
ideamonk
Hey Daniel, I realized I was blowing off some steam, actually I'm just
beginning with ASP.NET over a surveillance project we're doing. Coming from
php background and watching Ruby people talk so much about, less code this
that, I was really taking to views that were based over just a look at code. I
really love that comments you wrote, and that sets me a new way to think over
things and be more positive, more importantly your comment encourages me to DO
things FIRST and then comment, rather than being an observatory commentor.
Thanks :)

~~~
ideamonk
and, yeah I just tried out Mono on my ubuntu, I loved the way the code
remained same on windows as well as *nix... It will be a great help in my
project :)

~~~
DanielBMarkham
Cool.

If you really want to torture yourself, pick up a couple of good ASP.NET
internals books and make yourself read them. After that, the other problems
turn out to be fairly easy.

Glad to help if you need any. Just drop me an email.

------
mindviews
> So, Why would anyone go for asp.net?

The .NET development environment.

Visual Studio is dead simple to install and use. Add-ins have been easy to
install, too. (I'm looking at you, Eclipse!) The .NET Framework has great
breadth and depth. It integrates well with MS SQL Server. There are plenty of
quality 3rd party tools/libraries that work with the stack. API documentation
is easy to get to. Building install packages is a snap. Visual designers can
make building/understanding components or the database schema easier. Code
generation from the designers can fill in boiler-plate stuff yet still leave
it visible if you need to dig around in there by hand.

As for ASP.NET WebForms (which is the sample you've given), it was meant to
make it easier for Windows Forms developers to do web page design. WebForms
imitates the WinForms structure and calling conventions, so you can make a
working web page act more like a desktop app in terms of the programming
model. Obviously, you run into limitations rather quickly because the WebForms
abstraction is very leaky.

ASP.NET MVC would be a good pick for new projects if you are already an
experienced web developer. You get all the benefits of the .NET stack without
the limitations of WebForms. You get control over the markup that gets
generated and it does a good job with separation of concerns. I recommend.

~~~
mikebo
I wouldn't say WebForms was meant to make it easier for Windows Forms
developers to build web apps.

I think it was intended to make it easy for Visual Basic developers (which is
a huge market btw) to develop web apps.

------
jpcx01
ASP.NET isn't the worst technology to use for a startup. There's lots of
useful prebuilt components for it (commercial usually, but the value is still
there).

Microsoft is also offering some pretty good hosting platforms for startups,
and usually you can pick up licenses for low cost. EC2 now is also offering
Windows instances for easy cloud hosting.

That said, I've done ASP.NET professionally for about 5 years, and 2 years ago
switched to Ruby / Rails / Merb and have found the transition to be a huge
improvement. The open source world has a better atmosphere, and I believe
better talent overall.

The worst thing about ASP.NET is the corporate culture, where unskilled VB
coders adopt it, and use it to build really badly developed websites.

Also, ASP.NET pretty much requires Windows. Trying to develop it on Mono, or
on a Mac (with Vmware) is an effort in futility. If you go ASP.NET, make sure
you're comfortable with Windows. This was one issue that I had a major problem
with. Command line scripting and build tools in Windows are generally aweful.
This will limit any good developer's productivity.

------
scorpioxy
Because sometimes you don't have a choice. Either by policy or by inheritance,
you might be stuck with that environment.

In my day job, i use ASP.Net MVC framework because we're an all Microsoft
shop. And although i recognize the danger of proprietary systems in the
medical field, I am unable to change anything at this time.

Also i find that Microsoft products work best with other Microsoft products so
SQL Server with Windows Server 2003 and ASP.Net along with Active Directory
and so on...

But, echo'ing the other comments, using a limited metric such as number of
lines to implement a feature is a bad idea. Try it out on some application and
then you'd be better equipped to dismiss or recommend it.

------
pragmatic
Because C# is a _very_ good language.

How many security holes have been found in the asp.net stack vs the php stack?
I recall seeing a php security issue on reddit or news.y about once a month
(anecdotal of course). But you don't have those problems with asp.net.

Yes php provides simplicity in the language but complexity in the
configuration. You have to be pretty handy with *nix to get it all working
right. Remember facebook showing all it's code to the world?

Asp.net windows configuration can be easier especially if you have a windows
background.

In the end though, if you know php use that. If you know python use that.

------
eatenbyagrue
\- Huge library of high quality components

\- One of the best available development environments (Visual Studio)

\- C# is much better for structuring your code base for large teams and long
lived projects

\- If you're really using a database, SQL Server is way, way better than
mysql.

I prefer Rails myself, but I manage a team who prefers .Net, and I can see the
advantages.

I agree with other posters, Webforms are horrible and wrong, but MVC could
make .Net one of the best Web dev platforms.

------
physcab
In my experience (and I'll preface this by saying that I'm not quite an expert
yet) ASP.NET is fairly easy to bring people with no web experience up to
speed. Our development company switched from LAMP to ASP.NET, C#, and MS SQL
Server. While I wasn't involved in the decision-making process, I did ask them
why they switched as I came from a LAMP background. They said that their
company gets all of their employees from their internship program, and it was
easier to train interns with all of the standardized tools that Microsoft puts
out. Plus there is a pretty good community of .Net developers that makes the
training process easy. It took me far longer to learn PHP than it did to learn
C#, but maybe that's because my coding experience is better now than it was
then. :)

------
amuzua
As far as I remember it took me considerable amount of time to get along with
C# alone, but after that playing around with ASP was much more easier. If
you're planning to start asp.net or other microsoft stuff like .net, make sure
your OOP fundas are thorough.

------
nopassrecover
ASP.NET annoys me so much with leaky abstractions BUT ASP.NET MVC is the best
thing since PHP.

~~~
Todd
Agreed. I'm a long time Perl user but I think C# (and Visual Studio) is well
done and keeps getting better. That said, the Web Forms model has always been
a bane for me. It violates so much that is web--from hijacking the HTML ID
attribute for its own purposes (thereby forcing all your client side script to
use hideous framework-generated IDs), to making non-standard form handling a
torturous experience. ASP.NET MVC looks like it could be the start of
something much, much better.

------
brk
I'm not a big ASP.NET fan, but the number of lines of code to do something is
less of a concern to me than the underlying hardware requirements and
licensing costs to produce a running application.

------
jonnycoder
I support many internal ASP.NET apps at Intel because our internal employee
services applications started as classic asp/com on oracle db over 13 years
ago. ASP.NET is really great if designed/written properly. Like others have
said, once you are a .NET shop it's easy to find .NET talent. I'm currently
working on our LMS which is Java/JBoss and I've learned to respect .NET, Java,
LAMP, Rails and Python. I have web.py and django on my todo list for building
some fun personal apps. Hope this helps give you perspective.

------
ideamonk
You know guys! Thanks a lot, I love HN for it helps me broaden my scope of
thinking :)

Its logical to build upon framework already tested and tried, so coming up
with something new would've been a waste of time n resources, whereas the
current .net scenario provides nice integration as i notice..

another point that comes to my mind is that -- Things couldn't be kept more
simpler than that, as you can't sell simplicity at high price.

