Why I choose the Microsoft stack for my new startup
One thing is for sure - Microsoft gets a bad rep these days. Maybe its because of Windows Vista. Maybe its because of classic ASP, or even ASP.NET’s WebForms. Maybe it is because they are a large company who’s focus has too long been on the enterprise, and not enough on the consumer. Most likely, though, it is because its simply cool to make fun of Microsoft.
I had plenty of options when I decided to start building a new web application. My favorite language is C#. I’m not talking about web app frameworks, or frameworks in general – no, just the language. I love that C# does not do very much magic, like Ruby does. I love that C# has a cleaner and more expressive syntax than Java does. I won’t even compare the language syntax and API to that of PHP. Of course, there were other options too, such as Python and Scala.
Java
I’ve been working for the past 3 years with Java and Spring 2.x. Older versions of Spring are god-awful, what with their dependence on a metric ton of XML configuration files. Spring 2.5 began to add support for annotations (attributes in C#) and Spring 3 continued to improve even further in this area. Java has a fairly good amount of cool technologies, frameworks, and specifications too. For me, though, the ecosystem feels very broken. Having many options is good. Having too many options is bad.
Ruby and RoR
I began toying around with Ruby and, consequently, Ruby on Rails too. It is a nice and powerful language and framework but at the end of the day it didn’t feel right. I like type safety and compile-time checks. I like knowing what my code does – in fact, I like telling my code what to do! Ruby loves to do magic for you. Rails builds on top of this magic to provide even more magic. Honestly, it is pretty impressive but for me, it just didn’t feel right. I’ve spoken to fellow developers who feel the same way: It is very cool, but doesn’t feel natural.
With that said, I have already written a couple of supporting services in Ruby for my new app.. because Ruby was the better choice for those services. They are exposed as web services running on Sinatra.
PHP
I’ve used several PHP frameworks, including CakePHP, CodeIgniter, Kohana, Lithium and Yii. My favorites are the last two, Lithium and Yii. They both do a great job of making it easy to build web applications and both are extensible. However, I despise PHP as a language. It is arguably one of the ugliest languages ever “designed.” (It really never was designed, it just grew organically which is why function names, parameter order, etc is so different from function to function) If I choose PHP, I know I would not be able to sleep at night.
As for the others, I just didn’t have enough experience with them to make a fair (to me) comparison. Nor did I have several months to learn them to a point that would make a fair comparison.
Home, sweet, home
This all brings me back to my personal favorite language, C#. It has a very clean and expressive API (look at LINQ). The ecosystem is smaller than that of Java, but it is tighter because one company runs the show – Microsoft. With Microsoft’s latest MVC framework release, ASP.NET MVC3, writing a web application has become so simple its scary.
The ill-named ASP.NET MVC framework learned quite a bit from Rails and the open source community in general. Microsoft studied what people want to do with their frameworks and what they don’t – and it shows. ASP.NET MVC is a fantastic framework and they’ve built in extensibility at every level. Don’t like something? Write your own and plug it in. It really is that easy. Seriously.
With version 3 comes the Razor view engine which I think is absolutely beautiful. I’ve used several view engines in different languages but Razor stands out to me as a new approach (which is sometimes scary to some people) where you don’t need weird braces, brackets, or custom HTML tags to render content or run code in your views. I think its just very streamlined and easy to look at and read.
It scales – they all do!
Scalability isn't a feature of any language or framework. Nowhere is there a bullet that lists scalability as an important feature. Instead, scalability is something the application designers must think about while they built there app, no matter which language its built in.
ASP.NET scales very well. So do Java, Ruby, PHP and all the others – when done right. Scalability is about engineers, not language.
The Community
People often complain that Microsoft is a large corporation who doesn’t care about the community. Those same people often ignore the fact that Microsoft has open sourced much of the .NET framework, including ASP.NET MVC. They ignore that most (though, not all) .NET programs will run happily on any operating system, including Linux, OSX, and iOS. This is made possible through the open source Mono project, sponsored by Microsoft and Novell.
Microsoft and the community also collaborated on a cool new package manager called Nuget. It is similar in nature to Ruby’s Gems and Java’s Maven, though it is not a copy of either of them. What is amazing is that immediately upon its release, cool open source (and some commercial) libraries began showing up in the Nuget listing. So many libraries that I, and presumably many other people, had never heard of were suddenly at our fingertips, ready to be installed as easily as a Ruby gem.
Since releasing Nuget, the amount of packages has been steadily growing and the amount of package downloads has been growing even faster.
In addition to this, there is a healthy community of people willing to help you solve any issues you have. You can head over the the ASP.NET Forums or StackOverflow if you need help with anything and your question will be answered usually in minutes.
The Microsoft stack, minus Microsoft
For my newest web application, I’ve made the decision to go with MongoDB for my database. It is a super fast, document-oriented database as opposed to standard relational databases such as MySql, Postgres, and Microsoft’s own SQLServer. I made this decision because it best fits the type of data I will be storing and I’ve been working with MongoDB since its alpha stage so I know what it is capable of.
MongoDB runs on Windows but runs better on Linux, and that is where I plan to run it.
If C# code and ASP.NET MVC applications can also run on Linux, then you have no need to run on Windows. You have removed Microsoft from the Microsoft stack. Where is your vendor lock in now?
I will most likely run my application on Windows Server 2008 but the point is that I don’t have to if I don’t want to. Even with the Microsoft stack, I still have my options.
Bonus: WebSite Spark and BizSpark
WebSite Spark and BizSpark are two initiatives by Microsoft to bring down the initial cost of getting up and running with the Microsoft platform so that you can get all the tools and resources you need to do it right.
Conclusion
With Microsoft's new commitment to building better tools for the web and working with the community, I feel that my decision to go with the Microsoft stack is the right one, for me. You may not agree – and that is fine – but don’t knock it before you try it. Version 3 of ASP.NET MVC brings some really great stuff to the table. Nuget makes finding packages just as easy as it has been for Ruby developers for years. Portability of the code means not needing to worry about vendor lock-in.
So far, I am more than happy with my decision.
Gotcha: 32-bit applications may not be able to see files on 64-bit Windows
This one really threw me off tonight. I am running Windows Server 2008 on one of my boxes and I was trying to set up some advanced URL Routing on IIS7. IIS7 Manager has a very nice easy to use GUI interface, but I prefer working directly in the configuration files.
I fire up my Notepad++ and attempt to open a file through the file browser. I navigate to the IIS config folder (c:\windows\system32\inetsrv\config\) and I see an empty directory. Huh? How is that possible?!
Now I switch over to Windows Explorer and go to the same folder as above and to my disbelief… there are all the config files. Ok now I am truly confused!
Conclusion
While I cannot seem to find anything from Microsoft about this issue, my findings are that 32-bit applications cannot see the entire file system! I installed a few applications that I know are only 32-bit to verify this and sure enough they all suffered from the exact same issue.
Files simply do not show up and if you attempt to open the file (because you do know the full path & filename), it simply tells you that the file does not exist.