April 2008 - Posts

I know the title might catch a few people off guard, but let me explain.  Side effecting functions, for the most part, are code smells.  This is a very important concept in Domain Driven Design (DDD) that's often overlooked.  For those who are deep in DDD, this should sound rather familiar.  And in the end, I think Spec# and some Design by Contract (DbC) constructs can mitigate this, or you can go the functional route as well.

What Is A Side Effect?

When you think of the word side effect in most languages, you tend to think of any unintended consequence.  Instead, what we mean by it is having any effect on the system from an outside force.  What do I mean by that?  Well, think of these scenarios, reading and writing to a database, reading or writing to the console, or even modifying the state of your current object.  Haskell and other functional languages take a pretty dim view of side effects, hence why they are not allowed, unless through monads.  F# also takes this stance, as "variables" are immutable unless otherwise specified.

Why Is It A Smell?

Well, let's look at it this way.  Most of our operations call other operations which call even more operations.  This deep nesting is then created.  From this deep nesting, it becomes quite difficult to predict the behaviors and consequences of calling all of those nested operations.  You, the developer might not have intended for all of those operations to occur because A modified B modified C modified D.  Without any safe form of abstraction, it's pretty hard to test as well.  Imagine that any mock objects that you create would have to suddenly know in 5 levels deep that it is modified in some function.  Not necessarily the best thing to do.

Also, when it comes to multi-threaded processing, this becomes even more of an issue.  If multiple threads have a reference to the same mutable object, and one thread changes something on the reference, then all other threads were just side effected.  This may not be something that you'd want to do.  Then again, if working on shared memory applications, that might be.  But, for the most part, the unpredictability of it can be a bad thing.

Let's take a quick example of a side effecting an object like implementation of a 2 dimensional Point.  We're going to go ahead and allow ourselves to add another Point to the system.

public class Point2D
{
    public double X { get; set; }

    public double Y { get; set; }

    public void Add(Size2D other)
    {
        X += other.Height;
        Y += other.Width;
    }
}

public class Size2D
{
    public double Height { get; set; }

    public double Width { get; set; }
}

What's wrong with the above sample is that I just side effected the X, and Y.  Why is this bad?  Well, like I said, most objects like these are fire and forget.  Anyone who had a reference to this Point now has a side effected one, that they might not have wanted.  Instead, I should probably focus on retrieving a new one at this point, since this is pretty much a value object.

What Can You Do About It?

Operations that return results without side effects are considered to be pure functions.   These pure functions when called any number of times will return the same result given the same parameters time and time again.  Pure functions are much easier to unit test and overall a pretty low risk.

There are several approaches to being able to fix the above samples.  First, you can keep your modifiers and queries separated.  Make sure you keep the methods that make changes to your object separate from those that return your domain data.  Perform those queries and associated calculations in methods that don't change your object state in any way.  So, think of a method that calculates price and then another method that actually sets the price on the particular object. 

Secondly, you could also just not modify the object at all.  Instead, you could return a value object that is created as an answer to a calculation or a query.  Since value objects are immutable, you can feel free to hand them off and forget about them, unlike entities which are entirely mutable.  Let's take the above example of the Coordinate and switch it around.  Think of the DateTime structure.  When you want to add x number of minutes, do you side effect the DateTime, or do you get a new one?  The answer is, you get a new one?  Why, well, because it's a structure, and they are immutable, but not only that, it solves a lot of those side effecting problems.

public class Point2D
{      
    private readonly double x;
    private readonly double y;
   
    public Point2D() {}
   
    public Point2D(double x, double y)
    {
        this.x = x;
        this.y = y;
    }

    public double X { get { return x; } }
   
    public double Y { get { return y; } }
   
    public Point2D Add(Size2D other)
    {
        double newX = x + other.Height;
        double newY = y + other.Width;
       
        return new Point2D(newX, newY);
    }
}

Spec# is a tool that can help in this matter.  Previously I stated why Spec# matters, well, let's get into more detail why.  We can mark our side effect free methods as being pure with the [Pure] attribute.  This allows the system to verify that indeed we are not side-effecting the system, and any time I call that with the same parameters, I will get the same result.  It's an extra insurance policy that makes it well known to the caller that I'm not going to side effect myself when you call me.  So, let's go ahead and add some Spec# goodness to the equation. 

[Pure]
public Point2D Add(Size2D other)
{
    double newX = x + other.Height;
    double newY = y + other.Width;
       
    return new Point2D(newX, newY);
}

But, now Spec# will warn us that our other might be null, and that could be bad....  So, let's fix that to add some real constraints for the preconditions.

[Pure]
public Point2D Add(Size2D other)
    requires other != null
{
    double newX = x + other.Height;
    double newY = y + other.Width;
       
    return new Point2D(newX, newY);
}

Of course I could have put some ensures as well to ensure the result will be the addition, but you get the point.

Turning To Design by Contract

