Tuesday, December 30, 2008

Creating a blog web application - part 1

Hi,

Today I'm starting a series of posts that will describe the process of creating a blog web application.

First of all we'll have to gather some high-level requirements and define the technologies that we'll use to write this web application.

Let's start with the requirements. As you'll see they are pretty simple as the application we're going to write is not a very fancy thing.

Blog Web Application Requirements.
  1. Everyone must be able to view the list of posts along with comments.

  2. Owner of this blog will have the possibility to add new posts.

  3. Everyone must be able to post comments to posts added by blog owner.

  4. Retrieve the list of blog entries as RSS feed.

  5. Add posts using a WebService interface.

That's it. Pretty simple, right? Now since this is going to be a full-blown application we're going to need to make some decisions about the technology used to persist the data, manipulate them and finally to visualize them in a web browser.

For the purpose of this tutorial I've selected the following parts:
  • Visual Web Developer 2008 SP1 Express Edition IDE - free, powerful, ergonomic, awesome tool

  • For the main framework we're going to use I've selected ASP.NET MVC framework because of its vast control over every single part of the application. It gives a clean separation of concerns and enables testability as well so it's a really nice thing.

  • As a presentation engine we're going to use the standard ASPX engine as it comes for free with the ASP.NET MVC.

  • We'll follow the View-Controller-Service-DAO-Database execution scheme. That way every single component of the application will have its clean task to perform and testing it will be a breeze.

  • For database access we'll use NHibernate because of its independence of the actual RDBMS. I realize that most of you will use Microsoft SQL Server and thus the LINQ-to-SQL framework but this one option is already well covered in a number of tutorials and I wanted to do something else.

  • For the actual RDBMS we'll use Firebird. The reason behind this choice is quite simple: first Firebird has an option to run as an embedded database as well as a full-blown database engine. Secondly I've used Firebird for a number of projects already and I'm very pleased with the performance of this database. And third, it's licensing model allows one to use it in any kind of application (commercial and open source)

  • Obviously we're going to need some IoC engine. As you'll see we'll have the luxury of selecting any IoC framework we want, ranging from Spring.NET, Castle, StructureMap, NInject, Autofac to Microsoft's Unity Application Block. I personally prefer Unity for its attribute-driven control over injected dependencies but Spring.NET is going to be an option we'll discuss as well.

  • And last but definitely not least we're going to follow the Test-Driven Development style. For that we'll use NUnit as it contains all of the features we're going to need ranging from a command-line xslt-driven output runner to simple mock framework. It has been around for a long time now and despite of some shortcomings and differences with other unit-testing frameworks (like JUnit or DUnit to name a few) it is still my favorite one.

Let me make a note on that last point: I'm definitely not an expert on TDD. You might find that throughout the project I'm not exactly following some practices or you might know some better option to perform some steps. Finally you might skip the testing part all along if you want to - whatever makes you happy.

That's it for now. In the next part we'll start off with creating the necessary projects and writing some code that will make up our controllers.

Stay tuned!

3 comments:

Unknown said...

Please tell me, and you can use the "For database access we'll use NHibernate because of its independence of the actual RDBMS." for outsourcing software development? and how Nhibernate currently working on a web application.

Matthias Hryniszak said...

I've since moved to Java entirely... I could give you a hint or two on that platform or put you in contact with someone who does .NET development on a daily basis.

Unknown said...

Thank you for your interesting and worth-sharing post. As a member of custom software development company I can say that it can be really hard to find useful info in the net. But your blog is structured in a perfect way!