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

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

April 2008 - Posts

  • Agile Antipatterns discussion

    From the Java side of the world, a dead on discussion on Agile Anti-Patterns.  Been there, done that, gotten the tee shirt.  I think I'd add:

    • Overly long stand up meetings and/or iteration planning meetings
    • Contention in iteration meetings
    • Not doing retrospectives or not acting on retrospectives.  It's easy to skip when you're under duress, but you shouldn't.
    • Not doing estimation together
    • Not getting concrete acceptance criteria for a user story
    • Not pushing completed stories to testing until late in the iteration
  • A Train of Thought -- ALT.NET Seattle Edition

    Yeah, I'm a week late with this recap, but I've had writer's block.  The Seattle ALT.NET Open Spaces event was awesome.  The open spaces format is by far and away my favorite format now for developer gatherings.  I love the interactive aspect of this format.  We jumped right into a great set of topics without getting hung up in useless, angsty "What is ALT.NET all about?" discussions.  I love catching up with people that I've met at other conferences and meeting more of my blogroll.

     

    Ready or Not, Here comes the Polyglot Programming Reality

    A major topic in Seattle was the Polyglot Programming trend (I know it was a big topic because I have a lot of notes that I can't read under the heading "Polyglot *********").  Right now there seems to be an explosion in new programming languages or at least interest in different programming languages. 

    There was a lot of discussion both about doing some or all project work with alternative languages like F# or IronRuby when it hits.  The general idea being that you would probably write infrastructure code in C#, then use a more dynamic language like IronRuby for business logic and "glue" code in the upper layers.  More on this later, but I think it's somewhat comical that we're calling C# the infrastructure language when a few short years ago it was C++ for infrastructure and C# was the high productivity language in the upper layers.

    Would you mix languages on the same project, and if so, is that a good thing?  There were a lot of mixed opinions on this subject.  On one side is the fear that multiple languages will make a system harder to understand and require more skilled people to work on the system.  Then there's the other side that thinks we'll get more productivity by having multiple languages that are specialized for certain tasks.  Personally, I know I'd like to be able to easily mix and match C# and IronRuby on projects.

    Complicating the discussion is the idea of little Domain Specific Languages that aren't even remotely Turing complete.  To this point, I've been mostly interested in internal DSL's using Fluent Interfaces in C#.  I look at that technique as merely a stopgap until we get IronRuby and its far superior language support for DSL's.  The next bit of evolution is dabbling the toes into creating an external DSL.  I've always been leery of trying out some sort of lexical parser ala YACC or ANTLR, but the Language Workbench idea coming from the JetBrains MPS product is very intriguing.  Imagine being able to write your own focused mini-language for test automation or configuration without losing Intellisense or basic refactoring.  That's what the Language Workbench products will eventually do for us. 

    There's a rumor that Microsoft might be interested in creating some sort of Language Workbench as part of their DSL efforts.  Thumbs up from me, but please don't ruin it by making us use XAML.

    Before you panic about the difficulty in learning new languages, think about this:  is a tightly focused mini-language DSL going to be any harder to learn than the equivalent new API in C# or VB.NET?  In many cases I'd argue that an internal DSL is preferable to an old fashioned API in C#.  Web programming with HTML and CSS was brought up as an antipattern because of the 3+ languages you have to know to develop.  I'd turn that around and say that web programming is a great example of polyglot programming.  Try to imagine what the C# equivalent would be like for replacing HTML and CSS.  I think I'll take HTML and CSS, thank you.

     

     

    Quick Hits

    These should be on Twitter but I just feel weird shooting these things out in 140 characters at a time.

    Code Generation versus Code Synthesis.  I think that one of the big debates in software development over the next couple years is going to be over pursuing better productivity through external tools like software factories and large scale code generation or by using different programming languages (I.e. not Java/C#/VB.Net) that have facilities to write much less code.  In this corner is Kathleen Dollard on Code Generation.  And in the far corner is Venkat Subramaniam on Code Synthesis (using Metaprogramming and language oriented programming to pack more punch with less code).  I'm with Venkat on this one.  Why do I want to muck with a separate model outside of code, then run the code generator if I can work at the same high level directly in the code itself?  Of course, to be a loud debate, the two sides of the issue would have to know that the other side even exists.  Today, code generation probably seems like the default choice in .Net development because we don't have programming languages that support Venkat's vision of Code Synthesis.  When IronRuby, IronPython, and F# are ready for production, Code Synthesis in the .Net space can be a reality.

    Microsoft employees are a little too cloistered for their (our) own good.  Not all mind you, but many of the blue badges I interacted with didn't have very much prior exposure to many of the topics that come up frequently in ALT.NET settings.  I get it, it's a big campus full of smart people and you're probably heads down on your own project.  Case in point, in ALT.NET circles we seem to be much more enthusiastic about Language Oriented Programming with textual DSL's (or at least that's my position, preference, and observation).  In Redmond, DSL == graphical tooling backed up by code generation.

    After this weekend, I really think the concentrated blogging communities like Los Techies, Elegant Code, and yes, CodeBetter, are a very positive thing.

    Why are teams still writing persistence code by hand?  There's a bazillion persistence tools out there that all save development costs in some way over writing data access code by hand.  With very few exceptions, I'd say that at this point that if you're writing ADO.Net code or SQL by hand, you're stealing money from your employer. 

    I wasn't there, but there was a session roughly titled "Are Auto Mocking Containers Evil?"  I had this argument a little bit with Scott Bellware the other night, but it came down to a problem with wording.  He heard the word "container" and had awful images of Xml configuration hell.  All an AMC does for you is look at the constructor of a concrete class and use Dependency Injection to stuff in test doubles for all of the parameters in the constructor function.  I'd urge you to approach an auto mocking container (AMC) as simply a tool to reduce the mechanical cost of setting up interaction tests.  I initially resisted the AMC idea because I thought it would obscure the unit tests, but I'm sold on the AMC technique after using it for awhile on a project.  A class with a lot of collaborators is a code smell, but remember that code smell doesn't automatically mean there's a problem.  Some Controller-type classes do absolutely nothing but coordinate other classes.  Unit testing those classes will require two or more mocks in a single test.

    I seriously think you should seldom use your IoC container inside unit tests.  The mass majority of interaction unit tests should be easy to set up with pure DI.  I say this for two reasons.  First, the IoC container is infrastructure code and you want as little code as possible directly coupled to the container.  Second, using a container inside of a unit test greatly ratchets up the risk of test data from a previous unit test polluting the results of a later unit test.  Unit tests need to be isolated for effectiveness, and using an IoC container in unit tests can easily abrogate that isolation.

  • StructureMap and StoryTeller plans

    Just a quick update on stuff because I got a lot of questions about StoryTeller over the weekend.  I'm currently focusing my attention on StructureMap.  I'm giving it the Python 3000 treatment and pretty well gutting some of the internals to clean up the structure.  I've eliminated some obscure features, but you're perfectly safe if you use the documented public interfaces.  Once that's done, I've got just a little bit more functionality to add and I need to rewrite the documentation.  I gave an impromptu (and it showed) session at ALT.NET Seattle on my lessons learned for extending a framework over 4+ years.  I'll write a paper of some sort on that this spring.

    As for StoryTeller, I got quite a bit of interest in it over the weekend and I've had a couple emails lately as well.  I was close to giving up, but some of the things on the horizon that I thought would eliminate its usefulness turned out to be Java only or so far over the horizon to be effectively nonexistent.  The engine such as it is has been done for almost a year.  I'm going to rewrite the skin of the UI in WPF just to get my hands a bit dirtier with WPF.  I've done enough experimentation with some crude Intellisense for Fit tests to say that I'll be able to make Fit test editing much more efficient.  I'll update again later this spring.

  • A Train of Thought -- MVP Summit 2008 Edition

    Just jotting down my notes from the MVP Summit (so I can get on with ALT.NET commentary).  I haven't seen anything revolutionary, but the conversations are always the best thing anyway. 

    I'll sum up the entire summit in one word:  positive.  I thought that the interaction I saw with Microsoft was simply positive across the board.  Not perfect mind you, but I'm content.

    Here's what I saw (no names and some specifics omitted for NDA compliance):

    • I'm still not thrilled with the Entity Framework and the direction they locked themselves into, but the EF team came prepared to talk about some compromises that might start pushing EF into the usable category for me.  I honestly wouldn't care about the EF, but I'll probably be back in consulting at some point in the next 5 years at a shop that will only use Microsoft tooling.
    • Daniel Simmons gets the "Thickest Skin of the Year" award.  Not the Hyperion/Endymion Dan Simmons though.
    • I enjoyed the IronRuby and IronPython talks
    • The Parallels extensions to .Net are intriguing, but I wish they'd shown more code and fewer slides
    • A version of the Open Spaces format was used for some of the MVP Summit.  It wasn't the real deal, but I'd say that it was an improvement.  I really appreciate the more interactive formats as opposed to passive watching the slides go by talks.
    • Getting asked for some real feedback.  Ayende & I got to see behind the curtains on some internal work in the .Net framework that I was pretty happy about.
    • I did hear about one thing in the works that has the potential for some community backlash, but they seemed to be interested in reaching out to defuse that backlash.
    • The language teams are very serious about ramping up the coding centric features in the Visual Studio IDE.  I know a lot of .Net developers think that Visual Studio is the greatest thing since sliced bread, but it's coding features badly lag Eclipse or IntelliJ from the Java world.  It's nice to see Microsoft starting to work on that gap.  I don't know if they'll do anything that isn't already in ReSharper, but I'm looking forward to seeing where they'll go.
    • Listening to no less than Brad Abrams say that they're taking testability into consideration on all .Net framework design now.  Cool.

     

     

    What I want for Christmas from Redmond

    • IronRuby!  Even without Rails, I'd love to use RSpec for testing .Net code and writing specs.  DSL construction on the CLR, here we come!
    • I don't know if it'll ever catch on, but F# looks seriously cool
    • Transparent lazy loading in the Entity Framework.  If they want the Entity Framework to be usable in constructing rich Domain Models, they're going to have to do this. 
    • A hook in the Basic Class Library to make the choice of IoC container pluggable.  I think it makes a lot of sense for the .Net framework to have some sort of IoC container capability built into the framework, and you know they're going to do it at some point.  Acropolis needs it.  Prism needs it.  MVC needs it.  Heck, even plain jane WPF could use it.  Just please make it pluggable when you do that at some point in time.
  • Rightsizing your approach

    My last post, I might be an elitist, but you're a misanthrope, has kicked up a great conversation in the comments.  There's one viewpoint in the comments that I'd like to challenge a little bit. What if I'm working on small projects with very tight timelines?  Many of the subjects that fall under the ALT.NET umbrella of interest like IoC, ORM, and AOP wouldn't seem to be justified on a smaller project.  Fine, maybe not, but the more basic design fundamentals that ALT.NET is also championing definitely apply to every project longer than a couple hours.

    I've seen plenty of systems that were negatively impacted by code quality or a miscast application architecture.  Roughly, I'd say that the two worst type of offenders fall into two general camps:

    1. Overengineered.  Way too many abstractions that didn't add value but did add complexity.  Some of the problem is just creating the wrong abstractions and the wrong model, but much of that could be explained by using the tools from a large, complex development project on a smaller project where the tools weren't justified.
    2. Underengineered.  Brute force coding with little or no thought for abstraction or layering.  By only using simplistic techniques or straight up procedural programming you may be writing way too much code and exerting too much energy.  On a larger project finding the pertinent code can be a major challenge in its own right.  Just throwing all the code into a bag full of very large coding modules isn't going to scale.  The danger to me in that "just Git'R Done" mentality is the fact that that attitude fails when you hit a bigger project.  The biggest mess of a system I've ever encountered was a VB6 COM(+) system that began its life as a prototype and was rushed into becoming the shipping automation system for a Fortune 100 company.  Typical circa 1998 VB6 methods of code construction didn't scale to a system with 250,000 lines of code.  Sometimes you need to reach for the more advanced techniques. 

    Admittedly, most of the biggest and craziest messes I've seen (including one of mine) fell into the first category, but the "under" category is just as much a source of wasted effort in software development today -- even on smaller projects. 

    Most of us live under unreasonable timelines and expectations (do remember that Agile project management was partially created to give us a saner control over those very expectations).  Yes, I think that the scale of smaller projects and problems doesn't justify many of the same design patterns that I'd call mandatory on a larger project.  I've reviewed several smaller solutions lately that were churned out in a hurry.  In many cases I found places where the author of the code just plain wrote too much code.  There were opportunities to pull out commonality into shared code (Don't Repeat Yourself).  Using the Composed Method pattern would have made the code much easier to follow when that code needed to be modified 6 months later.  IoC/DI/AOP/DDD wouldn't have been very useful in these projects, but a true working competency with OOP fundamentals would have cut the effort required to execute these projects.

    My only point is that even small and quick projects can benefit from developers with a better skillset and knowledge.  At a bare minimum, just knowing about existing libraries for common tasks would be helpful so you spend time solving the actual problem instead of rewriting log4net (true story) or wasting time writing ADO.NET code by hand (I honestly think I can use NHibernate easily enough that I would still use it on small projects).  Even simpler projects need to be approached from a "Work smart, not hard" perspective.

    To this quote from Andrew Tokely:

    Should an application that has to be built in a month, will only be used by a handful of people, that will be rebuilt by something newer and better within a year or so, that doesn't have complex workflow or business logic, that really only needs to persists data back to a datastore... really need to contain the level of abstraction and testability of other projects?

    No, the system he describes doesn't need quite as much abstraction and layers and whatnot.  Testability in some ways equals "the ability to quickly gain feedback on the correctness of the code," so yes, you definitely want "Testability" in order to work efficiently at any time.  In the case of a smaller system just pressing F5 might achieve the goal of quick feedback just fine -- but if F5 isn't enough feedback, you do need to care about "Testability" in design.  Duplication of code, verbose code, and poor structure can still hamper even the smallest, simplest application in a way that detracts from your ability to execute in a timely manner.

  • I might be an elitist, but you're a misanthrope

    I've been in Seattle the past week, first at the MVP Summit and now at the ALT.NET event.  It's been good to rub shoulders with folks from outside our little ALT.NET cocoon to hear other points of view, but there's a particularly common refrain that bugs me a little bit.  It goes something like "that's great and all for you alpha geeks, but what about Joe Schmoe corporate developer at BIG CO?"  The obvious implication is that the average .Net developer just isn't capable of grokking things like OOP fundamentals and some of the coding techniques we use in Agile development.  My pre-canned response is generally something along the lines of "if they can truly understand the page event lifecycle in ASP.NET WebForms, they can learn anything!"

    In all seriousness, every shop that I've worked in or with that cared about the strength of their people had plenty of strong people.  Some of that was due to hiring practices, but a lot of that can be attributed to a culture that enabled and encouraged developers to get better and learn new things.  I think there's a little bit to the idea that people perform up to or down to the expectations placed upon them.  If you really say to a developer that I think you should know some design fundamentals, I think the average developer would very quickly know those design fundamentals.  I'd really like to see the .Net community as a whole start to be a little more optimistic about the abilities of the average .Net developer so we can get on with the business of getting better collectively.

  • See you next week in Seattle

    I was originally only going to the ALT.NET event in Seattle next weekend, but now it looks like I will get to attend the MVP Summit as well.  See you there! 

  • Things really are changing in the .Net community

    Check out this article about the rationale for the ASP.NET MVC framework on Dr. Dobbs.  Absolutely nothing you haven't heard before, but it's written by Dino Esposito.  It's fine and all to hear this sort of thing from ALT.NET leaning outliers, but Dino Esposito is virtually Mr. Mainstream in the .Net developer community.  Cool.

  • So what am I doing for my first week of blissful unemployment?

    I sat down this morning with my notes for the StructureMap 2.5 release to reacquaint myself with the remaining work I wanted to do before the release.  I wanted to just work through the punchlist, but this irresistible voice started saying "rewrite the InstanceMemento/MementoSource mess."  So apparently, the answer to what I'm going to do today and tomorrow is "rewrite a significant piece of the StructureMap core code that's accumulated trash code over 4 years."  The usage of the tool and what I want it to do is so different from where I started in the summer of '03 that it's amazing that that code lasted this long.

    Before I even start, let's say hooray for Subversion and automated test coverage, cause I bet there'll be some misfires along the way.

     
    That's step 1.  Step 2 is to take the family to the San Antonio zoo on some random day during the middle of the week.  Life is good.
     

  • The unmentionable subject

    I've been accidentally cut off from the altdotnet discussion group over the past couple days and I wanted to catch up this morning.  Unfortunately, the first thing I see is a conversation about to Stored Procedure or not.  Not gonna join in or even going to read.  There's been absolutely nothing new written or thought about the subject of sproc's for years.  I'm happy to agree to disagree with the sproc advocates and peacefully go on our separate ways.  There was something in the water about 3-4 years ago that allowed some of us in the Microsoft developer camp to convert away from sprocs, but those conditions are apparently gone now. 

    Just let it go.

  • I'm a free agent

    I quit my job today, and it's been one of the best days I've ever had.  It's felt like a large weight lifting off of my chest.

    EDIT 4/5/2008:  Chad & I are still getting some nasty emails, so I've removed everything that could possibly give our former boss anything to complain about.


    Anyway, no worries on my account, this couldn't have possibly have happened at a better time personally, and I've already had some good looking leads and a very positive interview earlier today.  If you're interested in engaging a Shade Tree Developer for short term consulting, feel free to drop me a line.  I've got to go permanent at some point before August (mortgage lender wants me to be a perm), but I'd really like to try the solo thing for a little while.  I've got some downtime, so I might finally get to finish some side project work.

     

    I might even manage to start answering emails in a timely manner.... 

More Posts

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP