About Me

Training

Nothin But .Net Developer Bootcamp

Navigation

Search

Categories

On this page

Getting started with BDD style Context/Specification base naming
Updated BDD Naming Macro
Setting The Record Straight - My Thoughts On The MVP Variants (for web applications)
code.google.com/p/jpboodhoo!!!
Alternative To ALT-INS For ReSharper Junkies
Update To VS2008 Issue
VS2008 - Bringing Attention To An Issue
Static Gateway - Part 2
Stop Reading - Start Doing
Downloading VS2008
Amendment - Nothin But .Net, College Station Texas
The Expert Mind
You know as much as you know "right now"
A tale of two brothers
Building a culture of integrity
Nothin But .Net Fundametals- College Station , TX ( January 7th - 11th, 2008 )
Leading by multiplicity
Reflecting on an amazing week (People over process)
Updated - Macro For Test Naming
ReSharper Templates
Huge Code Drop Coming!!!!!!!
They can steal your code, but they can't steal your creativity!!
Software Developers vs. Software Artists
TDD is like snowboarding (or learning any new skill)

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

 Thursday, November 29, 2007
Thursday, November 29, 2007 10:36:09 AM (Mountain Standard Time, UTC-07:00) ( Agile | Programming )

I have received a number of good responses from people who have a couple of aesthetic issues with the BDD style naming that I am starting to use. Let me clarify, I have been using the natural sentence style test naming since Scott introduced me to it in earlier in the year. I have not used the context/specification style test naming on a project yet, though it is my intent to write each successive test from this point forward in that style and if I feel pain points I will let you know.

From my experience so far here are some tips that I think will resolve the issues that the people who are trying to use it will find:

Issue 1 – “I ended up really not liking those fixture names because I felt it was hard to find fixtures for specific classes, and navigate with Resharper Type navigation.  Was wondering what naming convention you came up with for fixtures?”

A: My recommendation for this is to create a single test class in your test project called $SystemUnderTest$Specs. Where SystemUnderTest corresponds to the name of the class that you will be testing. This is just a grouping construct for all of the “Contexts” that will be run against that fixture. Inside the “Specs” class, you will create classes for each of the different contexts. Here is an example of one that I just rewrote the tests for the ShoppingCart class is the nothinbutdotnetweb.app project using this new style and I personally have to say that it was an awesome experience. One of the things that I found was that I could copy the body of one fixture and change the name to reflect the new context and I could focus solely on the interactions and behaviour that is pertinent to that particular context. Take a look at the Report that is generated when run against the specs in the ShoppingCartSpecs class:

  • When a product is added that is not already in the cart
    • The cart item factory should be used to create a cart item for the product being added.
  • When an item is added
    • The item count should be incremented
    • The item should be added to the underlying list
  • When the same product is added again
    • The item factory should not be leveraged
    • The quantity of the item should be incremented
  • When changing the quantity of a product in the cart
    • The item should be updated with the new quantity
  • When changing the quantity of a product causes the item to be empty
    • The item should be removed from the cart
  • When changing the quantity of a product that is not in the cart
    • Nothing should happen
  • When a product is removed from the cart
    • The item representing the product should be removed
    • The number of items in the cart should decrease
  • When asked to remove a product that is not already in the cart
    • Nothing should happen
  • When the cart is emptied
    • There should be no more items
  • When asked for the quantity of a product
    • The cart item representing the product should be asked for its quantity
    • The result should be the quantity of the item for the product
  • When asked to calculate the total cost
    • Should be the sum of the total cost for all items

 

One of the things you will notice about the tests in these fixtures compared to the others in the rest of the project (so far) is the use of Setup to stress the context setup. I added a virtual method to the AutoMockingTest base called because, which calls out the action being invoked on the SUT.

This actually resulted is some tests that contained no body whatsoever, and the ones with assertions actually only needed one assertion.

This is a learning experience for me to, but so far, I am loving the expressiveness and focus this style of testing brings to the table.

By grouping all of the fixtures into the ShoppingCartSpecs class, you can solve the navigability issue.

 

The second issue I received was:

“Quick question ... while the idea is great, it doesn;t flow for me, as ReSharper keeps cutting in and completing my words for me - Intellisence is great, but in this context is is annoying as hell ...

 

How do you avoid this problem?”

 

 

A – This is actually a ReSharper setting that I have had turned off pretty much since I started using ReSharper:

  • Go to ReSharper – Options
  • Select the Intellisense item in the left nav bar
  • Uncheck Letters and Digits in the Completion Behaviour pane on the right!!

That’s it. Now you can write you natural sentences without ReSharper getting in your way. Since I have been without this setting since ReSharpers inception, I have gotten quick at using ALT-SPACE/CTRL-ALT-SPACE a lot, this may take a bit of getting used to for the people who were use to the Letters and Digits autocompletion behaviour.

 

Again, as far as quickly navigating to the tests for a sut, you can just go CTRL-SHIFT-N and then start typing in the significant letters for the Spec class, in this case it would be:

 

CTRL-SHIFT-N -> SCS

 

Because all of the fixtures will be contained in the file but there will be no ShoppingCartSpecs type. I guess you could create one as a nesting construct, but that is what the file is for.

 

Again, let me stress that this Context/Specification style naming is a little new for me, and there is a possibility that the tests in the ShoppingCartSpecs that have no assertions could be a smell (I’ll get that verified by Scott in a little while), I already see the benefits from both the documentation perspective as well as the ability to truly only focus on one specific context at a time.

 

Develop With Passion.

 

Comments [3] | | # 
Thursday, November 29, 2007 2:15:16 AM (Mountain Standard Time, UTC-07:00) ( Agile )

After an awesome session pair programming with Scott the other day, I am going to start taking advantage of natural sentence style naming for not just my test method names, but the names of the test fixtures themselves.

The name of the fixture will now become the context for the tests inside of that fixture. It is actually surprising what level of detail this allows you to express yourself.

I had to change my test naming macro to support classes also. Here is the fix:

 

Imports System Imports System.Windows.Forms Imports EnvDTE Imports EnvDTE80 Imports System.Diagnostics Public Module CodeEditor Sub ReplaceSpacesInTestNameWithUnderscores() If DTE.ActiveDocument Is Nothing Then Return Dim wrCS As Boolean = DTE.Properties("TextEditor", "CSharp").Item("WordWrap").Value Try DTE.Properties("TextEditor", "CSharp").Item("WordWrap").Value = False Dim selection As TextSelection = CType(DTE.ActiveDocument.Selection(), EnvDTE.TextSelection) Dim index As Integer selection.SelectLine() If selection.Text = "" Then Return Dim methodIndex As Integer = selection.Text.IndexOf("public void ") Dim classIndex As Integer = selection.Text.IndexOf("public class ") index = CType(IIf(methodIndex >= 0, methodIndex, classIndex), Integer) Dim prefix As String = CType(IIf(methodIndex >= 0, "public void ", "public class "), String) prefix = selection.Text.Substring(0, index) + prefix Dim description As String = selection.Text.Replace(prefix, String.Empty).Trim selection.Text = prefix + description.Replace(" ", "_").Replace("'", "_") + vbCrLf selection.LineDown() selection.EndOfLine() Catch ex As Exception MsgBox(ex.Message) Finally DTE.Properties("TextEditor", "CSharp").Item("WordWrap").Value = wrCS End Try End Sub End Module

