Random Post: On Erlang.
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About Me
  • Quotes
  •  

    DataSets are Evil

    July 31st, 2008

    I’ve always equated the use of DataSets anywhere outside the data layer with code smell, it’s a sure sign that a proper domain model doesn’t exist; it’s also just as likely that the application isn’t layered.  Lets look at some of the reasons you should avoid using DataSets.

    DataSets don’t properly abstract the database, the developer has to be intrinsically aware of the database schema, he has to know the name of the columns and the type of the columns you are returning in the DataSet.  Anytime a developer wants to use the DataSet he will have to look at the underlying query which creates the DataSet and pick out the field names used in the query.  Instead of understanding the business process, instead of adding value, your developer will be mucking around with database queries trying to figure out which field name to use. 

    Additionally, since DataSets are weakly typed, they don’t tell you the type of the column, the developer must know the type of the field and cast the field to the appropriate type.  Every time you cast your run the risk the cast will fail, the value returned could be null or different type.

    Since your application/presentation layer is so tightly coupled to the database your design becomes brittle and difficult to change– every time your database schema changes, it’s effects will ripple throughout your system creating a maintenance nightmare. 

    What troubles me more though is that DataSets don’t give you the opportunity to create a business logic layer, because DataSets are just data containers you can’t add functionality to them.  Two DataSets can’t interact with each other, you can’t abstract problems. Instead you’re forced to write procedural code to work with DataSets and you’ve surrendered all the benefits of object oriented programming.

    Most of the problems associated with DataSets can be solved by using classes that represent your domain model within a well-defined business layer, essentially your represent your data tables with classes.  ORM is immensely useful here, and I’ll discuss it in detail in my next post.


    You’re doing it wrong.

    July 30th, 2008

    Sometimes, we need someone to remind us, we’re doing it wrong.

    Here’s my quick list– you’re doing it wrong if:

    • you’re not using ORM.
    • you’re using (ADO.NET) data sets
    • you’re not refactoring
    • you can’t deploy in one step
    • you’re not always learning.

    stop doing it wrong, start learning how to do it right:  AgilePakistan.org


    AgilePakistan.org

    July 28th, 2008

    When I moved back to Pakistan I made a promise with myself, I promised that I would help improve Pakistan. (Yes, I’m arrogant enough to believe that I can make a difference)

    The Software Development industry is young; as with all young industries, it’s changing rapidly, new technology is introduced daily, methodolgies are developed and old ideas are abandoned quickly.  Keeping up with the changes is exhausting,  books aren’t easily available and while the internet is useful, you can’t find answers for open ended queries. Software developers in Pakistan need a forum where they can learn about the latest trends in our industry, share knowledge and network.

    Mohtashim’s and Aleem’s presentations at the PASHA career fair inspired me to get off my ass and do something– introducing: AgilePakistan.org.  Agile Pakistan is a community of software developers, the goal is to meet once a month to discuss software development, to learn and improve ourselves as software developers.  Anyone and everyone is invited to the meetings, membership is not required, but if your are interested in presenting a topic then please email me at Sheheryar [at] AgilePakistan.org


    Castle Active Record Link Dump

    July 7th, 2008

    Castle Active Record Links @ Ayende

    Just link dumpin, ignore it.