OdeToCode IC Logo

You Want To Build Web Software with C#?

Tuesday, February 12, 2013

If you like choices, you've come at the right time. You might think the decision making process starts by choosing between ASP.NET Web Forms and ASP.NET MVC, but if you widen your perspective a bit you'll find there are even more options outside the confines of the File –> New Project dialog in Visual Studio. And, these choices have steadily increased and matured over the last few years.

Here are just a few of the other options for writing a web app today:

- Nancy (lightweight and low ceremony)

- FubuMVC (convention-based and highly compositional)

- OpenRasta (a resource oriented framework for web sites and APIs)

- Service Stack (a web services framework)

- Oak (highly dynamic, frictionless)

Even when you restrict yourself to frameworks from Microsoft, there are still a bewildering number of decisions to make. Web Pages, Web Forms, Web API, or MVC?

Making A Decision

Ultimately your job is to ship working software, and be happy about shipping the software. It's hard to build an application when you loathe working with the underlying technology. If you are brand new to all of this, I believe one of the first steps is to sit down by yourself and with your team, and figure out what you like and dislike about the available frameworks. If you are brand new to all of them, it would be worthwhile to spend a couple hours with each. Read about their design goals. Read the code examples as they will demonstrate the code you'll be living with.

Some of the questions to ask at this period include:

- What are my business requirements? Do I need to optimize for both mobile and desktop? Do I need to be highly scalable? What sort of authentication mechanisms do I need for my customers? Am I building a site, a service, or a combination of both?

- Do the abstractions make sense to me? Do the abstractions relate well with my mental modal of how things work on the web?

- What do I value the most? Testability? Flexibility? Simplicity? Past experience with an existing framework?

- What are my technology requirements? Am I tied to IIS and Windows or do I want the ability to run on Mono? Do I need to build an application that makes heavy use of JavaScript in the browser?

You have to answer these types of questions and narrow down the field based on how you perceive the capabilities of each framework. You can build almost anything with any of the above.

Eventually I'd recommend narrowing selections down to 2 or maybe 3 frameworks, then writing some code with each to get a good feeling for a what life with the framework is like.

Recommendations

When people ask me what to use, I tell them the choice of framework (and language) is a very personal choice. You have to evaluate questions like the questions listed above to figure out for yourself what framework will be the best for you, your team, and your business.

There are only a few hard and fast rules I can proclaim on this day in the month of February in the year 2013.

When starting a new application today:

- Do not use Silverlight

- Do not use LINQ to SQL

- Do not use WCF, unless you have no other option (e.g, to build a SOAP API).

- Do not use the Web Forms view engine for anything but a Web Forms application

- Don't forget:  in larger applications the web layer is just a façade. Other architectural decisions should probably have a higher priority.