What’s Your Flava

When developing sites with Umbraco there are different approaches.

  1. Quick (and dirty)
  2. Neat (and Tidy)

In the first scenario will be a good choice when you have to setup a simple site, when there’s no need for custom-logic and almost no additional data to maintain. When you have more data or businesslogic you will need a layered solution.

In the quick solution you can add the logic in the view and store data in Umbraco-content.

The conjunture of website coding – In the early days there was HTML. A Classic ASP – page was an HTML-page, with the option to add serverside scripts blocks – but it often poluted the HTML (design). ASP.Net made it possible to separate logic from design – but it lacked the support of good interactive clientside functionality. Razor/MVC brings back that support and added the possibility to use (some simple) backend scripting to the HTML, like a loop or a simple descision.

In the view-templates of Umbraco you can access all Umbraco content. The Umbraco-CMS also provides an editor for the template, so you can start with Umbraco out-of-the-box and setup the entire site.
The use of storing data in Umbraco-content can be safe when there is no template is connected to view the data directly. You can access the data with Umbraco-Querying, dynamic content, UmbracoTemplatePage<TModel> or UmbracoContext.

The second approach does not exclude the quick solution, but offers the possibility of clean coding:

  • Custom Viewmodels for complex data – so less code is needed between the HTML in the RazorView to collect or process raw data.
  • You have a controller that only controls: it prepares requests to the businesslayer and converts its response to a viewmodel, a datapackage that contains almost everything needed in the HTML.
  • The businesslayer that doesn’t know anything about Umbraco, so -in theory- it can be connected to another environment like Sitecore.
  • A better separation of concerns, by the use of interfaces, design patterns and Depency Injection

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s