Develop With Passion

Comments [5] | | # 
 Wednesday, November 28, 2007
Wednesday, November 28, 2007 11:59:42 PM (Mountain Standard Time, UTC-07:00) ( .Net 2.0 | Agile | C Sharp | Programming )

Having received a bunch of emails in the past couple of weeks from people who have been asking me questions with regards to Passive View/Supervising controller patterns for web applications. I needed to let people know that for the last couple of months I have been developing web apps in a completely MVC style which eliminates the need for patterns like Passive View/ Supervising Controller.

For the people who are using the MVP pattern in their (web) applications I personally would now lean to the Supervising Controller style as it eliminates a lot of necessary chattiness between the view and the presenter. It also lends itself to much more simple unit tests.

Having gotten back into the Smart Client realm, I am once again reminded of the importance of patterns like Supervising Controller and presentation model as becoming essential to ensuring correct separation of responsibilities.

For my web applications, however, all I use now is a:

  • Front Controller
  • Commands
  • View Templates (ASPX style!!)

Here is an example of what I mean, for the nothinbutdotnetstore.web.app project that is currently hosted on google code, here is the Command that processes getting a list of the main departments in the store for viewing:

 

using NothinButDotNetStore.Infrastructure; using NothinButDotNetStore.Infrastructure.Container.Common; using NothinButDotNetStore.Tasks; using NothinButDotNetStore.Web.FrontController; namespace NothinButDotNetStore.Web.DepartmentBrowser { public class ViewMainDepartments : ICommand { private ICatalog catalog; private IRequestContext requestContext; private IViewEngine viewEngine; public ViewMainDepartments(IHttpContext context) : this(context, DependencyResolver.GetImplementationOf<IRequestContextFactory>().CreateFrom(context), DependencyResolver.GetImplementationOf<IViewEngine>(), DependencyResolver.GetImplementationOf<ICatalog>()) { } public ViewMainDepartments(IHttpContext context, IRequestContext requestContext, IViewEngine viewEngine, ICatalog catalog) { this.catalog = catalog; this.viewEngine = viewEngine; this.requestContext = requestContext; } public void Execute() { requestContext.AddToStateBag(ViewBagItem.Departments, catalog.GetMainDepartments()); viewEngine.Display(Views.ViewDepartments); } } }
 
Here is the complete ASPX (View Template) that gets rendered for that command executing:
 
 
<%@ MasterType VirtualPath="~/Store.master" %> <%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" MasterPageFile="~/Store.master" %> <%@ Import namespace="NothinButDotNetStore.Web.FrontController"%> <%@ Import namespace="NothinButDotNetStore.Web"%> <%@ Import namespace="NothinButDotNetStore.Infrastructure"%> <%@ Import namespace="NothinButDotNetStore.DTO"%> <asp:Content ID="content" runat="server" ContentPlaceHolderID="childContentPlaceHolder"> <p class="ListHead">Select An Isle</p> <table> <% int rowIndex = 0; %> <% foreach (DepartmentDisplayItem dto in ViewBag.GetItem(ViewBagItem.Departments)) { %> <tr class='<%=(rowIndex++ %2 ==0 ? "nonShadedRow" : "shadedRow" ) %>'> <td> <a href='<%= Url.ToBeProcessedBy(CommandNames.ViewSubDepartments) .AddPayloadValue(PayloadKeys.DepartmentId,dto.Id).Build() %>'> <%=dto.DepartmentName %> </a> </td> </tr> <% } %> </table> </asp:Content>

There is no code behind for this aspx page. The logic in the aspx file is there because it is rendering related logic. This aspx page does not talk to a service layer or domain objects or even a data access layer. It reaches into a ViewBag looking for information that it can render, and then it proceeds to do exactly what it should, render the information. What may not be immediately obvious is that this is a plain aspx file with no codebehind file. The page inherits from System.Web.UI.Page.

As far as testability of this style of development, here is a sample test for one behaviour of the ViewMainDepartments command:

[RunInUnitTestContainer] [Test] public void Should_populate_the_context_with_the_departments_to_display() { ICommand sut = CreateSUT<ViewMainDepartments>(); IEnumerable<DepartmentDisplayItem> results = CreateMock<IEnumerable<DepartmentDisplayItem>>(); using (Mocks.Record()) { Expect.Call(mockCatalog.GetMainDepartments()).Return(results); mockRequestContext.AddToStateBag(ViewBagItem.Departments, results); } using (Mocks.Playback()) { sut.Execute(); } }
 
 
 

In the next little while I am going to shed some more light on this approach to web application development. IMHO, the separation of concerns for web applications written in this style is much greater than when trying to stuff in a pattern that (again IMHO) did not fit well for the technology, and was leveraged for the sake of increased testability.

Comments [2] | | # 
Wednesday, November 28, 2007 11:01:52 PM (Mountain Standard Time, UTC-07:00) ( .Net 2.0 | .Net 3.0 | Agile | C Sharp | Continuous Integration | Patterns | Programming | Tools )

I finally set up a googlecode project to host source code for the various things I have been doing over the last year. The first major significant contribution is of course the code drop that I promised a week ago now!!

The application is the start of what I hope will evolve to be a great learning resource for lots of things related to .Net development. The application does not currently cover any of the “extra” topics that I did not have time to get covered in the course. This is perfect because as request come in from people (including past students) asking how to tackle a certain problem, I will use this application as the demonstration area where I can tackle the problem, and update the code base, and you will be able to update your local copy and carry on.

I am currently in the midst of a large Smart Client application that I am hoping to be able to harvest pieces of code out and do the exact same thing except for the smart client realm. I have much more experience developing in the smart client realm and that is where I feel most comfortable, so I am looking forward to be able to do another code drop (for a different application) in a couple of months.

I am going to write up another post about the Web Application as it is built very differently from traditional .Net based web applications. In following with the theme for my courses, there are currently no 3rd party frameworks (other than log4net) that have come into play. My goal with this web app is to demonstrate to people how far we can push raw .Net. The goal being that expanding their knowledge of how to creatively leverage .Net, they will be better prepared to jump into frameworks that they may currently feel daunted by. As time goes by, I will swap pieces of the application out with components that people are asking to see meaningful samples on:

  • NHibernate
  • Castle
  • Prototype
  • JQuery
  • ..*

As the app stands right now I see it as the beginning of what will shape up to be a pretty mean machine!!

I am going to post a screencast that will show people how to get started working with the web application. For people who are eager to get going right now, here are the quick and simple steps without a lot of explanation (that will come in the next post):

  • Anonymously checkout the trunk from the google code repository using the following svn command line:
    svn checkout http://jpboodhoo.googlecode.com/svn/trunk/ jpboodhoo-read-only
  • Navigate to the checkout folder
  • Go into the build folder
  • Copy local.properties.xml.template and paste it into the same directory, then rename the copied file to local.properties.xml
  • Open up the local.properties.xml file with your favourite text editor.
  • Modify any of the settings in the file that are different on your machine.
  • Open up a command prompt and navigate to the build directory of the code.
  • type: build load.data and hit enter.
  • type: build test.all.woc
  • type: build run
  • The last task should fail (I haven’t automated everything yet)
  • Create a virtual directory called nothinbutdotnetstore that points at the following location (this location is created after you attempt to run the build run task) : ${checkoutfolder)\build\deploy\web\app
  • After successfully creating the virtual directory try the build run task again.
  • If the web browser pops up pointed at a web page (for the app) you are in business. Feel free to click through the first set of pages that are implemented (only 3 pages are currently implemented).

