# Monday, April 23, 2012

Having been a part of many large enterprise ASP.NET MVC application implementations using test driven development I learned early on that separating your controller classes into a their own project significantly reduces the noise in your web project.  It wasn’t until a recent talk I gave to user group in my region that I realized that this isn’t a widely adopted practice.  For large applications with a lot of developers and a complex architecture I highly recommend it. 

Putting your controllers in a separate assembly is very straight forward.  First create a controllers project in your solution and then you just need to update your route registrations to tell them where to look for the controllers.

  1. routes.MapRoute(name: "Default", url: "{controller}/{action}/{id}",
  2.                 namespaces: new[] {"[Namespace of the Project that contains your controllers]"},
  3.                 defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional});

In order to tell ASP.NET MVC where to look for your controllers when registering your routes you use the ‘namespaces’ parameter of the MapRoute method as illustrated above.

I know that the concept of putting controllers in a separate assembly is a bit controversial and everyone seems to have a strong opinion either for or against, so let me know what side of the fence you fall on.

posted on Monday, April 23, 2012 8:02:14 AM (Central Daylight Time, UTC-05:00)  #    Comments [12]
# Monday, April 16, 2012

Back in 2009 I published ReSharper Live Template For Creating Unit Test Stub.  A lot of things have changed since 2009, including my templates.  Since I am doing another series of presentations on Test Driven Development I thought I should get these out because people always ask for them.

As stated in my original post these templates are a way for you to create unit test names that help in describing the true intentions of the test and also to provide a common unit test format that will make reading and comprehending your unit tests easier on everyone.  And of course as lazy developers any redundancies should be automated!

The first template is for a unit test that does not have specific input criteria.

Test w/out Input Criteria
  1. [TestMethod]
  2. public void $MethodUnderTest$_Should_$ExpectedResult$() {
  3.     //Arrange
  4.     $END$
  5.     //Act
  6.     //Assert
  7. }

The second template is for a unit test that has specific input criteria.

Test with Input Criteria
  1. [TestMethod]
  2. public void $MethodUnderTest$_Should_$ExpectedResult$_When_$Condition$() {
  3.     //Arrange
  4.     $END$
  5.     //Act
  6.     //Assert
  7. }

You can take the two templates and create new Live Templates and map to whatever key stroke combination you wish.  I use ‘tt’ and ‘tw’.

Note:  I have been using these Live Templates since ReSharper 3 and I am currently using them in the latest build of ReSharper 6 without any issues so you should be good to go.

As always if you feel these can be improved on or have other Live Templates you want to share let me know in the comments below.

posted on Monday, April 16, 2012 7:09:59 AM (Central Daylight Time, UTC-05:00)  #    Comments [1]
# Monday, April 09, 2012

The week of March 25th – 31st was one of highs and lows for me. 

The Good

Monday through Thursday I was in Las Vegas to speak at VSLive.  The conference was a blast.  Awesome speakers, interesting content, and fun events.  Not to mentioning the networking with my peers.  My talk on Thursday went very well and I received great reviews.  Oh yeah, and I was upgraded to First Class on both legs.  Life was good!

I left Las Vegas immediately after my talk and was back at work on Friday morning…uneventful day.

Saturday I got up bright and early and headed to Milwaukee for Deeper In .NET.  I have attended Deeper In .NET many times and it is always a great event.  This year was lucky enough to be chosen as one of five speakers for the day long event.  The event went very well until 20 minutes into the last presentation of the day…mine.

The Bad and The Ugly

I was doing my Reach The Mobile Masses With ASP.NET MVC 4 and jQuery Mobile, the same presentation I did 2 days earlier in Las Vegas and using the same machine.  The trouble started with VS11 Beta creating half of a solution when I went to create a new MVC 4 project with the mobile application template.  I was able to skip over that issue with out too much trouble.  Shortly there after the machine started acting wonky and I was starting to get that feeling in the pit of my stomach, you know the one, and it happened…BSOD!  NOOOOOOOOOOOOOOOO!

After the initial feeling of dread it was time to boot back up and quickly get back into it it…until I realized the machine was not powering back on.  And my heart sank!  Here I am in front of over 300 of my peers with a neon #FailWhale sign pointing directly at me.

In an attempt to salvage things I started taking questions of the audience and for about 10 minutes that was going well…until the microphone died.  Seriously!  it was just not meant to be.  The event organizers finally threw in the towel on me and declared it a KO, and swag time.

