Skip to main content

Posts

Showing posts from June, 2011

Mapping Objects via TDD

Why we map?Many times at Codeweavers we often have tasks which involve mapping between various objects. It is no secret that I dislike such tasks. The reason we map between objects though is actually a good thing as pointed out by several developers. Mapping means our components are less coupled. For example, we can write one feature and then simply map different web services to use this feature. If we chose not to map to a common object we would need to re-implement this functionality for each service. Therefore not only do we decouple our code, but our codebase is much DRYer.What ways do we do it?One approach is a test per property. One developer will write a failing test for a property (accessor), while the other developer writes the code to make this test pass. During this process the keyboard flicks back between each developer very rapidly, in fact most of the time when writing a property per test is spent sliding the keybo…