First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

June 2011 Blog Posts

The history of ASP.NET MVC, so far

This post is a mile high overview of the history of ASP.NET MVC, the features it brought with the various versions and the extensibility points introduced.

I am starting to work on both a series of webcasts and articles and I was doing some preparatory work, collecting information on the various features and extensibility points that got into the various (official) releases of ASP.NET MVC, so I thought it could have been useful to share my little summary.

There have been 3 major official releases, and 1 small tool update.

ASP.NET MVC 1.0

The first official release, dated MIX 2009, brought all the core features of the framework, which made their way through the years till today:

  • Obviously, the MVC concept, with the streamlined processing pipeline and the separation of the processing of the request (in the Controller) and the rendering of the output (in the View)
  • The concept of routing (then made into the official framework)
  • Lightweight helpers for rendering HTML tags
  • Ajax helpers to easily ajaxify links and forms
  • Automatic binding of posted forms to .NET objects and a kind of model validation

This was a huge step toward a new web, but the first release needed a bit too much of infrastructural development in order to be productive in enterprise scenarios and in big applications. Luckily ASP.NET MVC was the first Microsoft product to really be extensible. Most of the core components could be extended or even totally replaced with your own implementation: for example, Dependency Injection was not supported, so you had to developed your own custom controller factory to create controllers based on a IoC container. Also there was no default model implementation in ASP.NET and people expecting something like RoR were a bit disappointed.

ASP.NET MVC v2

The following year, same timeframe (MIX 2010), the second version of the framework came out. The theme of this update was enhancing productivity and making maintenance easier in bigger applications:

  • Model validation based on attributes, both server and client side
  • Areas to partition bigger applications
  • Html Templated helpers, to automatically render edit forms and display pages based on the model and attributes applied on it
  • Asynchronous Controllers
  • Lambda based Html Helpers to remove most of the "magic strings" previously needed in html helpers

In this version a few other extensibility were introduced in addition to the ones already available in ASP.NET MVC 1.0:

  • Model Metadata Provider and ModelValidationProvider
  • Validation Attributes and validation logic
  • Custom templates

The inclusion of the model validation and display attributes was also a first step toward some kind of support for a default model inside ASP.NET MVC.

ASP.NET MVC 3

At the beginning of the year, less than a year after the previous version, version 3 was released, together with a bunch of other pretty interesting tools, like NuGet, IIS Express and SQL Server Express.

The new features introduced with this latest version:

  • Works only on .NET4
  • Unobtrusive javascript validation and general better javascript love
  • Remote validation
  • Dependency Resolver
  • The new Razor view engine
  • Global Filters

In the context of extensibility, a few more were introduced:

  • Service Locator
  • Dependency Resolver
  • Filter Provider
  • IValidatableObject

Additionally, a new "New Project" dialog that allows you to choose different project templates as base for your ASP.NET MVC 3 application was introduced. It includes the usual template (with user management and login pages) but is open for including other project templates very easily.

ASP.NET MVC Tool Update

Finally, as tradition, they released something also at MIX 2011: no changes to the library itself, but just an upgrade to the tooling around MVC:

  • They integrated the great MvcScaffolding into Visual Studio, to easily create controllers and CRUD views based on the model
  • Libraries included by default (jQuery, jQuery UI and modernizer for example) are included as NuGet packages so that they can be easily upgraded
  • Entity Framework CodeFirst is included as default data access library in the default project template
  • The default template is HTML5 enabled (if a checkbox is selected, views will have the semantic HTML5 tags)

With this last update ASP.NET MVC finally had a default implementation of the M part of the pattern: Entity Framework CodeFirst with automatic creation of the DB schema, attributes for data validation and editing, and scaffolding for the automatic generation of CRUD actions and views.

How mature is ASP.NET MVC?

The first bits of ASP.NET MVC were introduced in October 2007, at the first ALT.NET Conference by Scott Guthrie, and it then took almost 2 year to reach the stability need for the first release. In total we can say that ASP.NET MVC is being used by the general public since almost 4 years: that’s a pretty long time.

I hope you found this little excursus useful and if you think I missed anything important, please don’t hesitate to add a comment.

Tags:

When Subtext DB gets out of control (and how to fix it)

During the last weeks I noticed that my blog was becoming slower and slower (and if you visited my blog you might have noticed it as well).

After a bit of troubleshooting on the server (which was kind of painful due to the slow connection via RDC from Europe to my server in the US) I figured out that most of the slowness came from my SQL Server Express instance that was taking up too much memory.

And I found out that I had 3 tables that were extremely big in size:

  • Subtext_Log - logs all errors happening on the server
  • Subtext_URLs - all the referrals' urls
  • Subtext_Referrals - a 1:1 mapping table that counts how many visits per referral

The first was about 20k row in size, and the other two, same size, over 670k rows. It is not a big number by itself, but if you contextualize it on the (virtual) hardware it runs on (a tiny VM instance of half-core and 614Mb of RAM that hosts both IIS and SQL Server) it was a huge number. The overall size of the database was around 350MB.

The size of these tables are pretty easy to explain: each new visit from coming from a link or from a search engine creates a new record (and subsequent just increase the count) and I never cleaned the tables since I launched my blog which received more or less 1150k page views of that kind.

Googling around I also found I'm not the only one with those problems:

I tried to use the page Travis wrote, but with a the very slow site his page always timed out. I also tried Phil’s approach, cleaning the tables from the search referrals, but, not sure why, the delete statement failed after one hour of execution. So I fell back to the more brutal but quicker and safer "truncate table" approach. And after cleaning all tables I rebuilt the indexes and shrunk the database. From the original 350MB it went down to 30MB, which are much more easy to handle for my tiny VM instance.