The Lessons

  • As that was my first huge fail in public speaking I learned that I handle myself fairly well under pressure (I think)
    • At first I had the urge to pack up after the BSOD, but then realized that these people came to learn and the least I could do is do my best to answer their questions.
  • People are nicer and more respectful than I give them credit for.
    • Multiple people asked if I wanted to use their machine once mine puked.
    • At least 10 people came up to me afterwards and offered their condolences.
    • Not one negative tweet came across the events Twitter hash tag.
    • No one threw tomatoes or empty bottles.
  • Always have presentation materials available on an external device of some sort in case of emergency machine swap.
  • Don’t trust beta software for coding heaving presentations.  (I was using VS11 beta and MVC4 Beta)
  • My deodorant works as advertised.
  • In the end all you can do is “Smile and wave boys.  Smile and wave.”
posted on Monday, April 09, 2012 7:52:40 AM (Central Daylight Time, UTC-05:00)  #    Comments [3]
# Monday, April 02, 2012

I am very honored and excited about leading up the efforts for the next Midwest Give Camp.  For this installment we have been lucky enough to team up with the folks at That Conference and are hoping to ride the hype and excitement of this awesome event for another successful and rewarding Give Camp.

The Give Camp will be held at the Kalahari Resort in Wisconsin Dells, WI Saturday August 11th through Sunday August 12th, the weekend leading into That Conference.

We are working with an awesome charity that will no doubt be very familiar and close to a lot of your hearts and once we have all the details ironed out I will be going public with them.

For now block off the dates on your calendar and stay tuned for more details! 

posted on Monday, April 02, 2012 8:06:18 AM (Central Daylight Time, UTC-05:00)  #    Comments [2]
# Monday, March 12, 2012

Last weekend I had the pleasure of being a part of the first Skyline Give Camp. If you are not familiar with the Give Camp concept you can found out more here. What it boils down to is a bunch of people, mostly developers but project managers and designers as well, get together for 2 to 3 days, typically Friday through Sunday, and do some sort of work for a charity. Typically this involves either creating a new website for the charity or enhancing the charity’s current website. I have been involved in Give Camps in the past and find them to be very rewarding. The Give Camps that I have been involved in in the past have been in the Chicago area and open to the public usually with only the die hardest of community geeks attending.

About a month back I was approached by my boss and two of my colleagues about helping with an internal Give Camp for a charity called Riverview Gardens. I thought this would be a great learning opportunity for everyone involved as well as an opportunity to give back to the local community so I got on board…but I was leery. By this time the people I was approached by had already been working with the charity and had mock ups of what they wanted. In my past Give Camp experiences the work had always been limited to a public facing website, but this charity already had a public facing site in the works. What Skyline would be providing for the charity was a full featured volunteer management system not only for the desktop web browser, but also for the mobile web as well as native iPhone and Android applications. Needless to say this was a huge undertaking.

The amount of work was not my only concern. Typically these events are held in major hubs, like Chicago, and they draw developers from all over the Midwest. For this Give Camp the pool was Skyline employees, currently about 100 people, so I was worried about the turn out. Would there be enough interest in the event to even get it off the ground? We put out a survey to all employees and I was amazed by the great response. Out of a pool of 100 people, where actually only 80 or so are developers/designers/project managers, we had 30 people signed up. That is outstanding, and truly a testament to the type of people I have the pleasure to work with at Skyline Technologies.

Another concern I had was that in order to make the event a learning experience and to get in some free training for the attendees we chose to go with ASP.NET MVC 4, Entity Framework Code First, jQuery and jQuery Mobile for the desktop web and mobile web applications and Web API for our RESTful service layer. These are all new technologies that the majority of the people signed up to participate had very little working experience with.

So we did some planning, broke everyone into teams and prepared for the big event.

The event went off without a hitch. The eagerness to learn and to teach by everyone involved was outstanding. I was amazed at not only the amount of work that was accomplished but by the quality of work. At the wrap of day 2 we estimated that in total we where ~85% complete with the work. Unfortunately since the sites and apps we created are not public you will have to just take my word for it

This event was truly a testament to the type of organization that Skyline Technologies is and to the people that make up the Skyline family. I look forward to being a part of it for a very long time and hopefully we can make the Skyline Give Camp a yearly event, or maybe every other year…I am not as young as I used to be.

Oh yeah…did I mention we are hiring!

posted on Monday, March 12, 2012 8:27:59 AM (Central Standard Time, UTC-06:00)  #    Comments [3]