CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeffrey Palermo (.com)

Blog moved to www.jeffreypalermo.com

March 2008 - Posts

  • Agile Coaching: The daily stand-up meeting

    I'm starting a new blog series based on my experiences doing agile coaching at clients.  Along with agile projects in .Net, my company also offers agile coaching and training.  Right now, the agile coaching practice consists of me, but I'm actively working on finding people to expand that practice.  I started doing this March 2007, and since then, I've seen some of the same patterns repeated in very different businesses.  In this series of posts, entitled "Agile Coaching", I'll talk about some of the common solutions to the common problems I'm finding.  This first installment is about a daily stand-up meeting.

    The daily stand-up meeting

    At several clients, I've seen developers who aren't co-located.  Many organizations value individual offices, and what I observed is that sometimes developer won't communicate much day-to-day.  Perhaps there is a weekly development meeting where folks report on status.  I attended one of these, and one developer reported spending the entire last week on a single blocking issue.  A whole week!  I recommended the instituting of a daily stand-up meeting immediately.  This would give a daily sync-up opportunity for the development team.  There are plenty of other things to improve, but a daily stand-up meeting is low-hanging fruit.  It is easy to implement and returns immediate gains.

    What is it?

    Every morning (I like 0830 or 0900), gather the development team in the same area.  That area could be a hallway, a meeting room or whatever space is available for standing.  No chairs allowed.  The meeting should be over in under 10 minutes.  The agenda:

    • What I accomplished yesterday
    • What I plan to accomplish today
    • What issues are blocking progress

    Every person in the development team reports on the three items to the rest of the team.  This is not a report to management or the coach/scrummaster/project manager.  This is so each person has a clear understanding of what is going on.  When issues are exposed early, others can help resolve them quickly.  I recommend this practice be used in every software organization. 

  • ASP.NET MVC: Goodbye SmartBag, Hello ViewDataExtensions

    A while back, I thought up the idea of the SmartBag, which has a very friendly API for working with viewdata objects.  With the December CTP, adding objects to ViewData was a bit difficult, but now that the ViewData property is an IDictionary on the Controller base class, getting objects in is very easy.  If you like this post, subscribe to my feed at http://feeds.feedburner.com/jeffreypalermo.

    Consider the following usage

    [Test]
    public void ShouldRetrieveSingleObjectByType()
    {
        var bag = new Dictionary<string, object>();
        var url = new Url("/asdf"); //arbitrary object
        bag.Add(url);
     
        Assert.That(bag.Get<Url>(), Is.EqualTo(url));
        Assert.That(bag.Get(typeof(Url)), Is.EqualTo(url));
    }

    We are adding a Url object to the dictionary, and then we can retrieve the object through the Get<T> method or by passing the type.  No need for a string key if only a single Url is in the dictionary.  If you have multiple Url objects, you can fall back to keys, or you can pass in a Url[] and then Get<Url[]>(). 

    In CodeCampServer, I've removed SmartBag and added these ViewDataExtensions.  These are extension methods to IDictionary<string, object> and System.Web.Mvc.ViewData.  In my opinion, System.Web.Mvc.ViewData should inherit from Dictionary<string, object>, so maybe that will happen in the next release.

    I've added ViewDataExtensions to MvcContrib, so you you'd like to use them, just build the trunk of MvcContrib, and you'll have them.  Look at CodeCampServer for widespread use of these extension methods.  Strongly typed views don't scale when the application complexity increases, but these view data extensions make working with the dictionary a snap.  My annoyance factor is very low with viewdata now.

    MvcContrib is a free, open-source project.  Feel free to use it and contribute patches to it.  Building it takes less than 1 minute on my box, and the build runs all 840 unit tests to verify the features continue to work.

  • So much easier to test plain ASP.NET MVC controllers!!

    I was having a hard time easily testing controller classes with the MVC Framework December CTP.  Now it's easier.  For some background, I'm writing ASP.NET MVC in Action for Manning, so I'm going through all kinds of scenarios, and in the first chapter with the tiny little Hello World samples, it's now easier to test these.  Consider the following controller:

     

    using System.Web.Mvc;
     
    namespace MvcApplication.Controllers
    {
        public class HelloWorld1Controller : IController
        {
            public void Execute(ControllerContext controllerContext)
            {
                controllerContext.HttpContext.Response.Write(
                    "<h1>Hello World1</h1>");
            }
        }
    }

     

    And here's my unit test:

     

    using MvcApplication.Controllers;
    using NUnit.Framework;
    using NUnit.Framework.SyntaxHelpers;
     
    namespace MvcApplicationTest.Controllers
    {
        [TestFixture]
        public class HelloWorld1ControllerTester
        {
            [Test]
            public void ShouldRender()
            {
                var response = new ResponseWriteStub();
                var contextStub = new HttpContextStub(response);
                var controller = new HelloWorld1Controller();
     
                controller.Execute(new ControllerContextStub(controller, contextStub));
     
                Assert.That(response.ActualWritten, Is.EqualTo("<h1>Hello World1</h1>"));
            }
        }
    }

     

    Pretty darned simple.  Below are my stub classes.

     

     

    using System.Web;
    using System.Web.Mvc;
    using System.Web.Routing;
     
    namespace MvcApplicationTest
    {
        public class ControllerContextStub : ControllerContext
        {
            public ControllerContextStub(IController controller)
                : base(new RequestContext(new HttpContextStub(), new RouteData()), controller)
            {
            }
     
            public ControllerContextStub(IController controller, HttpContextBase contextBase)
                : base(new RequestContext(contextBase, new RouteData()), controller)
            {
            }
        }
    }

     

     

    using System.Web;
     
    namespace MvcApplicationTest
    {
        public class HttpContextStub : HttpContextBase
        {
            private readonly HttpResponseBase _response;
     
            public HttpContextStub(HttpResponseBase response)
            {
                _response = response;
            }
     
            public HttpContextStub()
            {
                
            }
     
            public override HttpResponseBase Response
            {
                get { return _response; }
            }
        }
    }

     

     

    using System.Web;
     
    namespace MvcApplicationTest.Controllers
    {
        public class ResponseWriteStub : HttpResponseBase
        {
            public string ActualWritten;
     
            public override void Write(string s)
            {
                ActualWritten = s;
            }
        }
    }
  • Extreme Programmers wanted in Austin, TX

    It's time again.  I'm hiring.  If you'd like to work for me at Austin's leading agile consulting company, please apply through our website job posting.  The applications all get routed to me, so if you apply and fit well, I'll end up giving you a call.  We're hoping to hire locally, so if you already live in Austin, TX, that's a plus.

    Here's our team page.

    Here's the job posting.

    For a little more on what what do, read here.

    We are a corporate member of the AgileAlliance.

    For information on our Agile Boot Camp.

    And, finally, if you'd like me to visit your company for a day to give you an agile assessment of your software department, just let us know.  I'm doing more and more of those lately.

  • Original altnetconf (cli_dev) list has now been deprecated

    http://tech.groups.yahoo.com/group/cli_dev/ is closed.  A poll of the group showed that this was the best course of action.  The archives are still there.  Anyone who was a member can still search the archives.  Unfortunately, Yahoo doesn't provide a mechanism for public message access for a closed group, so this is as good as I could get it.  All messages are still there.

    If you would like to participate in more Alt.Net stuff, go to http://tech.groups.yahoo.com/group/altdotnet/

  • ASP.NET MVC Framework source code available (via ScottGu)

  • March Agile Boot Camp was fun

    Last week I taught the March Headspring Agile Boot Camp.  Since it's a course for developers, it's all about Extreme Programming, process, and architecture decisions that lead to a zero-friction project.   Stay tuned to my rss feed at http://feeds.feedburner.com/jeffreypalermo because I'll be releasing the source code for the reference application we work on during the course.  It's a work order system, and it has all the hairy things you expect in a line of business application, like statuses, state transitions, notifications, etc. 

    Mke Palermo (MVP and Microsoft Regional Director) was in my course, and I was glad to see him again.  No we're not related, but he's a good friend, and I normally only see him at conferences. 

    John Blackman (former Microsoft employee - moved to Austin, TX) was also in the course, and he wrote a review on his blog.

    Karthik from Telligent Systems was in the January course, and his blog review is here.

  • MVP Summit Party with Palermo planning in full swing

    Party with Palermo: MVP Summit 2008 Edition - rsvp here!!

    April 13, 2008 @ 7:00PM - 10:00PM
    Jillian's:  http://www.jilliansbilliards.com/
    731 Westlake Ave N, Seattle, EA
    Ph: 206-223-0300
     
    Cover charge is 1 business card.  This will get you in the door and register you for the grand prize drawings.
    • Free to attend
    • Free fingerfood
    • Free drink
    • Free swag

    KEEP TABS ON HTTP://www.PartyWithPalermo.com --- THIS IS WHERE THE INFORMATION WILL BE POSTED.
    Feel free to blog and link back to this site. 
  • ASP.NET MVC Framework on the Polymorphic Podcast

    If you don't care about podcasts, stop reading now.  If you don't care about ASP.NET MVC, stop reading now.  If you haven't stopped reading, then please continue. :-), and subscribe to my feed at http://feeds.feedburner.com/jeffreypalermo

    Craig Shoemaker recently interviewed me on the Polymorphic Podcast regarding the MVC Framework and the MvcContrib project.

    I, along with Ben Scheirman and Dave Verwer, are writing ASP.NET MVC in Action for Manning, and I talk a little about that.

    I spoke a lot about MvcContrib.  I really have to brag on the folks contributing to MvcContrib and to Eric Hexter, who does a lot of work to keep that project's CI setup going.  Here's the latest build report below.  If you are curious how you can get nearly 1000 unit tests runing in an automated build and have it run in less than 3 minutes, pull down the source and see how the build and tests are put together.

    -------------------------------------------------------------

    CruiseControl.NET Build Results for project MVCContrib (web page)


    BUILD SUCCESSFUL

    Project:
    MVCContrib

    Date of build:
    2008-03-19 13:43:57

    Running time:
    00:02:12

    Integration Request:
    IntervalTrigger triggered a build (IfModificationExists)

    Last changed:
    2008-03-19 13:43:29

    Last log entry:

    Patch #1003 - kbaley
    Patch includes:
    - the ability to use TestControllerBuilder with controllers that have constructor arguments
    - associated unit test

    Tests run: 802, Failures: 0, Not run: 0, Time: 40.704 seconds

    All Tests Passed

    Modifications since last build (4)

  • GoDaddy could use some unit tests

    For those who frequent the TechPodcasts network, like I do, you've probably heard of the 10% discount code for GoDaddy.com orders.  Everybody and their brother gives away GoDaddy 10% off codes.  The problem is that today it doesn't seem to work.  Could it be a hidden policy (fine print) or could GoDaddy use some unit tests around thier shopping cart total calculations?

  • Austin Code Camp '08 call for speakers and attendees

    The Austin .Net User Group had its first code camp in 2006 with 150 attendees.  2007 was a success, and we're planning Austin Code Camp '08Register now, see who's coming, and submit a session.

    This conference is on a weekend on May 17, 2008, and it's free to all. 

  • Objects have dependencies. Methods don't

    For more counter-intuitive banter, subscribe to my feed:  http://feeds.feedburner.com/jeffreypalermo

    There is quite a bit of talk lately about unit testing using the extract method and override, or "inherit & override" method for stubbing out a method for unit testing.  Methods don't have dependencies, and methods aren't dependencies.

    Objects are dependencies, and object have dependencies.  One object will depend on another object.  Objects are cohesive and present a contract of behavior so other objects know what behavior they can reliably leverage.  Because an object is cohesive, everything necessary to perform all its behavior can be passed into the object's constructor at the beginning of the object's life.  Then, that object can perform all of the operations.


    In order to test a particular object, I might have to pass some fake objects (stubs, mocks, etc) into the constructor, but the object under test doesn't care as long as the type is satisfied.  If I can't test an object by passing in fakes to the constructor (and I can compromise sometimes by using setter injection), then the object is less than cohesive, and I should search the design of the object for an extra concern that is trying to get out.  Once I find the extra concern, I would separate the concern (separation of concerns) into its own object and have than as an explicit dependency by requiring it be passed into the constructor (dependency injection).

    Michael Feathers outlines this extract method and override testing technique in his book, "Working Effectively with Legacy Code", and I've used the technique many times to break nasty dependencies on legacy code in order to get it under test.  This is necessary because legacy code can't be safely refactored until it has a safety net of test coverage.

    If your unit test has to know that another method on the same object is being called, then the unit test knows too much about the implementation of the object.  The unit test should be doing black box testing on the object under test.  In other words, the unit test shouldn't care about what code is written or if 1 method or 10,000 methods inside the object are actually called.  The unit test merely sets up explicit object dependencies and test state, interaction or both.

  • Parse IP addresses out of a web server log file

    I had written a quick script off the top of my head, but my astute reader reminded me of the fully-featured LogParser tool that can not only extract IP addresses but can also pull out a whole host of information from your log files:

     

    http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en 

  • Thought-provoking "architecture" Austin .Net User Group meeting tonight

    For more information about the Austin .Net and Agile community, subscribe to my feed:  http://feeds.feedburner.com/jeffreypalermo

    I just got back from an Austin .Net User Group meeting, and instead of a presentation, we had a group discussion on architecture.  We discussed what architecture is, how specific it should be, whether a separate architecture team works, etc.  We saw some react violently against past experiences with bad architects and other voice the strong need for an architect to provide leadership and technical guidance to a development team.

    The discussion turned to business with architectural decisions like how "safe" to be with redundant systems and graceful failover.  More ROI decisions.  Elaine Krause pulled the discussion back to development, and we talked a bit about buy vs. build decisions like using tools such as CodeSmith, NetTiers, CSLA, and NHibernate. I couldn't resist giving a plug that I teach NHibernate in my Agile Boot Camp course.  

    Overall, we really didn't get to a definition of "architecture".  What else is new.  Other forums have tackled the subject and have only been able to give it a rough definition.  The software context of architecture makes it different in each scenario. 

    The following notable people were at the Austin .Net User Group meeting last night:  Blake Caraway, Eric Hexter, Jimmy Bogard, Chad Myers, Jeremy Miller, Eric Anderson, Chris Koenig, and Cy Huckaba.

    If you were there and want to be listed, get a blog, and send me the link. 

  • ASP.NET MVC Framework big changes since Dec CTP

     For more stuff on ASP.NET MVC, subscribe to my feed:  http://feeds.feedburner.com/jeffreypalermo

    If you installed the December CTP of the ASP.NET MVC Framework, you had to install it.  The assembly was registered with the GAC, and you didn't have to deploy the assembly.  The original plan was to release the MVC Framework with a service pack of .Net 3.5.  That is no longer the plan.

    In the March CTP, System.Web.Mvc.dl, System.Web.Routing.dll, and System.Web.Abstractions.dll can all be deployed to the bin folder.  They don't require the GAC.  I like that a lot.  I recently deployed www.partywithpalermo.com using the March CTP drop of the MVC Framework.  I have .Net 3.5 on the web server, and it was super simple. 

    Routing is a bit different.   Make sure to change [controller]/[route] to {controller}/{route}.  Minor change.  Overall, I'm actually using to using {} for tokens because of all the NAnt build work I've done (NAnt uses ${prperty}).

    Routing can be used with existing apps.   If you have every done url rewriting (I have), you know how painful it can be.  Now that routing is in a separate assembly, you can use it with any ASP.NET app you wish.  I really like that concept because routing doesn't care if you are using the mvc handler or page hander.  It works for parsing urls either way.

    Overall, I'm pretty impressed with this CTP (and it is a CTP).  It is not done yet, and Microsoft makes no claims that it is complete.  It's the second public drop of a new, fledgling framework.  The core, in my opinion, is the routes, controllers, and handoff to the views.   All the other stuff is ancillary.  Once the core is there, libraries like MvcContrib can start adding on extra features.  For instance, I'm looking at leveraging the presentation object validators from the Castle project along with the [DataBind] attribute.  It shouldn't be to hard to leverage the Castle project here, even while using a different controller base class.  I think they are quite complimentary, and Monorail has so many great features, I don't think I'll use the MVC Framework bare. 

    Let me know in a comment if you are interested in me releasing the source for www.partywithpalermo.com

More Posts Next page »

Our Sponsors

This Blog

Syndication

News

Headspring Systems

View Jeffrey Palermo's profile on LinkedIn

See my new blog at .jeffreypalermo.com