Now of course we have to be a pragmatist about things.  At no point did I say that we can't have side effects ever.  That would be Haskell and they put themselves into a nasty corner with that and the only way around it was with monads, that can be a bit clumsy.  Instead, I want to refocus where we do them and be more aware of what you're modifying.

In our previous examples, we cut down on the number of places where we had our side effects.  But, this does not eliminate them, instead gather them in the appropriate places.  Now when we deal with entities, they are very much mutable, and so we need to be aware when and how side effects get introduced.  To really get to the heart of the matter, we need to verify the preconditions, the postconditions and mostly our invariants.  In a traditional application written in C#, we could throw all sorts of assertions into our code to make sure that we are in fact conforming to our contract.  Or we can write our unit tests to ensure that they conform to them.  This is an important point in Eric Evans' book when talking about assertions in the Supple Design chapter.

Once again, Spec# enters again as a possible savior to our issue.  This allows us in our code, to model our preconditions and our postconditions as part of our method signature.  Invariants as well can be modeled as well into our code as well.  These ideas came from Eiffel but are very powerful when used for good.

Let's make a quick example to show how invariants and preconditions and postconditions work.  Let's create an inventory class, and keep in mind it's just a sample and not anything I'd ever use, but it proves a point.  So let's lay out the inventory class and we'll set some constraints.  First, we'll have the number of items remaining.  That number of course can never go below zero.  Therefore, we need an invariant that enforces that.  Also, when we remove items from the inventory, we need to make sure that we're not going to dip below zero.  Very important things to keep in mind.

public class Inventory
{
    private int itemsRemaining;
    private int reorderPoint;
   
    invariant itemsRemaining >= 0;
   
    public Inventory()
    {
        itemsRemaining = 200;
        reorderPoint = 50;
        base();
    }
   
    public void RemoveItems(int items)
        requires items <= ItemsRemaining;
        ensures ItemsRemaining == old(ItemsRemaining) - items;
    {
        expose(this)
        {
            itemsRemaining -= items;
        }

        // Check reorder point
    }
   
    public int ItemsRemaining { get { return itemsRemaining; } }

    // More stuff here in class
}

What I was able to express is that I set up my invariants in the constructor.  You cannot continue in a Spec# program unless you set the member variable that's included in the invariant.  Also, look at the RemoveItems method.  We set one precondition that states that number of items requested must be less than or equal to the number left.  And we set the postcondition which states that the items remaining must be the difference between the old items remaining and the items requested.  Pretty simple, yet powerful.  We had to expose our invariant while modifying it so that it could be verified, however.  But, doesn't it feel good to get rid of unit tests that prove what I already did in my method signature?

Wrapping Things Up

So, I hope after reading this, you've thought more about your design, and where you are modifying state and that you have intention revealing interfaces to tell the coder what exactly you are going to do.  The Design by Contract features of Spec# also play a role in this to state in no uncertain terms what exactly the method can do with the preconditions and postconditions and through my class with my invariants.  Of course you can use your regular C#, or language of choice to model the same kind of things, yet not as intention revealing.

So, where to go from here?  Well, if you've found Spec# interesting, let Microsoft know about it.  Join the campaign that Greg and I are harping on and say, "I Want Spec#!"

kick it on DotNetKicks.com
Well, I certainly have an ambitious May schedule ahead of me.  Most of course will be revolving around functional programming and F# as it seems to be finally catching on.  I've been noticing a bunch from the Java and Ruby communities becoming interested in such things as Scala, Haskell, OCaml, Erlang and F#.  I was rather heartened by this as some in the Ruby world like here and here coming back to the static world for ways of representing data and functions in different ways.  Of course Lisp and Scheme (IronLisp and IronScheme) still manages to eek in the rebirth, but still remains on the outside.

I will be speaking at the Northern Virginia Code Camp on May 17th for a total of two topics:

  • Improve your C# with Functional Programming and F# concepts
    Learn how .NET 3.5 takes ideas from Functional Programming and how you can apply lessons learned from it and F# respectively.

  • Introduction to Functional Programming and F#
    Come learn about functional programming, an older paradigm that Object Oriented Programming, and the ideas around it.  This talk will cover the basics including high-order functions, functions as values, immutability, currying, pattern matching and more.  Learn how to mesh ideas from functional programming with imperative programming in F# and .NET.

So, if you're in the DC area, go ahead and register here and show your support for the community.

Also, I will be taking some time to spend up in Philadelphia this month at the next Philly ALT.NET meeting to also talk about F#.  Still ironing out the details on that one in regards to the DC ALT.NET meeting in May.  Either way, should be a good time!

kick it on DotNetKicks.com
During ALT.NET Open Spaces, Seattle, I spent a bit of time with Rustan Leino and Mike Barnett from the Spec# team at Microsoft Research.  This was to help introduce Design by Contract (DbC) and Spec# to the ALT.NET audience who may not have seen it before through me or Greg Young.  I covered it in detail on my old blog here.

