May 2009 Blog Posts
I’ve previously indicated that I find certain parts of the .NET BCL difficult to work with in a DI/TDD fashion. My solution to this is (like many before me) to write wrappers for some of the key pain points. I’ve decided to throw them up on Google Code using an Apache 2.0 licence. The project is called Abstract2ion (for which there is no official pronunciation). It contains the following: IConsoleWrapper a wrapper around System.Console IFileSystemWrapper and friends which provides a (fairly light) abstraction of some of the file system classes. Currently this supports...
I’ve just purchased a licence for NDepend (note to self: In future respond promptly to emails offering free licences, don’t lose them). Using it to examine one of my personal projects has suggested a number of classes which could potentially be made internal. This would require adding the InternalsVisibleToAttribute to the assembly in order to allow the test assembly to access the classes. This leads to the question: Is this valid behaviour? This is not a question to which I currently have a good answer. Some general thoughts on the matter: Making implementations internal ensures...
Abstraction is a keystone principal of constructing software. Without the ability to isolate concerns we would not be able to build complex systems or run software on systems with differing hardware. Building abstraction into your software is generally a good and desirable thing that will make it easier to construct and maintain. It’s also something that is open to being overused. There are many instances where an abstraction is used so that multiple implementations may be substituted. One particularly common use are device drivers which mediate between a common interface defined by an operating system and the custom requirements...
Strategy is a pattern that is often useful in encapsulating variations in logic. In working with a domain model there are often scenarios where it would be advantageous to be able to apply a strategy. There are a number of ways in which this may be achieved involving varying design tradeoffs. In making our selection there are a number of considerations that may be applicable: Dependency injection into domain objects is generally undesirable. They will often be managed by an ORM which would require us to integrate into the ORM in order to allow the...