Matei's blog

Confessions of Mort

About the author

Author Name is someone.
E-mail me Send mail

Recent posts

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sustainable development

Why is it that many development shops still do not practice agile? What makes adoption so slow even today after so many successful projects? There are countless evangelists out there preaching and demonstrating the practices yet it seems that the old ways of waterfall like development are anything but numbered. Even worse, there are plenty of shops out there that claim to practice agile, and ignore some of the most basic principles – first one that comes to mind is continuous improvement. Ever dodging that post mortem, perpetually avoiding those tough questions – are we delivering value to our customers? Is our software maintainable, flexible, can it respond to the clients rapidly changing needs, particularly in this difficult economic climate?

A small startup will wither and die if they’d be providing these subpar services to their customers. Some large corporations, unfortunately, seem to benefit from inertia and continue to do business as usual. Are their customers not demanding enough? Do they continue supporting them in hope that one day they will get what they pay for? It can’t be the customers, after all our services haven’t been an astounding commercial success.

I’m not even sure where this was going. Suffice to say I’m a string believer in sustainable development.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,
Categories: Rants | Agile
Posted by mateid on Tuesday, March 31, 2009 12:14 AM
Permalink | Comments (0) | Post RSSRSS comment feed

TDD and I

This is a re-take of one of my posts to the ALT.Net Google group. Probably a little of topic so I just want to capture it here, for future reference.

I'd like to throw in my two cents. I'm a TDD noob, so it might be relevant in this context. The point of the lengthy story that follows is that you can only lead a horse to water, as one of my colleagues likes to say when we discuss taking over the office with TDD. If one is not open to exploring new ways of doing things and discounts it right off the bat, no progress will be made. You can cite all the papers in the world, studies and research and successful projects, give examples, they will all be attributed to flukes, better funding, better building, better chairs, etc. People naturally resist change, and it will be rationalized in new and interesting ways all the time. I think the gap is not something the ALT.NET community can bridge. Each developer must try it first hand to experience the benefits. And try hard, because it’s not easy. For me the TDD showdown happened privately, I was both the TDD-er and the non-TDD-er.

That being said, big thanks go out to the folks on this board, and others, who’ve paved the way for me to become a better developer. I don’t think we’d be where we are now if it weren’t for huge contributions from guys like you. And for what it’s worth, I think the ALT.NET movement is doing a great job of moving forward the .Net world, and promoting continuous improvement. Read no further unless you have time for a rant.

I've been trying to promote TDD at work for the past few months. I've spent a lot of my personal time actually doing it to get hands on experience, scoping out different open source projects to get a feel for it (good vs bad unit tests, mocking, etc.) Here's one of the things that struck me in the learning process. I've been reading a lot - generally I agree with the literature on the benefits of TDD, but I was somewhat skeptical about the practical aspects - and accumulating a lot of theoretical knowledge. Still, when time came to write my first test I felt none the wiser. Complete writer's block – huh, where do I start kind of thing? So I've stumbled and tried and Googled and things started working together. I was pretty happy with the way things were going. Then I ran into things that needed testing that were doing a bunch of file manipulations. Uh oh, very unpleasant, no interface in sight in the System.IO namespace so no mocking. Gave up on TDD. Time passed, and I got uncomfortable with the lack of feedback. Yes, that is when I realized first hand that TDD was giving me something other than a bunch of asserts I could run and tell that everything was ok. Started TDD again, wrote wrappers for the System.IO part and wrote some integration tests on top of the unit tests to verify the files are handled correctly (I’m still not sure if this was the way to go, but it works pretty well in practice) and I was happy again.

A big moment for me was when I tried writing a validation framework. So I started with a little sketch of what I was trying to build. It had things like IRuleSet, IRule,IRuleResult and various implementations of those. Then I started coding, and wrote everything test first to see where it will lead. Well most of those things became superfluous. The problem I was trying to solve was much simpler – basically write a bunch of rules I could evaluate in a batch and tell a remote client everything that was wrong with their request in one remote call. Ultimately I just kept the IRuleSet<T> and expressed the rules as simple lambda’s that would return true or false. So I can do things like this:

   1: IRuleSet<string> rules = new RuleSet<string>();
   2: rules.Add(x => x.Length > 5, “Length must be greater than 5”)
   3:     .Add(x => x.Length < 10, “Length must be less than 10”)
   4:     .Add(x => x.Contains("TDD"), "Must contain TDD")
   5: List<string> brokenRules = rules.RulesBrokenBy (“TDD Rocks!”);

I liked this better than the objects soup I initially cooked up, and it works very well with some caveats. I’m sure that this would have taken a lot longer to achieve without the TDD approach, as it made me realize what my real requirements were, and that I didn’t need all that complexity I was imagining in the beginning.

Lots more tests have been written since and lots more code. The overall quality has improved and getting better every day. It is however a process of continuous improvement and it takes work. It would be hard now to turn back and do thing the old fashion way. The one thing I could have used is a good mentor to provide some guidance. Failing that, I turned to ALT.NET and the huge contributions made by the members, and it’s helped in more ways than I can describe. Thanks again to everyone that uses their free time to contribute and guide other devs! Kudos! Sorry for the rant, and slightly off topic post.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,
Categories: Rants
Posted by mateid on Monday, March 30, 2009 8:21 AM
Permalink | Comments (2) | Post RSSRSS comment feed

Changed theme

I was looking for a cool blog theme and I found a couple I liked. They make code look pretty crappy though, particularly longer lines in .config files and the like.I’ve decided that I’ll go back to Cogitation. Looks decent, and is very practical for showing code.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: Rants
Posted by mateid on Sunday, March 29, 2009 12:45 PM
Permalink | Comments (2) | Post RSSRSS comment feed

Jeremy Miller on Persistence Patterns

Remember that article on persistence patterns I promised a while ago? Well, Jeremy Miller beat me to the punch (which comes as no surprise, since despite my efforts I only post once in a blue moon). Check out his MSDN article here.

I’ve been fighting other battles in the mean time, with some success. More on that later.

Cheers,

Matei

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by mateid on Thursday, March 26, 2009 2:43 PM
Permalink | Comments (2) | Post RSSRSS comment feed