I lost the stats about the urls that brought in the most visitors, but I guess I could retrieve the same information with a bit of practice on Google Analytics.

UPDATE: At least on SQL Server Express, after you do the shrinking you have to restart the SQL Server instance otherwise the server will stay as slow as before.

This feature, the referrals’ logging, was introduced in 2003 in the original .Text, when there was not free stats analyzer. But now there is Google Analytics and many other similar services, so I think it's time for a redesign.

A possible solution for this problem might be adding some configuration options to fine tune the behavior of the referrals logging:

  • don't track referrals at all
  • track only referrals that don't come from search engines (based on regex)
  • track referrals only for the latest posts
  • automatically purge referrals older than 1 month
  • track everything

And also introduce some kind of auto-purge of Log entries after a period of time or when the size reaches a specified number of rows.

If you have Subtext, please comment and let me know what you think about this possible solution to this problem.

Final suggestion: if you have a Subtext-powered blog, periodically check the size of these 3 tables and clean them if they grow too much.

Now Visual Studio 2010 supports new web standards

vshtml5_thumb Today the Web Platform and Tools team (I can see the influence of Mads in this) announced the release of the Web Standards Update for Microsoft Visual Studio 2010 SP1.

What sits behind this cryptic name? Shouldn’t Visual Studio already support web standards? Actually, not the latest ones.

In January Microsoft released the support for HTML5 in the context of intellisense and validation in VS2010 SP1, but all the other related standards, CSS3 and all the new JavaScript standards were left out of the update.

With this package you will have CSS3 schema support, intellisense for the new “HTML5” API such as geolocation and storage. And enhanced HTML5 support as well (Microdata, WAI-ARIA and fixed support for video tags).

For a more in-depth overview of the release here are some links I recommend you to read:

One nice thing about that packages is that it will be updated about every 3 months to keep it in line with the changes in the standards made by the W3C.

Now, together with the great HTML5 template in ASP.NET MVC, you have no more excuses for not building your sites in HTML5.

TechDays Belgium: videos are online

At the end of April, Microsoft Belgium organized the TechDays Belgium, the annual developer and IT conference in Belgium, to which I had the pleasure to attend. I also manned the Ask The Expert booth and helped attendees with their questions about ASP.NET MVC, Orchard and web development.

It was 3 days of very interesting sessions, ranging from the keynote/standup comedy show by Scott Hanselman to the ASP.NET MVC Deep Dive sessions by Hadi Hariri and to the Girls-Power WP7 development session by Katrien DeGraeve and Isabel Gomez Miragaya. And the last day was a deep-dive on everything ALM: a bit of the usual TFS marketing but also a very good session about how to implement Kanban with TFS.

If you didn't attend the conference, or if you attended but missed, like I did, some sessions because they were at the same time of other you attended, you can watch them online both on the official TechDays Belgium 2011 site, where you can find both dev and IT pro videos, or on Channel 9, where you can directly go to the videos and download also other formats and the slides.

Here are my personal favorites:

Tags: , ,

Track the sales/downloads of your Windows Phone 7 applications with Mopapp

In this post I’m going to introduce a Mopapp, a mobile app sales analytics site I am using to track the downloads of my FeedTso WP7 app. It is a startup by an Italian developer, and it is competing as BizSpark European Summit Start-up for the year. If you think it is a cool idea, I’d really appreciate if you could vote for it.

The problem it solves

If you have developed a Windows Phone 7 application and put it online in the MarketPlace you might have found that the reporting capabilities of MarketPlace backoffice are not that great: you only have 2 graphs with the cumulative and the day to day downloads, and a table with the split per country. And to see how many applications you sold you have to go to another web application, the billing application or if they have not been billed yet, you have to do the math yourself. Same thing with reviews: you have to go to the public marketplace and see what users said about your app.
It might be that with Mango the new MarketPlace will be better, but we don’t know for sure, and even if it was we have to wait till this fall.

This is not a problem of the WP7 MarketPlace alone: also the Android, the BlackBerry and all the other mobile apps stores have the same problems.

Mopapp features

To overcome these problems, Marco Bellinaso (from TheBeerHouse fame and Wrox author ) developed an web-based service that connects daily to your accounts, downloads the raw data and display them in a nice graph, with possibility to filter by date, country, group by month. Here is an example of some of the charts:

 mopapp-downloads mopapp-downloads-countries

Just as reference, here is the same chart from the MarketPlace. Notice some difference?

marketplace-downloads

The super-cool thing is that, if you are selling your application on different platforms, you can configure Mopapp to retrieve data from all the stores and make comparisons between the different platforms. Same thing if you are selling more than one application: you can chart downloads and sales on the same chart and make comparisons to see what is selling better.

mopapp-eventOne feature I find very interesting is the possibility to add “Events”: for example a review appears on a popular site, or you release a new version, or your start a marketing campaign. Thanks to that you can verify if such event triggered more sales than usual, and verify the validity of your campaign.

The image on the left shows two events, the first one that didn’t cause any improvement in the sales of FeedTso, the second one, the release of a new version, that did.

It also integrates with ad networks: this way you can verify if an ad-supported application is getting you more money than an application you sell. And all done in the same screen, without logging in to different sites.

There are also many other features, like tracking in-app sales for iPhones, showing reviews. For these I suggest you take a look at the Mopapp features tour that is on their site.

Shameless plug

To wrap up, they are still in beta, and you can signup for free with the professional plan. And in the meanwhile, if you could vote for them at the BizSpark European Summit Start-up, this will be great.