Spec# at ALT.NET Open Spaces, Seattle

As I said before I took a bit of time during Saturday to spend some time with the Spec# guys.  I spent much of the morning with them in the IronRuby session explaining dynamic languages versus static ones.  They had the session at 11:30, the second session of the day, in direct competition with the Functional Programming talk I had planned with Dustin Campbell.  Greg was nice enough to record much of the session on a handheld camera and you can find that here.  It's not the best quality, but you can understand most of it, so I'm pretty happy. 

The things that were covered in this session were:
  • Spec# overview
  • Non-null Types
  • Preconditions
  • Postconditions
  • Invariants
  • Compile-Time checking versus Runtime checking
  • Visual Studio Integration
All in all, I thought it was one of the best sessions and I'm glad they came out.  Hopefully we'll see more from them in the future.

Scott Hanselman also recorded a session with the Spec# guys for Episode 128.  This is a much better interview than on DotNetRocks Episode 237 that Rustan did last year. This actually gets into the technical guts of the matter in a much better way, so go ahead and give it a listen.  I was fortunate enough to be in the room at the time to listen.

The New Release

Mike and Rustan recently released a new version of Spec# back on April 11th so now Visual Studio 2008 is supported.  You must remember though, this is still using the Spec# compiler that's only C# 2.0 compliant.  So, anything using lambdas, extension methods, LINQ or anything like that is not supported.  As always, you can find the installs here

As with before, both the Spec# mode (stripped down mode) and C# mode are supported.  What's really interesting is the inferred contracts.  From an algorithm that Mike and Rustan worked on, they have the ability to scan a method to determine its preconditions and postconditions.  It's not perfect, but to have that kind of Intellisense is really powerful.



What you can see is that the GetEnumerator method ensures that the result is new.  Keep in mind, result is a keyword which states what the return value is for a method.  It also says that the owner of IEnumerator will be the same as before.  Object ownership is one of the more difficult things to comprehend with Spec# but equally powerful.

Another concept that's pretty interesting is the ability to make all reference types non-null by default in C# or in Spec# modes.  Instead of having to mark your non-null types with an exclamation mark (!), instead you can mark your nullable types with a question mark (?) much as you would with the System.Nullable<T> generic class.  All it takes is the flip of a switch in Spec#:



Or in the C# mode:



And then you have all the Spec# goodness.

Why It's Important

So, why have I been harping on this?  To be able to express DbC as part of my method signature is extremely important to me.  To be able to express my preconditions (what I require), postconditions (what I ensure), my invariants (what state will change) is a pretty powerful concept.  Not to mention, to enforce immutability and method purity is also a pretty strong concept, especially in the times of multi-core processing.  More on that subject later.

Focus on Behaviors

What Spec# can bring to the table is the ability to knock out a bit of your unit tests.  Now, I don't mean all of them, but what about the ones that check for null values?  Are they valid if you already put in your method signature to require a non-null value or use the ! symbol to denote a non-null type?  Those edge cases aren't really valid anymore.  The ability to track your invariants is the same as well as your postconditions.  Instead, what that does is frees you up to consider the behaviors of your code, what you should have been testing anyways.

Immutability

Immutability plays a big part in Spec# as well.  To some extent, I'll cover more in a Domain Driven Design post, but instead will get some things out of the way here.  Eric Lippert, C# team member, has stated that immutable data structures are the way of the future in C# going forward.  Spec# can make that move a bit more painless?  How you might ask?  Well, the ImmutableAttribute lays out that explicitly.  Let's do a simple ReadOnlyDictionary in Spec#, taking full advantage of Spec#'s attributes, preconditions and postconditions:

using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Contracts;

namespace Microsoft.Samples
{
    [Immutable]
    public class ReadOnlyDictionary<TKey, TValue> : ICollection<KeyValuePair<TKey!, TValue>> where TKey : class
    {
        private readonly IDictionary<TKey!, TValue>! dictionary;
   
        public ReadOnlyDictionary(IDictionary<TKey!, TValue>! dictionary)
        {
            this.dictionary = dictionary;
        }
       
        public TValue this[TKey! key]
        {
            get
                requires ContainsKey(key);
            { return dictionary[key]; }
        }
       
        [Pure]
        public bool ContainsKey(TKey! key)
        {
            return dictionary.ContainsKey(key);
        }

        void ICollection<KeyValuePair<TKey!,TValue>>.Add(KeyValuePair<TKey!, TValue> item)
        {
            throw new NotImplementedException();
        }

        void ICollection<KeyValuePair<TKey!,TValue>>.Clear()
        {
            throw new NotImplementedException();
        }

        [Pure]
        public bool Contains(KeyValuePair<TKey!, TValue> item)
        {
            return dictionary.Contains(item);
        }

        [Pure]
        public void CopyTo(KeyValuePair<TKey!, TValue>[]! array, int arrayIndex)
            requires arrayIndex >=0 && arrayIndex < Count;
        {
            dictionary.CopyTo(array, arrayIndex);
        }

        [Pure]
        public int Count
        {
            get
                ensures result >= 0;
                { return dictionary.Count; }
        }

        [Pure]
        public bool IsReadOnly
        {
            get
                ensures result == true;
                { return true; }
        }

        [Pure]
        bool ICollection<KeyValuePair<TKey!,TValue>>.Remove(KeyValuePair<TKey!, TValue> item)
        {
            throw new NotImplementedException();
        }

        [Pure]
        public IEnumerator<KeyValuePair<TKey!, TValue>>! GetEnumerator()
        {
            return dictionary.GetEnumerator();
        }

        [Pure]
        IEnumerator! System.Collections.IEnumerable.GetEnumerator()
        {
            return dictionary.GetEnumerator();
        }
    }
}

As you can see, I marked the class itself as immutable.  But as well, I removed anything that might change the state of our dictionary, as well as mark things with non-null values.  That's a little extra on top, but still very readable.  I'll be covering more in the near future as it applies to Domain Driven Design.

Call to Action

So, the call to action is clear, make Spec# a priority to get it in C# going forward.  Greg Young has started the campaign, so we need to get it moving!

kick it on DotNetKicks.com
Joining the CodeBetter Community....

#light

type FullName = string * string

let FullNameToString (name : FullName) =
  let first, last = name in
  first + " " + last
 
let blogger = FullNameToString("Matthew", "Podwysocki")

I'm pretty excited to be joining the CodeBetter gang after following for so many years.  I want to thank Jeremy Miller, Brendan Tompkins, Dave Laribee, Greg Young and others for welcoming me to the fold.  No, this blog won't be going away, but instead will also serve as a host for my posts.

So Who Are You and Why Are You Here?

So, just to introduce myself, I work for Microsoft in the Washington DC area.  I'm active in the developer community in whether it be in the .NET space, Ruby, or less mainstream languages (F#, Haskell, OCaml, Lisp, etc).  I also run the DC ALT.NET group since the November timeframe of last year and helped plan the latest incarnation in Seattle. 

The number one reason I'm here is to help better myself.  Deep down, I'm a language geek with any of the aforementioned languages.  I'm one of those who strives to learn a language every year, but not just learn it, let it sink in.  That's really the key.  Sure, I can learn a certain dialect, but it's not quite being a native speaker.  That's how I can take those practices back to my other languages to try to apply lessons learned such as functional programming paradigms (pattern matching, currying, first order functions, etc).

I also have a pretty deep interest in TDD/BDD, Domain Driven Design and of course one of Greg Young's topics, messaging.  Right now in the world of messaging, I think we're in a pretty important time in the development world when messaging, multi-threaded processing and such is going to be more mainstream and hopefully less hard than it is now.

I'm also a tinkerer at heart.  I'm looking at testing frameworks to help make my TDD experiences easier.  I'm looking at IoC containers to help make my system just a bit more configurable.  I'll look at the tests to see how each one does what it is.  That's the fun part about it.

I'm also on the fringe with such topics as Spec# and Design by Contract.  I'd love nothing more than to see many of the things being done at Microsoft Research become a bit more mainstream and not just seen as a place where we might see something 10 years down the line.  Topics such as Spec#, F# and others have real importance now and it's best to play with them, give them our feedback and such.

So What Do You Want From Me?

Here's the thing, since I'm always looking to better myself, I'll need your help along the way.  I value your feedback along the way and hopefully we'll learn from each other.  Now that this is out of the way, time for more serious topics...

kick it on DotNetKicks.com
As I've said before on my previous blogs, I'm very much into F# and functional programming lately.  With that, I'm still in the mode of TDD.  Just because you enter a new programming paradigm, doesn't mean you throw away your XP and TDD roots.  Instead, I find it just as valuable if not even more so when switching to a new model.

xUnit.net 1.0 Goes Live

As Brad Wilson said earlier this week, xUnit.net released version 1.0.  You can read more about the announcement here.  Since the RC3 timeframe, it was pretty much feature complete, so there hasn't been much change since that time.  Instead, the focus was on polishing the existing functionality and including the integration with ASP.NET MVC, Resharper 3.1 and TestDriven.NET.  The GUI runner, such as it is has been pretty limited, but ok for most purposes. 

Many questions used to arise, why xUnit.net?  Why do we need yet another framework out there?  Why not just add onto the existing ones in the market?  I think with the 1.0 release, the critics in this release to do things a bit differently than MbUnit and NUnit have approached things.  For example, the Assert.Throws<TException>, not having to decorate the classes with [TestFixture] and a few other things come to mind as well as being very extensible.  It's a smaller framework, but I really don't have a problem with that.  With most of the other frameworks, I don't use half of it anyways.

