Unit Tests are the backbone of Agile development. Unit Tests ensure that you are done making a “unit” of a program, that a change or refactoring you have done to a “unit” has not broken the program, and they also help to ensure that you are not over-programming – creating more than you needed to in the wrong place.
When a programmer is bored he sometimes over-engineers and under-designs a project. We adopt an attitude like “well, if I have to do this in VS2005 and .NET 2.0 I may as well implement a service-locator and message bus and use all that technology I wanted to learn.
Larry Wall truthfully said the best virtues for a programmer are laziness, impatience and hubris. Sometimes you ignore these virtues when you get bored, you start to do stuff you know you shouldn’t, and your laziness doesn’t balance your hubris.
My new virtue that I’m going to work hard on is, ironically, laziness. 🙂 KISS is the new methodology for me to follow: Keep It Simple, Stupid for design, YAGNI: You Aren’t Gonna Need It for architecture.
I’m working at a new client and have written a few services to support a DotNetNuke CMS install, as well as a few modules. To support the modules I’ve written one or two of my services using a Fluent Interface API. This was fun and exciting, but some APIs didn’t make sense to be used fluently, or it complicated things more than I would have liked.
As a developer I think it is important to write the API so that it is usable and easy for a junior to understand. Fluent is one way to do it, but it isn’t necessarily the only or best way!
I just completed another project contract on Friday. After decompressing over the weekend I wanted to write a few thoughts out about some of the successes and failures I’ve learned during this project.
Earlier I had compared NHibernate and SubSonic and chose SubSonic because it had migrations. I’ve done two projects, one using SubSonic and the other using NHibernate and I can now compare the features a little better.
NHibernate is documented better than I originally thought if you look at nhforge.com, not at the hibernate site. It also does some nice schema generation based on your mapping. You still have to go through “XML Hell” to map the site, unless you use another mapper or FluentNHibernate (which does the mapping for you in code) or another tool. As an ORM SubSonic feals cleaner and quicker since it generates the ORM classes from the database, where-as NHibernate generates the Schema from your mappings and ORM classes.
ORM tools are probably one of the most time-saving tools for a web developer. Nothing is more tedious than building a data access layer, adding caching or coordinating transactions. Well okay, sometimes things like that are really fun, but when you’re trying to start a project out from scratch you want to get something up and running ASAP to show to your customers.
In the .NET world there are two powerful ORM tools out there, NHibernate and SubSonic. NHibernate is based on the successful and popular Java EE ORM Hibernate. SubSonic is an entirely new ORM developed in the Ruby on Rails ActiveRecord development model, with some nice .NET 2.0 features like Controllers that you can use with ObjectDataSource controls.
For a recent project I quickly evaluated both software tools, and I’m publishing what I learned here.
I just read a great article in MSDN Magazine (available online here) on the Open / Closed Principle from the Patterns in Practice column. I really enjoyed it. I’m going to have to spend some more time learning some more design patterns. I’ve spent some time learning Model-View-Presenter (MVP) and Inversion of Control (IoC) but haven’t put either into practice yet. Who knows what the future holds though?