private override


Making the ‘using’ statement, more usable

I've felt the pain of having the using statement not being able to return a value before, and just chalked it up to a limitation of the language.

I never considered trying to find a better way, and usually ended up with something like:

void DoSomething()
    XmlDocument xml = new XmlDocument();
    using(var reader = new StreamReader(@"c:\somexmlfile.xml"))

    // do something useful with xml


void DoSomething2()
    XmlDocument xml = new XmlDocument();
    using( var reader = new StreamReader( @"c:\somexmlfile.xml" ) )
        xml.Load( reader );
        // do something useful with xml

Neither of which particularly suited me. Because

  • First example: Declaring the variable outside the scope of the block feels weird
  • Second example: Performing whatever operation inside the using block, means the file (or other resource) doesn't get released until the operation has completed.

After Shawn mentioned something about this at his Indy Alt.Net Clojure talk, I started thinking about it a little bit, and then I had a real need for it (again), and decided to come up with something better.  Turns out what I wanted was blatantly simple.

TResult UsingReturn(TDisposable toUse, Func func)
    where TDisposable : IDisposable
    using (toUse)
        return func(toUse);

Now the above example turns into:

void DoSomething3()
    var xml = UsingReturn( new StreamReader( @"c:\cdf.xml" ), reader =>
                    var doc = new XmlDocument();
                    doc.Load( reader );
                    return doc;

I'm not sure where this thing should live (e.g. some static utility class, extension method on IDisposable), or even what it should be called.  Any ideas?


indy call for speakers!

This doesn't really have to be tightly coupled to indy, its really about general evangelization (did I just make that word up?... eh, sounds right), but this started out as an email from me to some folks here in our indy tech community to see if we can get some good quality content coming our way.  Feel free to replace (in your brain) Indy Alt.NET with "Technology X", or "User Group Y"

I know, as soon as you read the title for this, your brain started making up excuses why you wouldn't ever be able to contribute to a group in this way.  Believe me, been there, done that. Get. Over. It! Here is a list of your excuses, and reasons why they're not valid.  If you have any other excuses I missed, I'd be glad to tell you why its invalid as well ;)

  • Excuse #1: I don't have a good story/content.
    • FALSE: You almost certainly know something intimately that none of the rest of us know.  We are all thirsting for information, do us a favor and share it with us!
  • Excuse #2:  I'm not an expert on anything.
    • DOESN'T MATTER: What a coincidence!  None of the rest of us are either!  Just remember, "there are no smart guys, just us"... that includes you!  If you REALLY don't know anything cool enough to talk about... go spend 10-20 hours learning something new/cool, distilling it down to 60 minutes so we can all leech off your brain.
  • Excuse #3:  I'm scared/anxious/have issues talking in front of people/etc.
    • GREAT!: What better way to practice than in a small intimate setting with a few of like minded peers?  This is a great opportunity to learn new things, and step out of your comfort zone to grow personally and professionally.
  • Excuse #4:  I suck at PowerPoint.
    • ALL THE BETTER:  I, personally, would rather see code than PowerPoint any day.
  • Excuse #5:  I don't know .NET very well.
    • AWESOME:  We don't necessarily care about .NET (our speaker last night is a non-.NET dude!).  Our main goal is continuous improvement, and the practices and principles that will make us better.

I'd like to invoke a few loosely translated Fight Club Rules on us.
Rule #1:  You don't talk about fight club.
Rule #2:  You don't talk about fight club.
Rule #8  If this is your first night at Fight Club, you have to fight.
Rule #1:  You must talk about Indy Alt.NET
Rule #2:  You must talk about Indy Alt.NET
Rule #8:  If you have not presented before at Indy Alt.NET, then you have to present (sometime, not necessarily this upcoming time, I won't hold you to it like Mr. Durden would).


indy – team roles fishbowl

We're having another Indy Alt.Net ( meeting tonight!

The topic is on team roles. We're planning on having a

  • BA - Sorry A-Team fans, this is a Business Analyst, not Mr. T
  • Developers - All who serve at different levels in their own organizations
  • PM - [Hopefully] If you're a PM, and can come, please do, we need you!

The goal is really just to have good conversation about different roles in different organizations so we can all learn something by the way other organizations behave.

As usual, free pizza and networking starting at 5:15, with the talk starting at 6:00.

Tonight (October 16)
6:00P - 8:00P (food and networking at 5:15)
Ivy Tech near Fall Creek and Meridian on the north side of Fall Creek
Auditorium, 4th Floor 50 W Fall Creek Pkwy North Dr
Indianapolis, IN 46208

Hope to see you there!


Going Medieval on Your App with Castle MonoRail – Indy ALT.NET

So last night I gave a talk at Indy ALT.NET on Castle MonoRail.  It was really just a sort of intro to MonoRail type of deal, but the cool part was that we held a Dojo after I got done jabbering.

We ended up building a Poll Generator for our dojo activity.  We almost got done in the 45 minutes or so that we dojo'd.  It was a pretty fun activity, and I'd like to do it again sometime soon.

Also, this was really my first public speaking engagement to our technical community, and let me say it was a blast.  Everyone had great things to say, and many great questions were asked too.

I set up a google code repository so you can grab my slidedeck and grab the source for our dojo activity and my demo app.

Maybe next time I'll post before the talk, so I can let people know about it.

Thanks guys for all the great feedback, and thanks to my wife for understanding why I wasn't spending any of my evenings with her this week!



The inaugural indy meeting was last night!

The group appears to be led up by jaxidian/Shane Milton of Leaf Software Solutions.  Many thanks to Shane for getting this group together!  I think this is an awesome opportunity for our community to learn how to be more receptive to alternative thinking in a .NET world.  I have heard of so many shops that have their blinders on and won't even consider working with frameworks/etc. other than those provided by Microsoft.  This can only be a true blessing to our community and where we are going as craftsmen.

Don't get me wrong, I'm not dissing Microsoft, they make world-class software.  The problem is that we need to be careful to always use the best tools that serve us in any given situation, rather than using only the tools that we are told to use via the mothership.

Last night's discussion was led by one of the co-founder's of Entity Spaces.  Their product, Entity Spaces, is a code generation based ORM tool.  I'm very familiar with the concept, but haven't had much of an opportunity to use many ORM's other than ActiveRecord in a Rails project I worked on, so I'm not sure how the usual suspects (NH/ActiveRecord, Linq2Sql, Linq2Entities, SubSonic) add up in a real implementation scenario, but it's at least worth thinking about.  Maybe I'll do a write up or try to find a comparison.

Also, many thanks to Tridge Alliance for their financial support of the group.

All-in-all, it was a great inaugural meeting.  I am sure we'll only continue to grow and get better.  If you're reading, and are in the area, and feel like you're missing something (sort of like Neo, ya know?) please come and see what we're all about!  We meet the third Thursday of every month.  Check the website for more info.

I'm stoked!  Let's make our tech community a better place!