Thursday, 13 May 2010

Things to avoid in development

I'm currently very low, probably due to working my but off and not achieving much. I'm a results driven person and seeing few and insignificant results after working like a mule depresses me. So I decided to try note down some of the things that are causing me to be so inefficient so that I can avoid them in future and focus my efforts on reducing or removing them.
  1. Get tests in early. Unit tests, UI tests, Fitnesse, whatever. Do TDD if you are allowed to. Make the tests the requirements. We're currently finding that changes to fix a bug are breaking other related (though far from obviously related) functionality. Tests would tell us early. I've just finished fixing something that was broken a month ago. It took bloody ages to sift the history and find when and where it was introduced.
  2. DO NOT USE UPDATE PANELS - EVER. THEY ARE THE SPAWN OF SATAN. THEY WILL DESTROY YOU AND YOUR WEBSITE. You have been warned.
  3. Avoid making user controls because they MIGHT be reused. Excessive user controls leads to a heap of stinking doo-doo that is a mother of a pain in the arse to debug and manage.
  4. Just because this thing LOOKS almost exactly like that thing does not mean it's the same thing. Sure, copying and pasting the mark-up is ugly duplication, but not nearly as ugly and buggy as a user control that has a state to indicate what to display. Use a template and push your data into it. See http://encosia.com/2010/05/03/a-few-thoughts-on-jquery-templating-with-jquery-tmpl/.
  5. Use jQuery (or another JavaScript framework/toolbox) for AJAX and for as much UI as possible. Use the server only when you have to. For that matter; avoid ASP.NET WebForm controls - they are designed for server side use and are heavier than POSH (Plain Old Html Semantic) controls.
  6. Do not let timescales pressure you into creating features that have no tests. If you have no test, it will eventually be broken and you won't know and you will spend hours finding what broke it and wish the fleas of a thousand camels on the person who did this, only to find it was you. So write the bleeding tests!
  7. If you're using a home-grown, or 3rd party for that matter, data binding or view-controller framework, make sure that you're clear about the sequences and dependencies between different types and user controls. Do not mix binding to the UI with binding from the UI or you will eventually find yourself in a stack overflow situation chasing your own tail. Technically it's when one type being pushed to the UI wants data for another type from the UI, that wants data from another type that wants to first push the original type. You will go insane.
I'm sure there are a host of other things that should be avoided, and I'll add to this list over time, but for now these are the things that contribute most to my inefficiency.

2 comments:

  1. ...or to put it another way. Don't use ASP.Net webForms. Do use ASP MVC.

    ReplyDelete
  2. This is one of my most frequently visited entries. I like reading how my experienced self is telling the enthusiastic creative self to behave.

    ReplyDelete