Bracket styles: Allman vs. K&R

February 28, 2012 at 3:37 PMMadestro

I have been coding for a number of years now and most of the code I have come across (I would say 98%, no exaggeration) is in Allman's format.

For those of you who are not familiar with these bracket styles (or maybe you are but don't associate the name with the style), Allman's format is about putting the brackets each in its own line:

if (a == b)
{
     return true;
}
else
{
     return false;
}

While K&R is about putting the bracket at the end of the control statement:

if( a == b) {
     return true;
} else {
     return false;
}

I personally like Allman's. In my opinion it's totally easier to read. This of course is my personal preference. Either method [obviously] works and produces the same result, but I do find having to read K&R style annoying. So annoying in fact that I decided to write this post... :-)

Thoughts?

Posted in: General Development

Tags:

ASP.NET MVC lifecycle

February 23, 2012 at 4:47 PMMadestro

I was working on something and needed to refer to the ASP.NET MVC lifecycle so I went out there and found the following information which I have compiled for your benefit:

Overview of the Lifecycle Steps

There are five main steps that happen when you make a request from an ASP.NET MVC website:

1. The RouteTable is Created

This first step happens only once when an ASP.NET application first starts. The RouteTable maps URLs to handlers.

2. The UrlRoutingModule Intercepts the Request

This second step happens whenever you make a request. The UrlRoutingModule intercepts every request and creates and executes the right handler.

3. The MvcHandler Executes

The MvcHandler creates a controller, passes the controller a ControllerContext, and executes the controller.

4. The Controller Executes

The controller determines which controller method to execute, builds a list of parameters, and executes the method.

5. The RenderView Method is Called

Typically, a controller method calls RenderView() to render content back to the browser. The Controller.RenderView() method delegates its work to a particular ViewEngine

Source: http://stackoverflow.com/questions/2355139/what-is-the-lifetime-of-a-asp-net-mvc-controller

I also found a chart by Steve Sanderson you can print and keep around your desk:

http://blog.stevensanderson.com/2009/10/08/aspnet-mvc-learning-resource-request-handling-pipeline-poster/

Posted in: ASP.NET MVC

Tags: