Recommended reading for developers
I was reminded this morning of an email that I sent to the junior developers on my team when they joined us. It is an overview of some of the development practices, patterns and products that they would get exposed to on our project. I have included it here as a reference collection for others.
Principles and Patterns
These are things that I often use and are still learning to use.
- SOLID – Originally put together by Bob Martin (http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod). A good overview to read is at http://www.davesquared.net/2009/01/introduction-to-solid-principles-of-oo.html.
- LoD - Law of Demeter (or Principle of Least Knowledge) (http://en.wikipedia.org/wiki/Law_of_Demeter). Often referred to as loose coupling.
- DRY – Do not Repeat Yourself (http://en.wikipedia.org/wiki/Don’t_repeat_yourself). Many say that this principle should not apply to unit testing.
- DIP – Dependency Injection Pattern which is the D in SOLID. Jeremy Miller has a good overview at http://codebetter.com/blogs/jeremy.miller/archive/2005/10/06/132825.aspx. DI frameworks (Unity, Castle Windsor, Spring.Net etc) often use a Service Locator pattern for their implementation. Like Jeremy, my preference is constructor injection because it defines a contract of how to use a class whereas setter (or property) injection doesn’t. Setter injection should only be used for optional dependencies and usually requires additional defensive coding.
- TDD – Test Driven Development (http://en.wikipedia.org/wiki/Test-driven_development)
- DDD – Domain Driven Design is gaining popularity but still seems to be not well understood or widely used (including by me). See http://en.wikipedia.org/wiki/Domain-driven_design and MSDN Mag introduction article at http://msdn.microsoft.com/en-us/magazine/dd419654.aspx.
- AOP – Aspect Orientated Programming (http://en.wikipedia.org/wiki/Aspect-oriented_programming)
- Service Locator – See http://en.wikipedia.org/wiki/Service_locator_pattern and http://msdn.microsoft.com/en-us/library/cc707905.aspx. Keep in mind that this is starting to be considered as an anti-pattern and should probably be avoided in favour of DI.
- GOF - Gang of Four patterns (http://www.dofactory.com/Patterns/Patterns.aspx). I tend to use the following in GoF:
- Factory Method- See http://www.dofactory.com/Patterns/PatternFactory.aspx
- Facade - See http://www.dofactory.com/Patterns/PatternFacade.aspx
- Proxy – See http://www.dofactory.com/Patterns/PatternProxy.aspx
- Chain of Responsibility – See http://www.dofactory.com/Patterns/PatternChain.aspx. While I haven’t used this one, it would be very helpful for processing items in a queue.
- Testing - http://en.wikipedia.org/wiki/Software_testing. Lots of areas to cover such as white box, black box, grey box, regression, non-functional (performance, load, globalisation), unit vs. integration testing, code coverage etc.
- Mocking – Used to provide mock dependencies for unit testing. See http://en.wikipedia.org/wiki/Mock_object, http://martinfowler.com/articles/mocksArentStubs.html and http://msdn.microsoft.com/en-us/magazine/cc163904.aspx.
- Stubbing – Used to provide a dependency for unit testing with predetermined answers and behaviour. See http://en.wikipedia.org/wiki/Test_stubs.
Jeremy Miller also writes a series called Patterns in Practice for MSDN Magazine (see list at http://msdn.microsoft.com/en-au/magazine/cc720886.aspx). They are all a good read, especially:
- Cohesion and Coupling - http://msdn.microsoft.com/en-au/magazine/cc947917.aspx
- Design for Testability - http://msdn.microsoft.com/en-au/magazine/dd263069.aspx
Tools
These are tools that are good to get experience using. Most of them relate to the patterns above. There are other tools used like ReSharper, dotTrace, StyleCop, WinMerge etc, but they don’t have the up skill requirement that the following tools do.
- Reflector - http://www.red-gate.com/products/reflector/. This is a .Net assembly disassembler that has really good search and analysis tools. This is the most important development tool for me. It is as critical to my development as Visual Studio itself.
- Rhino Mocks - http://ayende.com/projects/rhino-mocks.aspx. Mocking framework for testing.
- Unity - http://www.codeplex.com/unity. Dependency Injection framework included in Microsoft Patterns and Practices Enterprise Library.
- PostSharp - http://www.postsharp.org/. Used for AOP.
- MSTest – Unit testing integrated into Visual Studio.
Probably the most important tool to start using is Rhino Mocks. The only way to get experience with it is to start writing unit tests in VS. See the documentation at http://ayende.com/wiki/Rhino+Mocks+Documentation.ashx.