Monday, December 18, 2006

Limitation of foreign-key constraints in SQL Server 2005

I encountered a limitation to how you can set the on-delete and on-update constraints for foreign-keys in SQL Server 2005. I have a table with 5 foreign-keys, all targeting the same column. I wished to have on-delete and on-update "Cascade" for all of them, this however was not permitted. Only one of them could have the cascade property set, the others I left with "No action" :(.

Units tests as an afterthought

This has probably been said elsewhere and I might even have read it there ;) Still I think it is worth mentioning here.

Ideally unit tests should written as a part of a test driven design (TDD), in this case they check for code's correctness. However, sometimes the unit tests don't get done instead the code is made bug-free by testing it by hand. In this case it is still of value to write unit tests, however the focus changes: The unit tests should guard the code against external changes that affect it, i.e. ensuring its pre-conditions. These unit tests test things such as:
  • DB schema changes: E.g. the code should still be able to load its configuration from the database.
  • Interfaces to external code: Just the simplest run through the code where all external interfaces are called should trigger test failure. This is not such an issue for strongly types languages, except where reflection is used.

Linking files between projects in VS2003

I think that linking existing files between projects should be made clearer in VS2003, not clicking on the obscure arrow next to the Open button.













I need to check if this has changed in VS2005.

Thursday, December 14, 2006

Secrets distract

Another interesting post at Chris Sells spoutlet was about the flow of information within companies. I think he is quite right in saying that secrets should not be withheld from employees.

Data will outlive programs

I got a small epiphany when reading an old entry by Chris Sells. It made me realize that the data in the database should be left as accessible as possible for future programs. The data will most likely outlive the program created to access it.

P.s.
Actually, the reason I ended up at Chris was because he had made available a nice tool to test regular expressions.