Category: Optimization

  • I’m hooked on test-driven development (TDD) with a Fizzbuzz C# Example

    I’ve only been doing TDD for a few weeks, but I’m completely sold.  I don’t want to go back!  I’ll be honest though, it hasn’t been easy.  I’ve made mistakes, I’ve wasted time, but I’m really starting to reap the benefits.

    I’ve always thought I was a good developer.  I write decent code and it works mostly as expected.  It took me many years into my career before I wrote my first unit test.  It always fell into the category of too time consuming or expensive.  Oh the irony!

    As I started learning how to write to unit tests, I always found myself rewriting things I already did just to get them to be unit tested; how frustrating!  A unit test that should have only took a few minutes, ended up taking a really long time because the code had to be refactored just to be tested.  No better way to turn you off from unit testing.

    Enter test-driven development…

    (more…)

  • If You Don’t Start You Won’t Finish

    I really wish that I didn’t need to tell myself this 5 to 10 times a day, but unfortunately it’s always just too easy to not start.

    If you don’t have kids, you truly have no understanding of how many toys they have and how much of a mess they make.  If you only have 1 kid, it’s probably a lot, but I’ve been blessed with 3 – and let me tell you that each and every day there is at least 10 to 15 minutes of clean up in every room!

    The honest truth of the matter is though, if I don’t start, it won’t get done – unlike the story about the Shoemaker and the Elves, they are not coming to clean my house each day!

    This of course is a very simple example, but I find this reminder useful even at work.

    (more…)

  • What Do You Care Most About When Reviewing Someone Else’s Code?

    I wrote an article a few months ago called Compelling Interview Questions where buried deep in the middle under several open-ended technical questions I asked the question “What Do You Care Most About When Reviewing Someone Else’s Code?”

    The funny part about this when you read a few lines below I follow it up with I’m not looking for anything in particular; just some generic catch-phrases that most people throw out there.  E.g. properly indented code, no large comment blocks, documentation to explain a complex block of code, etc…

    Ask me today what I expect from this question and my answer is totally different!  Today being as I write this article – ask me in the present and let’s see if my answer changes…

    (more…)

  • Developers are Authors

    This is truly a concept that has only dawned on me recently – in fact, probably within the past day or two.  The ironic part about this, I’ve actually considered myself an author for the past 3 years, since the release of my first book.  And most developers I meet or work with seem to have the same reaction when I tell them, “Oh you’re an author, that’s pretty cool.”  When in fact – as the title states – all developers are authors, including you!  Now let me tell you why.

    (more…)

  • Automapper Performance Testing

    I hate typing more lines of code then I need to; especially something as simple as mapping a domain model to a view model.  Enter Automapper!

    By performing a one-liner: [code] Mapper.Map<Customer, CustomerViewItem>(customer);[/code] I can quickly map my domain models to my view models.

    I was recently reviewing an old article on CodeProject: http://www.codeproject.com/Articles/61629/AutoMapper that contains a quick and easy demo.  Inside this article, it discusses performance and it indicates that Automapper is 7 times slower than manual mapping.  This test was done on 100,000 records and I must say I was shocked.

    My first thought is this requires more testing.  Especially since 100,000 records is a lot.  In most scenarios I would estimate my largest mapping might be 1,000, but even 1 would probably be a very regular use-case.  Let’s put it to the test…

    (more…)