As far as what I have planned to implement in the web app (that is currently not implemented):

  • Build out a more extensive domain model that encompasses some more advanced scenarios of the application (especially around order processing).
  • Unit Of Work for the service layer
  • Implement a lightweight OR/M layer
  • Integrate some UI frameworks like prototype
  • Eliminate Master Pages completely and switch to a much more elegant template view pattern.
  • Introduce a more robust container (as the current one is a simple dictionary wired up in a simple procedural fashion).
  • Introduce the concepts of lifecycles for the items in the container. Right now, everything wired into the container is essentially a singleton.
  • Introduce CSS based layout for the web pages (working with a designer on this one).
  • Bring security concerns into play
  • Demonstrate how to effectively manage sessions
  • ……lots,lots,lots more!!!

Obviously I will be leaning on people checking out the code and playing around with it and submitting requests for things they would like to see.

There are a couple of things that you will immediately notice about the application:

  • Clean front controller implementation with ASPX pages as the template views. There are no code behind pages in this web application. All web requests are handled by command objects that interact with the service layer, push the details into a “ViewBag” and then choose which view to render.
  • Logical layers in the project are separated using simple folders and namespaces (not full blown projects)
  • Build automation is its own project in the solution (props to Jay Flowers for this inspiration)
  • The current container implements (CustomDependencyContainer) is very simple and is handled by a big procedural application startup task.
  • Compile time support for the database layer. A couple of classes ago I introduced the concept of a generic TableColumn<T> type. In England after introducing this concept Scott Cowan leveraged his knowledge of MyGeneration to automatically generate strongly typed table definitions that we could leverage to do mapping (trust me when I say, this is nothing like datasets). Until moving into OR/M concepts deeper this gives a good place to start as the generation of the TableDefinitions is linked to whenever the SQL files change, so you will get compile errors if column types are now mismatched etc…

There are lots of other things I could talk about, but this code really is the start of what I see being a long running conversation between myself and other people wanting to learn. In all honesty for all of the emails I have not paid attention to this year, hosting code through google will allow me to answer peoples questions in a much more meaningful way as I can point them at this site to see the implementation of the code they had questions about.

I am going to be placing all of the code for presentations that I have done for the last year as well as continue to update it with the source code that comes out of new courses that will be coming out in the new year, and the DNRTv episodes.

Once again, the application is currently in its infancy, but as people start sending in the requests I now will have a venue and example to add upon to answer questions in a much more timely fashion!!!

 

Develop With Passion!!!

 

 

Comments [15] | | # 
 Sunday, November 25, 2007
Sunday, November 25, 2007 3:23:32 PM (Mountain Standard Time, UTC-07:00) ( General )

Everyone who knows me knows what a big keyboard junkie I am. When I am typing on my MacBook keyboard and not my natural (or datahand). There is not Insert key that I can use when in ReSharper.

I know that there are utilities to remap keys to emulate the insert key, but I am not going to get into those.

Here is the keyboard sequence to get to the Generate Code dialog (normally accessed by pressing ALT-INS):

ALT – R – C – G

Now here is the funny thing. After just using this sequence for a couple of hours I find it much faster than ALT-INS. I think this is because even though there are more keys to hit, the flight path of my hands on the natural keyboard is greatly decreased because I don’t have to move my right hand off home row. When I want to hit the insert key on my natural keyboard I have to move my right hand (this could also be due to poor keyboard technique on my part).

Nonetheless, the nice thing about this sequence is now I am using the exact same key sequence when I am on my natural keyboard and my macbook pro keyboard!!

 

Develop With Passion

Comments [5] | | # 
 Friday, November 23, 2007
Friday, November 23, 2007 10:02:01 AM (Mountain Standard Time, UTC-07:00) ( Tools )

Thanks to everyone for all of the feedback. In the end, the first response that I tried was to install the latest copy of VisualSVN (I was running a slightly older version).

After installing the latest version of VisualSVN everthing is functioning as expected.

Comments [3] | | # 
 Thursday, November 22, 2007
Thursday, November 22, 2007 11:00:26 PM (Mountain Standard Time, UTC-07:00) ( Tools )

Well, today I installed VS2008 on my machine. Setup went great and completed with no errors.

This was a fresh install on a machine that had no prior beta bits installed whatsoever. So I did not anticipate anything weird happening.

Fired up VS2008 for the first time and  it went through its normal first time setup deal. So there I was, in a blank IDE with my C# RSS Feed showing from the help page.

I go to add a new project and I’m presented with this wonderful dialog:

Ok…. So I try a few (lot) more menu items and the same thing happens. So, I think to myself, just exercise the standard Windows remedy. Get out, get back in, and see if it is better!!

I would do that, if I could exit Studio!! Even hitting the big red x in the top right corner of VS2008 pops up this dialog. The only way to shut this down is to kill the devenv process.

I am currently running XP with SP2 and an existing installation of VS2005. Again, let me stress that I have not installed any beta bits of VS2008.

After un installing and reinstalling to no success (same result) I quickly googled. I happened to stumble into an MSDN forum where people are having the same issue and are also not sure how to go about resolving it.

Has anyone else ran into this issue? How did you fix it?

Comments [4] | | # 
 Wednesday, November 21, 2007
Wednesday, November 21, 2007 9:02:06 AM (Mountain Standard Time, UTC-07:00) ( )

In the last installment I left off with a class that served as a Static Gateway for Logging functionality. The nature of the members being accessed statically allowed for pure syntactic sugar for clients who wanted to consume logging functionality. I got a lot of feedback from people who made comments about why I could not make use of a IOC container to accomplish the same thing. This post is my answer to those questions as that is exactly what I do on my own projects.

When I get to the point that I need to introduce IOC into my codebase I drive it out in a test first manner. In the last implementation that I did here was the first test that I wrote:

 

[Test] public void Should_leverage_container_to_resolve_an_implementation_of_an_interface() { Provide<IDependencyContainer>(CreateMock<IDependencyResolver>()); IDbConnection mockDbConnection = CreateMock<IDbConnection>(); using (Mocks.Record()) { Expect.Call(mockDependencyResolver.GetImplementationOf<IDbConnection>()).Return(mockDbConnection); } using (Mocks.Playback()) { DependencyResolver.InitializeWith(mockDependencyResolver); IDbConnection result = DependencyResolver.GetImplementationOf<IDbConnection>(); Assert.AreEqual(mockDbConnection, result); } }

I am making use of the automocking container in this test so try not to get hung up on the semantics of what the Provide<IDependencyResolver> call is doing.

All this test demonstrates is that I am going to have a class called DependencyResolver that will serve as the Static Gateway, to IOC functionality. I have also show that it is not necessarily going to do the work, but rather it will delegate to an IDependencyResolver implementation (mocked out in this test) to accomplish the work on its behalf. The implementation code to get this test passing is as follows: 