So, why do I care as much as I do about this one over say others at the moment?  Well, it's great that we have such choices in the market now.  As Scott Hanselman said at ALT.NET Open Spaces, Seattle, he's a StructureMap, Moq and xUnit.net guy.   I'll get into the reason shortly enough.

The Traditional Way

When you think of doing your unit or behavior tests, you often need a class and decorate with attributes, have a initialize and teardown and all that goodness.  Since F# is considered a multi-purpose language, this works just fine.  That's the beauty of F# and hopefully will drive its adoption into the marketplace.  So, consider the following functions with the appropriate tests in a more traditional way such as NUnit within Gallio.  I am trying out Gallio so that I can see how well it reacts to F# as well as just kicking the tires.  I highly recommend you at least check it out.

Anyhow, back to the code.  Let's take a simple example of a naive routing table through pattern matching, to see whether a call is allowed or not.  Like I said, naive, but proves a point with pattern matching.

#light

#R @"D:\Program Files\Gallio\bin\NUnit\nunit.core.dll"
#R @"D:\Program Files\Gallio\bin\NUnit\nunit.framework.dll"

let FilterCall protocol port =
  match(protocol, port) with
  | "tcp", _ when port = 21 || port = 23 || port = 25 -> true
  | "http", _ when port = 80 || port = 8080 -> true
  | "https", 443 -> true
  | _ -> false
 
open NUnit.Framework

[<TestFixture>]
type PatternMatchingFixture = class
  [<Test>]
  member x.FilterCall_HttpWithPort8888_ShouldReturnFalse() =
    Assert.IsFalse(FilterCall "http" 8888)
   
  [<Test>]
  member x.FilterCall_TcpWithPort23_ShouldReturnTruee() =
    Assert.IsTrue(FilterCall "tcp" 23) 
end

Unfortunately of course for me, the Gallio Icarus Runner doesn't really work well for me at the moment with F# integration.  Instead, I get all sorts of issues when doing so.  This is where I get the large FAIL.



This seems to repeat itself unfortunately for the xUnit.net and MbUnit integration as well, so it's not quite ready for primetime in the F# space.  Also, when I exit the application, there is a Gallio session runner that keeps running in memory and therefore I can't perform any builds.  So, I have to manually go into Task Manager and kill the process.  Not the best experience I've ever had...  So, for now, the limited functionality in the xUnit.net GUI Runner works for me.

The More Functional Way

Instead, we see a lot of pomp and circumstance that we just don't need.  In the functional world, a lot of the time, we don't want or need to create these classes just to test our functions.  After all, most of what we do has no side effects or at least should be (and are code smells mostly if they are not, but that's another post for another time).

At the request of Harry Pierson, another F# aficionado and IronPython PM, talked to Brad and Jim Newkirk about adding static function unit test capabilities to xUnit.net.  And sure enough, we now have them, so let's compress the above code into something that looks more like F#.

#light

#R @"D:\Tools\xunit-1.0\xunit.dll"

open Xunit

let FilterCall protocol port =
  match(protocol, port) with
  | "tcp", _ when port = 21 || port = 23 || port = 25 -> true
  | "http", _ when port = 80 || port = 8080 -> true
  | "https", 443 -> true
  | _ -> false
 
[<Fact>]
let FilterCall_TcpWithPort23_ShouldReturnTrue () =
  Assert.True(FilterCall "tcp" 23)

[<Fact>]
let FilterCall_HttpWithPort8888_ShouldReturnFalse () =
  Assert.False(FilterCall "http" 8888)

So, as you can see, I compressed the code quite a bit from here.  Since I'm doing functions and nothing more with just some basic pattern matching, this approach works perfectly.  That's why I am a fan of this.  Open up the GUI runner or just the ever popular console runner, and run it through and sure enough, we get some positive results.



The interesting thing to see upcoming is how well the TDD space will play in the functional programming space.  I don't think it should be any different of an experience, but time will tell.

Where to Go?

From here, where do we go?  Well, I'm sure the GUI Runner of xUnit.net will get better over time, but the Gallio folks are pushing for the Icarus Runner.  Right now, only the xUnit.net runner works for me, so that's what I'm going to stick with at the moment. 

An interesting thought occurred to me though.  Are the unit tests we're doing mostly nowadays purely functional anyways?  Would it make sense to test some C# code in F# to produce cleaner code?  Not sure, but I like the idea of having that choice.  Or even for that matter, writing my unit tests in Ruby for my staticly typed C# code.  Within the .NET framework space, the possibilities are vast.  And that's the really cool thing about it.  But will we see an IronPython or IronRuby testing framework within the .NET space?

kick it on DotNetKicks.com
In my previous post, I talked about some of the happenings from the day two experience.  Day three was only a half day with only two sessions.  So, it was best to make the best of times anyhow.  Once again, it snowed again, rather heavily at times, so nature's cruel joke on ALT.NET.

Impromptu Sessions

One of the best sessions was an impromptu session with Jeremy Miller on the StoryTeller tool and his future plans for it.  If you're not familiar with it, it is a tool used to manage and create automated testing over the FitNesse Dot Net libraries and helps in an acceptance test driven development environment.  Anyhow, a number of us managed to corner him at one point during the day and sure enough he had his laptop available.  From there, we were able to encourage him to work on it some more as well as learn about where to go from where it is right now.  Jeremy covers more about it here.  Sometimes these impromtu sessions are some of the more valuable interactions to be had at events such as these.

More Video To Be Had

It seems that almost everyone had a camera at the event.  Greg Young and Dave Laribee managed to capture a bit of the sessions on video.  That's a great thing because I honestly wish I could have cloned myself and gone to more sessions.  Hopefully more of this will be forthcoming.  Dave posted Greg Young's fishbowl conversation on Architecture Futures which you can see here

Other videos that are on this list are from John Lam's IronRuby session, Udi Dahan with ScottGu and Chad Myers talking about Microsoft and Open Source Software and so on.  You can find them at the end of Greg's video.

Software Design Has Failed, What Can We Do About It?

Scott Koon, aka LazyCoder, convened with JP Boodhoo a session on how software design has failed us.  This turned into a fishbowl conversation as well since there was a lot to be said.  The basic points revolved around the large amount of software failures.  What causes them?  Are they technological issues?  People issues?  Politics?  Many people brought their opinions to bear, and it was interesting that the point that I brought is that at the end of the day, customer satisfaction is the metric that matters.  Are we listening to them?  In the Agile methodology world, customer satisfaction is the only metric.  Yes, we can talk about TDD/BDD, DDD and so on, but are we actually putting software into the hands of the user that they actually want?

I'm not forgetting of course the ideals around mentoring and helping make the team stronger.  Those issues are important as well.  Do we do pair programming?  Do we hold brown bag sessions?  All of those suggestions are key to helping grow a stronger team.  But, also it helps grow the team as a more cohesive unit that's not afraid to ask questions, pair up and avoid flailing.

F# and Concurrency

Roy Osherove convened a session on concurrency and functional programming as the last topic I was going to attend.  When we start to deal with multi-core environments, threading issues come to bear more frequently.  Are we utilizing the CPUs to the maximum or are we still just sitting on that one thread, and barely using the machine to its capacity?  Those are many of the issues we face.  In Software Engineering Radio Episode 14, Ted Neward talks to this very point quite frankly that multi-threaded programming is hard.  There are no two ways about it.  But, when we talk about functional programming, some of that is solved.  Why?  Immutability by default is one of the key strong points of FP.  Instead, you have to go out of your way to make a value to be mutable.  Is this something we'll see in C# 4.0?  Spec# has something to say about it.  And once again, another topic for discussion.  I keep putting these things on my plate...

Anyhow, Harry Pierson and I helped run this session.  Harry had some of his parsing code that he has posted on his blog to show off.  I think that did the trick well to show some advanced things such as high order functions, pattern matching, anonymous functions and so on.  Instead, if you wish to learn more, I'll probably cover it here in some detail, but you can check chapter 13 of Don Syme's "Expert F#" book to learn more in the mean time.

Action Items

Some action items came up from this event that I think are rather important.  Because ALT.NET is a community looking to improve itself, there are naturally some things that help.  Here are a few that I can think of:
  1. Keep the conversation going
    Just because the conference ended doesn't mean the conversations that started there have to.
  2. Start a local group
    After the session was done, the altdotnet mailing list came alive with people wanting to create that ALT.NET groups like I did in DC, Brian Donahue did in Philly and Jeremy Jarrell did in Pittsburgh.

  3. Support the community
    Ray Houston laid out a challenge for those who use Open Source products to donate to them.  This doesn't mean only money, but time as well.  Many projects are in need of some assistance, and all it takes is for someone to ask.

  4. Challenge Assumptions and Bring Change
    It was said best during the conference "If you can't change your job, change your job".  Don't let these discussions that happened here just stay there.  Bring them to your work place, bring change for the better.  Question why things are done the way they are.

Wrapping it Up

I'm glad to have been a part of this event in Seattle.  It couldn't have been with a better bunch of people who are willing to better themselves, challenge themselves and their assumptions and bring change to the developer community.  There was a lot to learn this past weekend and each conversation brought up a new angle.  Until next time...

kick it on DotNetKicks.com
In my previous installment of recapping the events from ALT.NET Open Spaces, Seattle, I covered pretty much the opening ceremonies as it were.  The weather was definitely interesting the entire weekend.  Who would believe that we had snow, hail and rain for most of the time we were there in the latter half of April?  Mind you it didn't stick, but if you believe in God, there is something to be said of ALT.NET coming to town.

Coverage Galore

Jeffrey Palermo was gracious enough to capture the opening ceremonies on video for all to see.  Here are some of the videos and they are well worth watching.  Really gives you an idea of how to run a good Open Spaces.  Doc did a wonderful job as a facilitator for the event.  And yes, that's me in the black coat in the background setting up for the event.
Dave Laribee also has a ton of video as well.  Most recently, the Fishbowl conversation about the polyglot programmer has been posted here.  The debate starts with Jeremy Miller, Ted Neward, Charlie Calvert, Scott Hanselman and others.  Really good conversation posted.
So, as you can see from the videos it was a pretty diverse crowd.  And, hey, we managed to get all of 5 women there too!  Peter Laudati posted the schedule here which was initialed by all who wanted to see that particular discussion.

IronRuby Session

Since John Lam wasn't around on Friday for the topic submittal, I so graciously put his name in for him.  Luckily he agreed so we were good to go for the first session.  We didn't have any canned presentations which is nice.  Instead, John focused more on how far IronRuby has yet to go.  It was interesting that he is using the Rubinius specs in order to validate IronRuby.  Also of note, it was pretty cool to see that Spec# has been used for the IronRuby compiler.

Covering Spec#

Unfortunately, the functional programming talk that I planned with Dustin Campbell was put right along side the Spec# talk, so I had to make a choice.  I picked Spec# as it was the first Open Spaces they had done.  As I said before, one of the major things I wanted to talk about was Spec# at ALT.NET.  Both Greg Young and I were pretty interested in getting Rustan Leino and Mike Barnett to show off the technology to the masses.  And what better way than to show a bunch of geeks like us this technology.  Anyhow, Mike and Rustan did a really good presentation to show off Spec# to a mass audience.  For those not familiar with Spec#, I did a whole series on this on my old blog here.  Basically, the intent of Spec# is to provide Design by Contract specifications in your classes and have that exposed to the outside world.  So, no more guessing about the preconditions, postconditions and invariants of your system, instead, we can be pretty explicit about it.

The problem that they are facing is that Spec# is not just an additive to the C# compiler, instead it's a separate compiler that is compliant with the C# 2.0 specification.  The problem is that C# 3.0 introduces a few more items, albeit mostly syntactic sugar for the most part, and yet Mike is really one of the only guys doing the Spec# compiler.  So, making it C# 3.0 compliant is a pretty daunting task.  Instead, a future focus is on making language neutral pieces available to all .NET languages just as we saw briefly in the System.Core.dll assembly under the Microsoft.Contracts namespace.  The point of inviting them was to help bring their cause to a wider audience.  Anders Hejlsberg and Mads Torgersen need to put this on their mind as to how to incorporate, and I'll make sure it's widely known.

It was great to see Scott Hanselman quite excited about the technology and hopefully you'll see more of it from him soon.  Also, stay tuned to InfoQ for more Spec# related items as well.  I intend to cover things again shortly to talk about some other new things in Spec# as well as the new release.  Stay tuned for that...

ASP.NET MVC

Phil Haack and Brad Abrams hosted a discussion on ASP.NET MVC which was pretty positive overall.  There has been a number, around 5% that Microsoft has been throwing out there as a number of people that would be adopting ASP.NET MVC over traditional web forms.  The audience was rightly skeptical of such a number and wish that they would cut it out.  Instead, it could have the effect of scaring away people from adopting this framework as their choice for ASP.NET web applications.  I can totally understand that the numbers could be there due to the ISV market which make controls for ASP.NET web forms which is something that the MVC framework doesn't support.  Another request was to support open source javascript frameworks better.  But overall, Phil and Brad were pretty receptive and it was an overall positive experience.

Are We Innovating?

Scott Hanselman convened a talk asking "Are We Innovating or Are We Just Porting?" in which that very question was asked.  If you look at the open source frameworks that exist within the .NET space, it's not hard to see what he's talking about:
  • JUnit => NUnit, MbUnit, xUnit.net
  • Hibernate => NHibernate
  • Spring => Spring.NET
  • Ruby on Rails => MonoRail
  • jMock => NMock, Rhino Mocks, Moq
  • Ant => NAnt, MSBuild
  • And the list goes on...
But when you look at the list the other way around, we really don't see it going the other way.  Is it because that in the Java world, frameworks weren't provided by Sun as they were for Microsoft?  Or was it something else?  The answer of course isn't easy and maybe it's not in the frameworks area that we need to look.  For example such applications as Paint.NET is truly innovative in my opinion.  I wouldn't have half the picture content on this blog as easily without it.  Also, some open source blogging engines work quite well as well.  So, there is innovation, but if you look to recent times, have we caught up?

To Be Continued...

kick it on DotNetKicks.com
Now that we've somewhat recovered from ALT.NET Open Spaces, Seattle, it's time for another DC ALT.NET meeting.  I'm currently finishing up my wrapups for Seattle still and I'm sure I have months worth of material from there.  Anyhow, this time Jay Flowers will be talking to us about Continuous Integration and CI Factory which was postponed from last month due to schedule conflicts.  As always we have the first hour or whenever the conversation ends for our main topic and the rest is Open Spaces.  Food will be served as well.

Below are the details for the meeting:

Time:
4/23/2008 - 7PM-9PM

Location:
2201 Wilson Blvd
Arlington, VA 22201

Parking/Metro:
Best parking on N. Veitch St
Courthouse Metro the best bet

As always you can find out more by joining the mailing list here.  Hope to see a great crowd there and to continue some of the great discussions that were held in Seattle.  Until next time...

kick it on DotNetKicks.com
ALT.NET Open Spaces, Seattle has come to a close.  What a great time it was and it met every expectation if not exceeded them.  Currently I'm in the Seattle airport waiting for my flight home which just got re-arranged.  Anyhow, I'd like to wrap up my thoughts for the first day of the event.

Setting It Up

I arrived one day early for the event to make sure we were set up appropriately.  I was able to meet up with Dave Laribee, Glenn Block, Scott Bellware, Jeremy Miller, Greg Young, Scott C Reynolds, Ray Lewallen, Patrick Smacchia and others.  Everyone was already burned out from the MVP Summit, so I wasn't sure how well people would be for the event.  But it was great to talk to Sam Gentile and I'm glad he's back in the fold with ALT.NET as he announced earlier last week here

Even though a lot of people were tired, we had plenty of help to set up for the event.  Of course the joke is that "How many ALT.NETers does it take to go to Costco?"...

Kicking It Off

One couldn't ask for a more prepared and outstanding facilitator in Steven "Doc" List.  What an amazing job he did to bring the Open Spaces together.  The event started with a description of Open Spaces Technology.  if you're not familiar with the Open Spaces, Technology Format, here are the four basic principles:
  • Whoever comes are the right people
  • Whatever happens is the only thing that could have
  • Whenever it starts is the right time
  • When it's over, it's over
With that getting kicked off, we then laid out the pens and sticky paper to write the sessions.  The idea is to write down your idea on the sticky paper and then get to the middle of the room and announce your talk that you will facilitate.  Of course some subjects may be very similar and can be combined, which happened quite a bit actually.

The Sessions

I met with Mike Barnett from the Spec# team who was one of the many people I had invited to this event.  Spec# as you may have figured from my blog is a passion of mine.  It is one of my goals to publicize it enough and to make sure that people are aware of this wonderful technology that the product teams such as Mads Torgersen and Anders Hejlsberg notice.  Anyhow, Mike went up and announced a session on Spec# and static verification.  I'll cover more of that in subsequent posts again.  Start your letter writing campaigns now!

Dustin Campbell also was in attendance and he and I chatted about F# and doing a session on functional programming and F#.  It was going to be a great session, but unfortunately when the schedule was finalized, I couldn't possibly attend the Spec# and functional programming and F# talk.  I was a little disappointed by that, but luckily Roy Osherove suggested a talk about "Concurrency and Functional Programming" which I was more than willing and able to help out on. I also pulled Harry Pierson, the new Program Manager for IronPython to help in such a session.

Since John Lam wasn't in attendance that night, I volunteered him for a session on IronRuby and the DLR which he was more than happy to oblige.  We scheduled that for the first session on Saturday.  I'll cover each of these in detail in subsequent posts. 

The Fishbowl

From there, we went to a fishbowl style conversation in which there are a number of chairs in the middle of the room.  There must be all but one of the chairs filled at any given time.  Any person may in turn come and take a seat and another person must leave to keep the balance.  The discussion started with Scott Hanselman, Ted Neward, Charlie Calvert and Martin Fowler talking about the Polyglot Programmer.  Ted Neward couldn't be there for the whole event, unfortunately as he was also doing No Fluff Just Stuff this weekend as well with Venkat Subramaniam, Neal Ford and others.  Luckily I got some time to talk to Ted about some F# related items as well as his upcoming trip to Reston, VA for No Fluff Just Stuff next weekend.  So, if you're in the area and interested in seeing Ted and Venkat, that's the place to go!  But anyways, the event was great and a lot of people pitched in.  There are so many to name, I'd just run out of space.

To Be Continued....

kick it on DotNetKicks.com
Well, the day has finally come where I'm heading to ALT.NET Open Spaces, Seattle.  It's been a long time of planning for this day with all the other guys mentioned on the site.  The weather's not looking so great with a possibility of snow on Saturday.  Not looking forward to that part as I'm leaving sunny, beautiful Washington DC where it is around 75F or so right now.

I hope to be live blogging much of the event, well as much as I can.  I you're on Twitter, you can follow me at mattpodwysocki.  Looking forward to seeing everyone there!

kick it on DotNetKicks.com
More Posts Next page »