Unit testing the data access layer

Unit testing can be difficult sometimes. In some cases, you need to refactor your code-under-test to make it more testable; in other cases, you need to apply some special techniques into your test code so that it can do what you want; and in the worst cases, you can’t think of any such techniques nor are able to refactor the production code and thus, don’t write any test at all. It’s in my experience working with many teams applying unit testing that they often have troubles writing tests for the data access layer (DAL), UI layer, service interface layer, and multi-threading code, mostly because they are not aware of the techniques for doing that. That is not surprisingly difficult to understand though, business logic is much more intuitive and straight-forward to be tested and every single article or book out there will have examples writing test for the business logic firstly.

In this blog entry, I will explore some techniques of testing the data access layer. While it won’t be very comprehensive (I think an entire book can be written just to explore in details all facets of database unit testing), I hope there is enough of topics covered for you to explore more. Read more »

When you learn new things, learn from books

I can hardly believe that there is any Java developer who never reads a Java book, or “agile developer” who never reads a book on XP, Scrum… Unfortunately, there are just so many many of those. In fact, many people I know/interview have very fundamental gaps in their knowledge and in most cases I discover that it is partly due to the fact that they never spend time learning things from books. Reasons provided often are: not enough time, internet resources are more than enough etc. In most situations, I don’t think it’s a good mindset to develop software. Read more »

My article on The Code Projects

I have edited and submitted my blog entry about db4o to The Code Project. This is the first time I published an article over there. Let’s see how well (or badly) it is received :-).

Object-oriented database programming with db4o - Part 1

In Part 1 and Part 2 of the article entitled The Legend of Data Persistence, I have introduced you to the O-R impedance mismatch, O-R/M tools, ODBMS and its advantages and disadvantages in comparison with RDBMS.  Now, once you have decided that you would use an ODBMS for your project, which ODBMS should you use?  This article, as a follow-up of The Legend of Data Persistence, aims to introduce you to one of today’s most popular ODBMS implementations, db4objects (db4o). 

Read more »

Steve Yegge on the Next Big Language

What Steve Yegge considers the Next Big Language.  Sound like

  • Ruby + (Java || C# 1.x/2.0)
  • (JRuby || Groovy || Ruby.NET) + good_tools (esp. IDE)
  • C# 3.0 && dynamic_typing (not just type inference) && more_syntactic_sugar (return multiple values, object-literal syntax for hashmap etc.)