Training

Nothin But .Net Developer Bootcamp

Navigation

Search

Categories

On this page

Solution Reorganizing (Again!!)
Slightly Different Way To Assert That Exceptions Are Thrown
Just For Clarification re The Latest DotNetRocks Episode
Amazon Giveaway Over - 3 days later!!
Do You Want $70 To Spend On Amazon?
Nothin But .Net - Vancouver, BC (June 23rd - 27th) @ Coast Plaza Hotel And Suites
Are You Interested In Setting Up Your Own Training Company?
What Do I Get From It?
Got Icons?
Got A Spotter?

Archive

Blogroll

 Agile Developer Venkat's Blog
 Ayende @ Blog
 B#
 Barry Gervin's Software Architecture Perspectives
 Boy Meets World
 Brad Abrams
 Canadian Developers
 Christopher Steen
 Claritude Software News
 Clemens Vasters: Enterprise Development and Alien Abductions
 Coding Horror
 Coding in an Igloo
 Dare Obasanjo aka Carnage4Life
 Darrell Norton's Blog [MVP]
 David Hayden [MVP C#]
 Don Box's Spoutlet
 Eric Gunnerson's C# Compendium
 EZWeb guy: Jeffrey Palermo [C# MVP]
 Fear and Loathing
 Generalities & Details: Adventures in the High-tech Underbelly
 Greg Young [MVP]
 Greg's Cool [Insert Clever Name] of the Day
 IanG on Tap
 Ingo Rammer's Weblog
 ISerializable - Roy Osherove's Blog
 James Kovacs' Weblog
 Jason Haley
 Jean-Luc David
 Jeremy D. Miller -- The Shade Tree Developer
 JetBrains .NET Tools Blog
 Jimmy Nilsson's weblog
 John Bristowe's Weblog
 John Papa [MVP C#]
 Jon Skeet's Coding Blog
 JonGalloway.ToString()
 Jump the Fence or Walk Around
 Lambda the Ultimate - Programming Languages Weblog
 Larkware News
 Lutz Roeder
 Marquee de Sells: Chris's insight outlet
 Martin Fowler's Bliki
 Mike Nichols - SonOfNun Technology
 MSDN Magazine - .NET Matters
 MSDN Magazine - All Articles
 OdeToCode Blogs
 Onion Blog
 Planet TW
 Raymond Lewallen [MVP]
 Rockford Lhotka
 RodMan's Corner
 Roger Johansson's blog
 Sahil Malik - blah.winsmarts.com
 Sam Gentile's Blog
 Scott Bellware [MVP]
 Scott Hanselman's Computer Zen
 ScottGu's Blog
 secretGeek
 Service Station, by Aaron Skonnard
 Signum sine tinnitu--by Guy Kawasaki
 Stephen Toub
 Steve Eichert's Blog
 Steven Rockarts
 The Blog Ride
 The Coding Hillbilly
 The Daily WTF
 TheServerSide.net: News
 Tim Gifford
 Vance Morrison's Weblog
 you've been HAACKED

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 337
This Year: 62
This Month: 13
This Week: 3
Comments: 889

 Monday, May 12, 2008
Monday, May 12, 2008 3:20:09 PM (Mountain Standard Time, UTC-07:00) ( Programming )

I just completed a reorganizing of the solution that I am currently working on. I now have only 2 projects in the solution. I use to have 3 project:

  • {ApplicationName} - This contained the project for the application itself, all of the logical layers lived in this project.
  • {ApplicationName}.Test - The unit tests for the Application (integration and unit)
  • {ApplicationName.Build - All of the artifacts related to managing the build process

After the reorg that just took place over the last 1 hour it is now:

  • {ApplicationName} - Same as before, except now each spec/specs live beside the code it is testing.
  • {ApplicationName}.Build - Same as before

Thanks to the power of ReSharper and an existing NAnt build file that I was already using to manage the project build/compilation/test ... It took me 40 minutes to do the file shuffling. ReSharper helped out with the namespace changes. 3 lines of xml added to the build script (no other changes required) and I am back in business!!

I love ReSharper!! And yes, I am running the latest nightly build (797) and it has been running amazingly. I currently have Solution Wide Error Analysis turned off, as it seems to slow things down a little.

Comments [7] | | # 
 Sunday, May 11, 2008
Sunday, May 11, 2008 4:18:21 AM (Mountain Standard Time, UTC-07:00) ( C# )

For the longest time (the last 4 months!!) I have been using the following style of code to determine whether exceptions are thrown in my codebases:

typeof (InterfaceResolutionException).ShouldBeThrownBy(() => DependencyRegistry.GetMeAn<IDbConnection>());

As you can see, all that I am doing here is leveraging an extension method that hangs of the type class:

public static void ShouldBeThrownBy(this Type exceptionType,Action workToDo) { GetExceptionFromPerforming(workToDo).ShouldBeAnInstanceOf(exceptionType); }

This extension method lives in a library of extension methods that I use when doing Behavior Driven Development and trying to leverage natural language as close as possible vs the traditional Assert this/that.

I just switched it up a bit to change it to make it completely foolproof, as with the original extension method you could have easily done this:

typeof (SqlConnection).ShouldBeThrownBy(() => DependencyRegistry.GetMeAn<IDbConnection>());

This code would compile and run, but SqlConnection is not an exception type. What I want to be able to do, to address this issue is flip things around like this: 

(() => DependencyRegistry.GetMeAn<IDbConnection>()).ShouldThrowA<InterfaceResolutionException>();

Notice how I am trying to use 2 different concepts here:

  • Extension methods having off of a lambda expression
  • Generics to ensure that the type provided to the ShouldThrowA method is an derivative of Exception

The only real problem with this is that you can't have an extension method that hangs off a lambda. What I can do is the following to get started:

public static void ShouldThrowA<ExceptionType>(this Action workToDo) where ExceptionType : Exception { GetExceptionFromPerforming(workToDo).ShouldBeAnInstanceOf<ExceptionType>(); } public static Exception GetExceptionFromPerforming(Action work) { try { work(); } catch(Exception e) { return e; } return null; }

The first thing that I did is to create an extension method that belongs to any Action delegate instance. Notice the use of the generic constraint to ensure that the generic type parameter provided to the method is an actual derivative of Exception, which ensures that using this method is only applicable to exception throwing behaviors for a specific exception type. The second method GetExceptionFromPerforming (you will notice that I commonly use a style of naming that makes the method name coupled with its parameters the full name of the method, read the line as GetExceptionFromPerforming(work) vs GetExceptionFromPerformingWork(work), just a little bit of redundancy I don't care for) returns the exception caught while trying to execute the Action.

The ShouldBeAnInstanceOf method is another extension method that gets associated with any object, it just makes use of an existing assertion in the MbUnit library.

All of the building blocks are in place there is only one problem. I can't do this:

(() => DependencyRegistry.GetMeAn<IDbConnection>()) .ShouldThrowA<InterfaceResolutionException>();

So with just the following new class added to the my BDD Extensions Class:

 

public static class The { public static Action Action(Action workToDo) { return workToDo; } }

Looks a little weird, to have a method that looks like all it is doing is returning what it was called with, but in this case it is actually allowing us to allow assignment of the lambda to a known type which ultimately allows us to have extension methods that are bound to that known type (in this case the Action delegate). With all of these places in place this is how I now do assertions for exceptions thrown in a piece of SUT code:

The.Action(() => DependencyRegistry.GetMeAn<IDbConnection>())
                    .ShouldThrowA<InterfaceResolutionException>(); 

 

In this code the SUT is the DependencyRegistry which is actually a Static Gateway to container functionality.

Develop With Passion!!

Comments [3] | | # 
Sunday, May 11, 2008 2:36:37 AM (Mountain Standard Time, UTC-07:00) ( Agile )

First and foremost I have to stress my great amount of respect for Carl and what he does for the development community.

In the current DNR episode in which Carl and Richard interview Phil Haack there is a portion in the show where Carl makes some statements about Test Driven Development.

The two statements that  he makes are:

"Test first is just one extreme of test driven development"

"according to JP Boodhoo the whole test driven development ranges from wrapping NUnit tests around existing functions on one end of the spectrum and then test first on the other end of the spectrum but most people fall somewhere in between"

These are not my thoughts/practices with regards to Test Driven Development. I feel that test driven development is first and foremost a design activity that is used to flesh out the design of a component by creating a test that first describes the API it is going to expose and how you are going to consume it's functionality. The test will help shape and mold the System Under Test until you have been able to encapsulate enough functionality to satisfy whatever tasks you happen to be working on.

IMHO TDD as an activity requires the creation of the test code before you write any production code for the component itself. This is the way I personally develop as well as the way I teach and mentor people with respect to practicing TDD.

When you go into an existing code base and start wrapping tests around existing production code that is already there, that is Unit Testing, not TDD.

Develop With Passion!!

Comments [4] | | # 
 Friday, May 09, 2008
Friday, May 09, 2008 7:13:10 PM (Mountain Standard Time, UTC-07:00) ( General )

Well, I guess I'll know for next time how many days it takes for me to get 79 responses for a freebie giveaway!! The 3 winners just got sent their amazon gift credits. And yes, the 79th email just came in a couple of hours ago!!

Tell your friends, tell your coworkers. This is far from the last freebie of the quarter!!

Develop with Passion!!

Comments [0] | | # 
 Thursday, May 08, 2008
Thursday, May 08, 2008 5:53:00 AM (Mountain Standard Time, UTC-07:00) ( General )

Seeing the response from the Dream Giver giveaway, I thought I would try something a little bit different in an effort to get people to potentially look at updating their book library.

Self education is an absolute must if you want to remain current in this industry, and IMHO there is no better resource that blogs and a couple of books to help you hit the ground running.

If you are feeling like your book library could use a bit of an upgrade then email me. I will issue an $70 Amazon gift card to the:

  • 77th, 78th, and 79th respondents

Develop With Passion!!

Comments [12] | | # 
Thursday, May 08, 2008 5:16:40 AM (Mountain Standard Time, UTC-07:00) ( Training )

With the window for registration for the Toronto course soon coming to a close, it is time to start registration for another iteration of Nothin But .Net to be held in Vancouver. You can register for the course here. Like all of the recent public courses, this course will also be held in the conference room of a hotel, so travelers will be able to stay in the hotel the course is being hosted in. This statement is also known as : prepare for long days!!! We are blessed to be able to have the beautiful Coast Plaza Hotel And Suites at our disposal, this will give us some great lunch and dinner options (remember, you don't have to pay for any of the meals) as well as some potentially nice walks near the ocean!!

I am anticipating that this class will fill up fast, so if you are ready to take your skills to the next level, register today!!

Overview

Nothin But .Net is a five day (intense) boot camp style course that will focus on applying .Net development best practices in the context of developing a working N-Tiered application. Registrants will learn about how to practically apply.Net as they apply it to the task of building a complete application from the UI layer all the way down to the mapping layer.

 

WARNING!!!!

If you are expecting to come to this course to learn about how to have VS.Net automatically generate an “application” for you, then this course is NOT for you.

This course is all about taking control of the .Net framework and having it work the way you want. This course will place a heavy emphasis on getting back to the basics and making .Net do things the way you want it to, in a predictable and testable way.

During the course of the week, there will be absolutely no code that gets compiled from within Visual Studio. Studio itself will be relegated to a glorified code editor. I will teach you development techniques and tools that will dramatically increase your day to day productivity as a software developer.

This course will focus on a code centric view of application development vs. the typical databinding/designer magic covered by many typical .Net courses. You will walk away with a deep understanding of fundamental aspects of .Net and how these pieces can be used to develop and deliver enterprise scale applications.

Core Concepts Overview

*        Expand the capabilities of developing with VS.Net - Enter ReSharper (a productivity add-in for Visual Studio .Net)

*        There’s more to development than code generators

*        Automated Builds       

*        Generics ( they’re not just for collections )

*        Object Relational Mapping in .Net

*        Creating layered architectures

*        Driving out functionality and design through testing

*        Taking Control Of Databinding

*        Test Driven Development & Mock Objects

*        Core Design Patterns Applied

 

Detailed Topic Coverage Breakdown

·          Language Enhancements

o    Generics

o    Anonymous Delegates

o    Iterators

o    Linq

·          Collections

o    Taking advantage of the collection interfaces

o    Making use of the IDictionary<T> and IList<T> interfaces.

o    Overcoming the limitations of the IList<T> interface

o    Sorting, searching, and manipulating collections using generic delegates

o    Overcoming limitations of searching with generic delegates

o    Creating custom comparers

·          Events

o    Delegates in depth

o    Creating classes that expose events

o    Safely publishing events

o    Multithreading with delegates

·          ADO .Net

o    Creating a Custom Object Relational mapping layer

o    Effective uses of TransactionScope to test the mapping layer

o    Eliminating the need for stored procedures

o    Effective techniques for querying data

·          ASP.Net

o    Master Pages

o    Passing Data Between Pages

o    Taking Control Of Databinding

o    Validation Techniques

o    Leveraging Front Controller Architecture styles for cleaner separation of concerns.

o    Saying goodbye to WebForms

o    MVC vs MVP vs SC

·          OO Practices & Principles

o    Dependency Inversion

o    Single Responsibility

o    Open Closed

o    Hollywood

o    Tell Don’t Ask

o    Encapsulation

o    Polymorphism

·          Patterns

o    Layered Architecture

o    Data Transfer Object

o    Supervising Controller

o    Passive View

o    Notification

o    Static Gateway

o    Unit Of Work

o    Mapper

o    Gateway

o    Domain Model

o    Null Object

o    Proxy

o    Adapter

o    Abstract Factory

o    Event Aggreagor

o    Service Layer

o    Façade

o    Visitor

o    Decorator

o    Composite

o    Front Controller

o    Notification

·          Testing

o    Using Automated Testing Frameworks

o    Dependency Based/Interaction Based

o    TDD as a design tool

o    Applied Test Driven Development

o    Avoiding over specification problems with Interaction Based Testing

o    Test Partitioning

o    Different types of testing (Integration,Acceptance,Unit)


Recommended Prerequisites

This is an intermediate to expert level course. In order to walk away with the most benefit from the course the following list outlines key prerequisites and the level of knowledge that people would be best served entering the course with:

 

*        Knowledge of the C# syntax (Strong)

*        Knowledge of the .Net event/delegate architecture (Moderate/Strong)

*        OO programming concepts (Moderate/Strong)

*        Domain Driven Design (Cursory)

*        Refactoring (Cursory)

*        Design Patterns (Cursory)

*        Automated Testing Frameworks (Cursory/Moderate)

*        Test Driven Development (Cursory)

*        Utilizing Events and Delegates in .Net (Moderate/Strong)

*        Manipulation of core ADO.Net objects (Moderate/Strong)

*        Build Automation (Cursory)

 

**********Please be aware that the length of course days (based on prior iterations of the course) can fluctuate dramatically based on the level of student interaction. It is best to come ready expecting the course days to be no less than 10 hours.************

 

Intended Outcomes

Upon completion of this course students should be equipped with a practical, applied understanding of the following concepts:

 

*        Interface Based Programming

*        Design By Contract

*