public class DependencyResolver { private static IDependencyResolver resolver; public static void InitializeWith(IDependencyResolver resolver ) { DependencyResolver.resolver = resolver; } public static Interface GetImplementationOf<Interface>() { return resolver.GetImplementationOf<Interface>(); } }
 
public interface IDependencyResolver { Interface GetImplementationOf<Interface>(); }

So far so good. I continued to write one more test (based on my prior experience with leveraging containers) to ensure that I had better error messages if a dependency could not get resolved properly. This is most often caused by the underlying container not being configured with an implementation of a particular contract: 

[ExpectedException(typeof(InterfaceResolutionException))] [Test] public void Should_report_more_detail_if_unable_resolve_an_implementation_of_an_interface() { Provide<IDependencyResolver>(CreateMock<IDependencyResolver>()); using (Mocks.Record()) { Expect.Call(mockDependencyResolver.GetImplementationOf<IDbConnection>()).Throw(new Exception()); } using (Mocks.Playback()) { DependencyResolver.InitializeWith(mockDependencyResolver); DependencyResolver.GetImplementationOf<IDbConnection>(); } }

The accompanying implementation is fairly trivial:

 

public static Interface GetImplementationOf<Interface>() { try { return resolver.GetImplementationOf<Interface>(); } catch (Exception e) { throw new InterfaceResolutionException(e,typeof(Interface)); } }

The custom exception is as follows:

 

public class InterfaceResolutionException : Exception { public const string ExceptionMessageFormat = "Failed to resolve an implementation of an {0}"; public InterfaceResolutionException(Exception innerException, Type interfaceThatCouldNotBeResolvedForSomeReason):base(string.Format(ExceptionMessageFormat,interfaceThatCouldNotBeResolvedForSomeReason.FullName),innerException) { } }

Having used this technique on my last couple of projects, it did not matter if the underlying implementation of IDependencyResolver was a Spring adapter, a Castle adapter, or a StructureMap adapter, if the real container framework had trouble resolving a dependency, I would get a nice line in my log file that read:

(omitting tracing information**) – Failed to resolve an implementation of an (Whatever the contract is).

This helped me quickly go to the container configuration and deal with the errors as they were always to do with the way I was wiring things up.

Now that I have this gateway for Dependency resolution in place, I should be able to leverage this from the Logging static gateway. I do this by changing my Logger test as follows: 

[Test] public void Should_ask_dependency_resolver_for_a_logger_factory_that_can_be_used_to_return_a_logger_to_the_client() { ILog mockLog = CreateMock<ILog>(); ILogFactory mockLogFactory = CreateMock<ILogFactory>(); Provide<IDependencyResolver>(mockDependencyResolver); using (Mocks.Record()) { Expect.Call(mockDependencyResolver.GetImplementationOf<ILogFactory>()).Return(mockLogFactory); Expect.Call(mockLogFactory.CreateFor(typeof (LogTest))).Return(mockLog); } using (Mocks.Playback()) { DependencyResolver.InitializeWith(mockDependencyResolver); ILog log = Log.For(this); Assert.AreEqual(mockLog, log); } }

This turns my implementation of the Log static gateway into the following: 

public class Log { public static ILog For(object itemThatRequiresLoggingServices) { return For(itemThatRequiresLoggingServices.GetType()); } public static ILog For(Type type) { return DependencyResolver.GetImplementationOf<ILogFactory>().CreateFor(type); } }

This means that from this point on, when I want to introduce another static gateway for some other piece of, typically, cross cutting functionality such as logging. The Static Gateway for that functionality can make use of the dependency resolver to resolve its dependency and it completely eliminates the need for static fields and initialization method in everything but the main DependencyResolver Static Gateway itself.

I like to keep classes like Log kicking around because in my code that consumes Logging functionality I would much rather have a line of code in a client class that reads:

Log.For(this).InformationalMessage(“Blah”)

As opposed to:

DependencyResolver.GetImplementationOf<ILogFactory>().CreateFor(this).InformationalMessage(“Blah”)

The Log Static Gateway still shields the consumer from the details of how to go about logging so the consumer can carry on it its happy simple world.

Develop With Passion!!

Comments [4] | | # 
Wednesday, November 21, 2007 1:30:10 AM (Mountain Standard Time, UTC-07:00) ( Agile | Programming )

I had to laugh when I read “TDD Ain’t No Snowboarding from Alessandro Burrato. It is a direct counter to my TDD is Like Snowboarding post!!

His experience of TDD is very different than the experience I documented based off of my experience introducing it to clients. And I feel that his recollection of the experience is definitely one that I would like to see more in the clients that I engage and the people that I talk to

He makes one very good point that I can’t stress enough to people who spend their days reading blogs about the great stuff that people are doing, to quote him:

“If, and only if, you stop seeking pre-cooked answers from those who already tried it and start friggin’ DOING something.”

At one point or another, practical knowledge of a topic far outweighs any theories you may have built up in your head!!

Nice post Alessandro.

 

Comments [1] | | # 
 Monday, November 19, 2007
Monday, November 19, 2007 2:39:19 PM (Mountain Standard Time, UTC-07:00) ( General | Tools )

The title says it all. Looks like I will be prepping a new VMWare image in a couple of hours!!

Now the JetBrains people have a good target to aim at with getting a release out that supports the RTM of VS2008!!

Develop With Passion

Comments [6] | | # 
 Friday, November 16, 2007
Friday, November 16, 2007 9:35:02 AM (Mountain Standard Time, UTC-07:00) ( Training )

I made an error when I posted about the course I will be holding in College Station yesterday. The course that I am going to be offering in college station is a new course that I am delivering titled Nothin But .Net Fundamentals. This course is radically different than my Nothin But .Net course in that it is specifically targeted at people who are new to .Net development or who consider themselves at beginner level.

One of the consistent pieces of feedback I have received from my courses this last year is the apparent firehose effect that comes from me not clearly specifying the prerequisites. In the case for the fundamentals class, there is only one prerequisite:

  • You need to have some familiarity with the C# syntax!!

That’s right. That is the only requirement. As you can imagine, the class and the content that is covered varies greatly from the Nothin But .Net course, where I drill into topics like :

  • Domain Driven Design
  • Test Driven Development
  • ORM
  • Dependency Injection

The fundamentals course is strictly about getting people comfortable developing using the .Net framework as a tool in their toolkit.

I had to post this, in the event that people might sign up for the course accidentally thinking that it was going to be like the other courses I have delivered this past year, and that is not the case.

Please re-read the post that I made (which has now been updated with the correct information) so that you can better understand how this course differs from the original Nothin But .Net course.

Develop with Passion.

Comments [3] | | # 
Friday, November 16, 2007 8:56:30 AM (Mountain Standard Time, UTC-07:00) ( General )

An article , that David Truxall was kind enough to leave a comment about, explains beautifully what I was trying to convey in my Tale of two sons story.

If you have a mentor, or someone you look up to as an expert in an area that you currently feel lacking. Maybe this article can give you some insight into the process that developed their abilities to the level you are aspiring to.

http://scientificamerican.com/article.cfm?articleID=00010347-101C-14C1-8F9E83414B7F4945

The following is one of my favourite excerpts from the article:

A Proliferation of Prodigies
The one thing that all expertise theorists agree on is that it takes enormous effort to build these structures in the mind. Simon coined a psychological law of his own, the 10-year rule, which states that it takes approximately a decade of heavy labor to master any field. Even child prodigies, such as Gauss in mathematics, Mozart in music and Bobby Fischer in chess, must have made an equivalent effort, perhaps by starting earlier and working harder than others.

According to this view, the proliferation of chess prodigies in recent years merely reflects the advent of computer-based training methods that let children study far more master games and to play far more frequently against master-strength programs than their forerunners could typically manage. Fischer made a sensation when he achieved the grandmaster title at age 15, in 1958; today's record-holder, Sergey Karjakin of Ukraine, earned it at 12 years, seven months.

As another commenter reminded me, Thomas Edison once said -

"genius is 99 percent perspiration and 1 percent inspiration"

Develop with passion!!

Comments [5] | | # 
Friday, November 16, 2007 12:40:24 AM (Mountain Standard Time, UTC-07:00) ( General )

Having had a lot of conversations with people over the last couple of weeks on strategies that have worked in my life to help ensure that I maintained my focus, I thought I would share a tip that my Dad gave me a long time ago.

“There will always be someone who knows more than you do”

Such a simple phrase, but it has had a huge impact on the way that I, in my own life, have dealt with the issue of personal development. If I don’t have to worry about “keeping up with the Joneses” that means that I can truly focus on improving myself for the sake of personal satisfaction and nothing else. I can be free from playing technology monopoly and only take a look at bringing on board technologies if and when I see a role and advantage to be gained by integrating them into my work.

I can read blogs by people who are doing cool stuff and have it be an empowering thing and not a stumbling block to my own creativity. If I know as much as I know right now, I will know more tomorrow. Why? Because now the only person I need to challenge is myself. I can leverage the skills of people I have been surrounded by to be my sounding board for potentially wacky ideas that I come up with. The whole time, I am honing my craft and expanding the way my mind looks at solving problems that it is presented with.

Comments [2] | | # 
Friday, November 16, 2007 12:25:01 AM (Mountain Standard Time, UTC-07:00) ( General )

(This story is purely fictional, although I am sure that in the course of history it is very likely that something similar happened)

One day a husband and wife were blessed with a double miracle in the form of 2 identical twin sons.

Within the first 4 years of their lives it had become evident that God had blessed the boys with a raw talent in the arena of sports. In order not to pressure them, and to ensure that each son was given the opportunity to pursue their passion, the parents decided to see how these natural abilities would evolve over the course of the years.

Up until high school, both boys naturally participated in the same sports clubs and because of their God given gifts, they were able to excel to a level that eclipsed that of most of their peers. Fast forward a couple of years to high school.

In high school one of the brothers decided to drop out of sports and follow an interest in business studies. In the meaning his brother was relentlessly pursuing the improvement of his physical abilities. His average day consisted of the following routine:

  • 5:00AM – Wake up for 30 minute jog to the swimming pool
  • 5:40 – 6:40AM – 1 hour intense swimming
  • 12:00PM – 12:40PM – Gym session at school
  • 4:00PM – 6:00PM – Gym session at local YMCA

You get the point. This brother was taking the “time” and “effort” to hone a gift he was given. The other brother had found a new passion and although not given a natural gift for business, he was devoting his time to learn everything he could about business studies.

Fast forward 10 years. The brother who followed the athletic path, excelled above and beyond both his peers and his brother in the arena of athletics. His brother, who was still gifted in athletics, was still at a slightly higher athletic level than that of the average athlete, but he was an order of magnitude of skill lower than his brother and even other people who had not been given a gift for athletics but had spent years improving their physical makeup and developing themselves as athletes. He was now an accomplished businessman and had build and developed several successful businesses once he had graduated high school because it was something that he trained to do, and improved on continually.

What is the point of this story?? A lot of people ask me the question “How Do You Do It?” My first response to them is “What?”. They will continue by saying things like :

  • Maintain a healthy marriage for 11 years
  • Raise a family of 4 kids
  • Blog
  • Speak
  • Excel in particular areas of .Net

My answer to them is plain and very simple. Why is software any different that any other skill that a person chooses to pursue. I absolutely believe that there are people who are born with a natural gift to be able to write software. A gift left unopened is still a gift unrealized. If you are one of many developers who has acknowledged that software is a craft that you can choose to hone like any other skill; you will see that all these people out there who you currently consider as “experts” are no different than yourself. The only difference is that lots of the forerunners in the field have chosen to hone their skills in one or more areas to a level that helps them stand out from the crowd.

What does it mean to hone your craft in software development? In all honesty I truly feel that first and foremost it means writing a lot of code. Getting out of your comfort zone and solving a problem you have solved dozens of times before in a completely different way. Finding a group of peers who can challenge you in a friendly and competitive way to raise your own level of expectations for yourself.

There truly is very little magic when it comes to looking at anyone who has been able to excel in their field. From the people that I look upto, they all share the trait of pursuing excellence in the craft that they have chosen for their careers. Be that software development or not.

Comments [1] | | # 
 Thursday, November 15, 2007
Thursday, November 15, 2007 11:32:08 PM (Mountain Standard Time, UTC-07:00) ( General )

I had to laugh a little. The one blog post that I wrote this year which also generated the most comments is the only one with a hint of negative sound to it!!

I have to stress one thing and people need to hear me when I say this. I am completely in acknowledgment of the fact that people make mistakes. As a sinner saved by grace, I am reminded of this fact daily. I make mistakes on a daily basis. If and when I get the opportunity to meet you, you will find that I wear my emotions on my sleeve and am extremely passionate about what I do for a living, and because in this past year I have been blessed with the opportunity to influence others on a larger scale it has raced to the forefront of my mind the importance of integrity in the role of leaders.

In my last post, people were quick to jump on the fact that I seemed to be singling out some people in the community with the comments I was making. And that is definitely not the case. Let me also quickly state that regardless of how people read into that last post I in no way hold myself in any higher regard than anyone else.

What I do hold myself to is striving to daily achieve a level of excellence for myself in the arena of software development. I strive to foster a community that cares as much about quality of character as much as it does quality of the code that is produced by a development team. I am not against people being out in the community sharing information that they have found to be useful for themselves. I personally feel that everyone who is out there sharing information should be letting people know that whatever knowledge they are sharing is based on their current level of knowledge and is information that, in my opinion, should be validated by a group of peers who are able to challenge the ideas that they are presenting.

What I am asking for is for people to stop worrying about being politically correct (good point that was brought up from an attendee of my last course) when it comes to challenging “the experts” whether it be me or anyone else. I want developers to be more honest with themselves and the people they are engaging about the skillsets they have. I want developers to not have to feel stressed about the fact that a position is asking for skillsets X,Y,Z and they only have strong knowledge in one of the 3. For myself, I have found it such a freeing experience to be able to speak open and honestly with both clients and peers about where my skills do and do not lie. This completely changed the landscape of the interview process for me. I can be completely honest about what I do know and what topics I personally feel very strong in. I can also,be brutally honest about what I don’t know and what is currently not on my radar to look at in the immediate future. If one of these areas is a skillset that will make or break the deal, then so be it. I will have been given the opportunity to meet a new set of people and the decision will now be in their court and they will have been given information in its rawest form to make a decision that benefits them and their current set of needs.

What is the point I am trying to make in short?:

( IsABlogger() && HasAnMVP() && HasDoneLotsOfPresentations()) != IsAnExpert()

All that the above points identify is that an individual has all of the prerequisites that need to be in place to be recognized as a community influencer. It does not make them an expert. Expert, IMHO, is a very relative term. If you bring me onto a project and I am not able to deliver effectively with your team, then it does not matter how I was selling myself to the interview team, the developers that I am working with will be able to weed me out quicker than management potentially could.

For myself and others (involved with community or not) I would like to see us be more honest with ourselves and the people we come into contact with on a daily basis about where our strengths and weaknesses lie in the realm of development. I would like developers to be able to drop the facades and set client expectations early in a very realistic way. I think if this were done on a more consistent basis, it would make for a much less stressful situation all around. 

As for people who were asking me to name names, I am not going to. Part of my responsibility as someone who has witnessed and experienced this is to challenge and have conversations with the parties in question. All of these conversations that I have had over the year have ended in positive outcomes. It does not negate the fact the practice is there and there are changes that can be made to completely eliminate it from our everyday development culture. I would hope that if and when I start making claims about myself that are not true, somebody would be brave enough to step up to the plate and personally challenge me about it. Maybe that would be all I need to put my focus on integrity back into check.

Comments [1] | | # 
Thursday, November 15, 2007 6:31:10 PM (Mountain Standard Time, UTC-07:00) ( Training )

Nothin But .Net Fundamentals is coming to College Station, Texas for the week of January 7th–11th 2008.

Overview

Nothin’ But .Net Fundamentals is a five day boot camp that will focus on teaching people a core understanding of how to get started developing with the .Net Framework. This course is intended as an introductory class for people who are getting started in .Net development.

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

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

  • Expanding the capabilities of developing with VS.Net - Enter ReSharper (a productivity add-in for Visual Studio .Net)
  • Generics ( they’re not just for collections )
  • Deep Dive into delegates and events
  • Undestranding the role of the main collection interfaces
    • IEnumerable
    • IComparer
    • IEqualityComparer
    • IComparable
    • IEqualityComparer
  • Reflection
  • Attributes
  • Fundamental Threading Constructs 
  • Understanding ADO.Net
  • The .Net type system
  • Value types vs Reference types
  • Designing your own custom types
  • The role of AppDomains
  • The importance of leveraging unit testing tools
  • Pragmatic Productivity Tools For Developers

One of the main goals of the course is to teach people fundamental knowledge that they should be able to use to leverage .Net more effectively as they go forward. There will be a small application that is used throughout the course of the week to drive home and apply the concepts as they are introduced.

Seats are limited. The course costs $2500/US for a full 5 days. The fee covers:

  • 5 (8 - 14 hour days, depending on the audience availability) of bootcamp style instruction
  • Breakfast
  • Coffee Break
  • Hot Lunch
  • Supper
  • $70 Amazon book allowance
  • Software – ReSharper 3.0 License

If you have any questions please don't hesitate to contact me at jp@jpboodhoo.com.

To Register for the course please use the following link:

Comments [0] | | # 
Thursday, November 15, 2007 4:56:04 PM (Mountain Standard Time, UTC-07:00) ( General )

The title for this post comes from a comment that Scott Hanselman made at the Alt.Net conference in Austin. There are two ways that people lead:

  • By Addition
  • By Multiplicity

In my opinion, the community at large would be greatly enhanced if more of the thought leaders were focused on growing other leaders in the field, as opposed to just adding followers behind them.

I went on a bit of a rant last week in front of my class where I expressed my disgust at the degradation of integrity that I have witnessed over the course of this last year. I am talking about developers and consultants who are out there as thought leaders, who are committing nothing less than career fraud by selling themselves into positions that they are not qualified to be in. With skillsets that they definitely do not possess.

I cannot change these people, they will continue to either make these mistakes and get caught in their own lies (the nets are closing in). Or they will see the error of their ways and make the necessary (often extremely difficult) corrective actions to ensure that they are walking in integrity.

One thing that continually impresses me is the amount of developer talent that is waiting on the sidelines getting ready to express their viewpoints and thoughts on software development with the rest of the industry. These are people who may not yet be regarded as the “experts”, but they are humble, willing to learn and possess extremely critical thinking. All it takes is for one person who can take the time to grow these people as leaders. Once this happens, then these people will most likely go out and do the same thing, start to grow other leaders. This is something that can spark a community (and I’m not just speaking dev in this scenario) in ways that you could not imagine.

I am hoping that I can continue to lead by multiplicity in the areas that I am given that opportunity. With that in mind (and hopefully not putting too much pressure on them) here are some people that I am going to be watching with interest over the next couple of years to see what their impacts on the development community (and for some, the world) will be:

Just so no one feels left out, I have met lots of people this year that I think have the potential to become community thought leaders. The people above are just those people whose blogs I know about. I did not mention the people who are already blogging who have a considerable amount of buzz around their materials already.

If you yourself are in a position of leadership (trust me, we all are in some capacity) I am encouraging you to grow a culture and community of leadership by multiplicity. There is nothing more satisfying than knowing that when you lead my multiplication, in one small form, you are leaving one shape of a legacy behind you.

Comments [2] | | # 
Thursday, November 15, 2007 2:11:13 PM (Mountain Standard Time, UTC-07:00) ( General | Training )

Last week was without question the most amazing iteration of my Nothin But .Net course that I have had the blessing of delivering.

What made last week so different than all the other times that I have taught the course? The level of interaction and knowledge sharing that was happening between all of the people who came to attend.

People truly were able to let go of any facades that they were holding onto and were able to truly help each other through what was (I feel) a turning point for many people with respect to both their outlook on life and their careers.

One of the high points for me was when we had taken a supper break at a local Wendys. I was standing in line getting ready to pay, I looked out into the restaurant and every single person was sitting with someone who they did not work with. Keep in mind, that there were several companies who attended this course (one company had 5 people in attendance). This further solidified in my mind that people were truly there to share their own experiences with trying to get into this “Alt.Net” world. I was just the vessel to allow the communication to start. Once people got talking, I got to bask in the glow of the results of the amazingly high levels of interaction that happened.

One of the other things that I started doing last week was the pairing hotseat. If someone did not want to just watch me type, and they felt that they could “make the test pass”, they were welcome to come up into the pairing hotseat and take a stab at getting the test to pass. If they took too long, they were booted out, and somebody else took their place. Because of the comfort level in the room, with no-one needing to prove that they knew more or less than they did, it made for a very fluid experience.

I know that I said that I would no longer post about this kind of stuff on my blog, but you know what, I have to post about it. For this season in my life, this course and the impact that I have been able to have on both the professional and personal lives of people that I come in contact with is something that I know has been a direct blessing from the Lord.

A quote that I just received from a recent attendee sums it up very nicely:

Reading other’s comments about the course being a career and life changing event may sound ‘mushy’ and exaggerated at the very least, but until someone attends JP’s ‘Nothing but …’ course they will not realize that it may in fact be true”

I wake up each day and thank God for this opportunity and this season. I don’t know if I will be still doing this type of training a year from now, but during this season I am going to deliver 110% of myself when I am engaged in these training sessions so that I can hopefully continue to have a powerful impact on the lives of people that I encounter.

 

Comments [2] | | # 
 Tuesday, November 13, 2007
Tuesday, November 13, 2007 1:57:00 PM (Mountain Standard Time, UTC-07:00) ( General )

Since the last time I published this, things have changed a little. With the addition of some code from students in the last 2 classes, it definitely works a lot more fluid that it did in its original iteration:

Imports System

Imports System.Windows.Forms

Imports EnvDTE

Imports EnvDTE80

Imports System.Diagnostics

Public Module CodeEditor

Sub ReplaceSpacesInTestNameWithUnderscores()

If DTE.ActiveDocument Is Nothing Then Return

Dim wrVB As Boolean = DTE.Properties("TextEditor", "Basic").Item("WordWrap").Value

Dim wrPT As Boolean = DTE.Properties("TextEditor", "PlainText").Item("WordWrap").Value

Dim wrCS As Boolean = DTE.Properties("TextEditor", "CSharp").Item("WordWrap").Value

Try

DTE.Properties("TextEditor", "Basic").Item("WordWrap").Value = False

DTE.Properties("TextEditor", "PlainText").Item("WordWrap").Value = False

DTE.Properties("TextEditor", "CSharp").Item("WordWrap").Value = False

Dim selection As TextSelection = CType(DTE.ActiveDocument.Selection(), EnvDTE.TextSelection)

selection.SelectLine()

If selection.Text = "" Then Return

Dim prefix As String = "public void "

Dim index As Integer = selection.Text.IndexOf(prefix)

If index < 0 Then

Return

End If

prefix = selection.Text.Substring(0, index) + prefix

Dim description As String = selection.Text.Replace(prefix, String.Empty).Trim

selection.Text = prefix + description.Replace(" ", "_").Replace("'", "_") + vbCrLf

selection.LineDown()

selection.EndOfLine()

Catch ex As Exception

MsgBox(ex.Message)

Finally

DTE.Properties("TextEditor", "Basic").Item("WordWrap").Value = wrVB

DTE.Properties("TextEditor", "PlainText").Item("WordWrap").Value = wrPT

DTE.Properties("TextEditor", "CSharp").Item("WordWrap").Value = wrCS

End Try

End Sub

End Module

 

Enjoy.

Comments [0] | | # 
Tuesday, November 13, 2007 1:55:06 PM (Mountain Standard Time, UTC-07:00) ( .Net 2.0 | .Net 3.0 | C Sharp | General | Tools )

Since I have been asked for these quite a few times, I thought I would oblige and give these out. You can find below the links for both my Resharper Live Templates and File templates.

Enjoy:

Comments [1] | | # 
 Sunday, November 11, 2007
Sunday, November 11, 2007 5:48:00 AM (Mountain Standard Time, UTC-07:00) ( .Net 2.0 | .Net 3.0 | Agile | C Sharp | Programming | Training )

A lot of people will probably say it is about time!! I am taking the source code that just got driven out from this last week of Nothin But .Net and I am going to make it publicly available from my blog. I am hoping to release it by the end of the week. The reason that I can’t release it yet, is that there are lots of concepts that I wanted to cover in class that I did not have time too, so I am going to spend a bit of time fleshing out the code base to include all of the concepts that were missed (by student request)

Keep in mind that Nothin But .Net is a course about fundamental software development practices with a bit of a .Net slant. Here are some of the things you will be able to see in the code base:

  • How Test Driven Development was used to drive out the functionality of screens in the application in a top down fashion
  • The benefit of using Data Transfer objects not as a marshaling tool, but as a tool to let the needs of the UI not influence unecessary changes to the domain model
  • The benefits of leveraging layered architecture
  • Why you don’t need lots of projects in your enterprise solutions if you are using an automated build (take  a look at the following screenshot to get an idea for the solution structure
  • Clean Front Controller implementation so that you can eliminate the need for messy Passive View/Supervising Controller implementations just for testability of the web form world
  • Good practices around mixing both interaction and state based testing
  • Test partitioning (integration, unit, acceptance)
  • My current project build structure
  • How to avoid the overspecification problem with interaction based testing
  • Rhino Mocks and leveraging the automocking container (thanks James for getting me hooked on this thing)
  • Fluent Interfaces
  • Build Automation
    • NAnt compilation as an effective tool for pruning dead code that studio does not show
    • NAnt as a build tool
    • NAnt as your compiler and test runner
    • Build file partitioning
      • Use of filesets
    • Machine agnostic build files through use of local property files
  • Unit Testing
    • Focusing on one thing at a time
    • Incremental testing
    • Breaking reliance on setup methods
  • MBUnit
    • Decorators used effectively
  • Design Patterns
    • Visitor
    • Factory
    • Data Transfer Object
    • Adapter
    • Proxy
    • Mapper
    • Unit Of Work (lots of people have been bugging me about this for a while)
    • Lazy Loading
    • IOC
    • Gateway (and Static Gateway)
    • Service Layer
    • Identity Map
    • Data Mapper
    • Database Gateway
    • Money
    • Null Object
    • Strategy
    • Composite
    • Command
    • Template View
    • Query Object
    • Specification
    • Domain Model
    • Separated Interface
  • Design Principles
    • Single Responsibility
    • Open Closed principle
    • Dependency Inversion Principle
    • Hollywood principle
    • Tell Don’t Ask

I am sure I am missing lots in the description above, but you get the general idea. The important thing to note, is that all of the code (except for the changes I am making this week) was driven out through the course of the one week bootcamp!!

I am going to spend a couple of days ensuring that it contains as much code as possible for an initial drop, with full end to end functionality in place.

Going forward, this code will serve as a good place for me to be able to demonstrate in a public arena, concepts that people email me and ask me questions about. This way, I won’t have to spend as much time blogging, people can send me a question about something they are having problems with, I can implement the solution in the codebase and they can see how I attacked the problem from a test first perspective.

I envision this as being a very organic application. I am going to use it as a public tool to share whatever knowledge I have with as many people as possible.

When I post the code I will make sure I post a little about the application and why I feel that it will serve as a good tool to both teach and practice.

Comments [11] | | # 
Sunday, November 11, 2007 4:22:49 AM (Mountain Standard Time, UTC-07:00) ( )

I am in a bit of a braindump mode right now and can’t sleep really well. So I thought I would get down the thoughts in my head in blog fashion.

Had a lot of conversations this past week (amazing) with lots of excellent developers. A lot of developers who are new to concepts like TDD and Domain Driven Design.

A topic that kept coming up (mostly from me) was the unnecessary importance a lot of developers place on their intellectual property!! I have had many a disturbing conversation with consultants, MVPs etc who use phrases similar to this:

  • “I make sure I dumb it down for the client”
  • “I can’t show them all my secrets”

Once again, this is my personal opinion. Gifts are given to be shared and used by many. When I am in classes or in with a client I want to make sure that I am giving them the benefit of all of my current level of understanding. Whatever techniques I currently have, I want to be able to share with them so that they can improve themselves in the process. So many developers are focused on keeping “their edge” by putting up facades that ensure that the people they are working with will not be able to fully realize the benefits that they can bring to the table. Why do I do this? Because if I am still doing things the same way I showed you to do them 6 months ago (even 2 months ago) I have not grown in my craft.

Here is the great thing about top tier developers:

  • They don’t care about dropping all of their secrets, techniques and practices in front of you because these things are all a result of one thing
      • Creativity

The great software developers that I know don’t fret unnecessarily about putting their stuff out there for the world to see. They don’t care whether you steal the code/ideas and pass them off as your own (you are only hurting yourself in that scenario). The reason they don’t care? “You can’t steal their creativity”! In 6 months the things that you thing they know will have changed and the code that you “ripped off” is now stagnant and old because you did not truly understand the concepts. They are already innovating new solutions and disseminating this new information out to teams who can benefit.

An analogy that I like to use is one that occurred in my own life. When I was about 6 I started being able to copy any picture that was put in front of me. I could draw it identically. It did not matter what the picture was, an long as I was looking at it I could draw and exact copy (usually it ended up being bigger than the original). One of the problems with this is that when there was nothin in front of me to copy from I found that my drawings looked very different (in quality) when I was creating new pictures as opposed to copying ones that were already there.

Unfortunately, this is the story for too many software developers. They get really good and “copying the picture” as opposed to creating new masterpieces. One of the things I tell people I work with and the students who take my class is this:

“If you like the way this application is written and you now use it as the blueprint for how you build applications for the next 5 years, you have not learned anthing”

As a person who is absolutely in love with the craft of software development, I truly feel sorry for the developers (yes there are MVP’s who fall into this category also) who have become really good at copying the picture. They are missing out on ,what I feel, is the greatest part of software development. Constantly striving to innovate and challenge your own assumptions about the way you currently write software. Playing around with new techniques. Not just churning out the same code app after app because it works.

People can choose to copy the picture of another developer, but trust me, their artistic skills will be in a constant state of evolution where you will always be one step behind.

Develop with Passion.

Comments [7] | | # 
Sunday, November 11, 2007 3:54:21 AM (Mountain Standard Time, UTC-07:00) ( General )

It is 3:00AM in the morning and even though the last week has been one of the most intense (and satisfying) iterations of my Nothin But .Net course to date, I am sitting here thinking about  some of the amazing conversations that occurred over the course of the week.

One of the things that I don’t do a good job of hiding is my passion with respect to pursuit of excellent in your craft. With respect to the world of software development I personally feel that people fall into one of two categories. That of a software developer and a software artist.

IMHO, I truly believe that more developers would feel a lot greater satisfaction with their job if they took the time to exercise the creative sides of their brain. In our microwave culture, we are not satisfied unless we can get things happening now!

Like great artists of history (and present), building good software that is elegant and most of all maintainable, is more than just understanding the concepts of the language(s) that you are targeting. You need to be able to leverage the creative side of your mind to figure out how you can use the building blocks of the language and come up with concepts that can mirror/model the problem domain in a way that you can’t be taught just by googling.

A software artist takes time to hone their craft. They realize that the creative side of programming is more important that the language(s) or tools that they are using to implement the solution. Like an artist they take time to cultivate and grow their own unique style daily. Two software artists given the same problem to solve and no google to read will most likely come up with elegant solutions to the problem, but I would wager as to whether the solutions would look anywhere near the same. Why, because now their own personal styles are coming into play and they are flexing their creative and technical muscles to solve the problems at hand.

I challenge you this week (and going forward) to remember that creating software is more than:

  • Learning a language
  • Learning some cool tools (NHibernate,Castle,….)
  • Learning design patterns

Once you have a certain base of knowledge built up, the trick is not to challenge yourself to not just churn out the same old code day after day. Let your brain do what God designed it to do and let it run. Let it first identify the box and then figure out if there are creative ways that you can look at the problem to see if you can come up with a solution to the problem that you (or anyone else) has already come up with.

Develop With Passion.

Comments [4] | | # 
 Friday, November 02, 2007
Friday, November 02, 2007 2:30:43 PM (Mountain Standard Time, UTC-07:00) ( Agile )

I just received the following email that I thought I would share and answer publicly:

“I’m not using this methodology (TDD) because my principal question remains unanswered. I know that with TDD you should release less bugs, but what about the time needed to develop with that methodology ?

 

I would like to know if the time to develop an enterprise solution is faster, equal, or longer with TDD.

 

I hope you will be able to answer me because i’m very intrigued and interested by TDD and DDD.”

 

The first and most important point that I would like to draw attention to  is the misconception that TDD is a tool to ensure that you should release less bugs. Although one side effect of TDD is the fact that you may well end up with a smaller bug count that is not the driving factor behind the adoption and practice of TDD. The driving factor behind TDD is that of driving out the design of components in your system one test at a time.

 

With respects to the question:

 

“I would like to know if the time to develop an enterprise solution is faster, equal, or longer with TDD.”

 

When you first make a decision to head out onto the ski hill and take a shot at snowboarding you head out with a dream in your head of being able to carve it up within minutes and do tricks that would make SSX Tricky look lame. The reality of the situation quickly kicks in once you have fell for your first couple of times and you realize that it is going to take a bit of time before you become proficient enough just to traverse the hill without any glitz and glamour. If you are wise, you will take the time to get instruction from a qualified teacher, who can help you establish good footing and technique from day 1. Building upon this base of solid instruction will ensure that you able to grow as a snowboarder effectively over the next couple of months, and potentially avoid picking up any bad habits you may have formed had you tried to pick up the sport yourself without any instruction.

 

Like snowboarding (or any new skill you wish to acquire), in the beginning a lot of learning is going to be taking place. For the majority of people who venture into TDD waters, they realize that there are potential big holes in their skillset that may cause them pain in this new world. Assuming that those holes are not there, you will still have to deal with the fact that for the first little while you will be training your brain to tackle and solve programming problems in a way that it is not accustomed to. This is actually one of the biggest hurdles people have to jump when getting into TDD. The development of a new style of coding that forces you to think about a small win and code the API as if it is already there. A good way to start into TDD is to start with state based testing. Once you have got a good handle on state based testing you may mix it up with interaction based testing also.

 

The fact of the matter is, when you start TDD you may very well end up finding yourself moving ahead at a slower pace than normal, this is predominantly because you will be working out of a comfort zone that does not yet feel natural. When you experience your AHA moment with TDD, it will be shortly after that when you realize that writing the test has now become a natural extension of how you work, you won’t need to account for the fact that you are using TDD to build a project, as it will be melded into the way you function as a developer.

 

Having witnessed two teams (one agile, one non agile) with developers of the same caliber being asked to deliver functionality on a project. The team that practiced TDD was able to meet the needs and changing requirements in a way that completely surpassed the team that was coding without TDD. I have seen it work on my own projects countless times, projects ranging is size from the small to the large enterprise level. I personally would not be trying to teach people the benefits of TDD if I did not feel it was a justifiable learning to undertake. Speaking for myself, it has completely transformed the way I look at solving problems in the programming realm.

 

Much like many developers have acquired traits and behaviours with respects to their coding style and how they solve problems, TDD becomes another “natural” trait that becomes part of what you do to solve problems. The first thing you will do when faced with a problem is write a failing test to capture the requirement that you want met.

 

Ultimately, people have to make a decision to take a walk down TDD avenue and stick with it long enough for it to become something that feels natural. If you don’t give it a good shot, you could walk away not realizing the benefits that TDD can bring to your development arsenal.

 

For those of you who are looking at TDD as a serious option but have not yet picked it up, this may be a good season to hit the hill!!

 

Comments [3] | | #