Posts tonen met het label sfk. Alle posts tonen
Posts tonen met het label sfk. Alle posts tonen

2007-11-15

On unit testing: separate logic from storage

Reminder to all: split logic from your storage mechanism. We decided it would be important to write tests around a function in `ftolib` I did some refactoring on. It would be a pity if that accidentally changed the outcome too. Of course I should have used tests while refactoring. But we didn't have any. So I set up a nice environment using Pyunit (import unittest). Then had some example tests running. When I started a test for my function, I found out it was virtually impossible to harness it with tests: the function calculates frequencies of specific medication per prescriber AND stores the results in the DB. Logic and storage in 1 big function. Not very nice.

2007-09-07

Treat ATC codes as stock symbols

On certain website (say fool.com) something happens when you hover your mouse pointer over a stock symbol. Some extra information is shown: We could do the same for ATC codes, or GPK's or AGB codes or whatever. To prepare for this, we could start using then code element: <code class="atc">A02B</code>. Then later, these codes can be processed and replaced by custom behavior automatically using JavaScript.