Reading notes from preface to growing oo software
19 Aug 2019
Reading notes based on Growing Object-Oriented Software, Guided by Tests by Steve Freeman and Nat Pryce
These are just some quick notes about what is covered in the preface. Usually, authors condense their preface into the key things that they want you to take away from a book. I'm capturing them here so that I can look out for them in the book itself.
Problems this book addresses
- How do I fit test-driven development into a software project?
- Where do I start?
- Why should I write both unit and end-to-end tests?
- What does it mean for tests to "drive" development?
- How do I test difficult feature x?
- The authors say that they have seen teams that can do the raw practices (writing and running tests) but struggling because they haven't also adopted the deeper processes that lie behind it.
- Mock objects are often misunderstood - they are an expression of our approach to writing software.
- The authors used the term 'growing' because it gives a sense of incremental development. There is something working at all times, something that is as well-structured as possible and thoroughly tested.
- They follow Alan Kay's concept of objects being similar to biological cells that send each other messages.
- We write tests first because it forces us to clarify our intentions.
- The process of writing tests first helps the authors to see when a design is too rigid or unfocused.
- Tests give us a safety net of regression coverage
- The authors use the word "guided" because the technique requires skill and experience
- TDD is an effective design support tool. It requires understanding and sustained effort to work.
- Use the contents of the tests to stay focused on making progress and feedback from the tests to raise the quality of the system.
- The original motivation for writing the book was to explain the technique of using mock objects.
- They show how the mock objects technique works. More specifically, they show where they fit into the TDD process and how it makes sense in the context of object-oriented development.
Structure of the book
- A high-level introduction to TDD, mock-objects and object-oriented design.
- The process of TDD, including how to get started and how to keep moving. How the principles of TDD and OO support each other, and how to work with external code.
- How the authors develope an object-oriented application in a test-driven manner, including trade-offs and motivations for the decisions that are made. Also shows how some features of TDD become more significant as the code starts to scale up.
- Some practices for keeping a system maintainable, clean and expressive. Also discusses some practices the authors have adopted and why
- More advanced topics that look at areas where TDD is more difficult: complex test data, persistence, concurrency. Showing how the authors deal with these issues and how this affects the design of the code and tests.
- Appendices include some supporting material on jMock and Hamcrest.