Google Testing Blog: Write Change-Resilient Code With Domain Objects
Although a product's requirements can change often, its fundamental ideas usually change slowly. This leads to an interesting insight: if we write code that matches the fundamental ideas of the product, it will be more likely to survive future product changes. Domain objects are building blocks (such as classes and interfaces) in our code that match the fundamental ideas of the product. Instead of writing code to match the desired behavior for the product's requirements ("configure text to be white"), we match the underlying idea ("text color settings"). For example, imagine you’re part of the gPizza team, which sells tasty, fresh pizzas to feed hungry Googlers. Due to popular demand, your team has decided to add a delivery service. Without domain objects, the quickest path to pizza delivery is to simply create a deliverPizza method: public class DeliveryService { public void deliverPizza(List pizzas) { ... } } Although this works well at first, what happens if gPizza expands
Google Testing Blog: Write Change-Resilient Code With Domain Objects Testing Blog Write Change-Resilient Code With Domain Objects Wednesday, September 04, 2024 Google Labels: Amy Fu , Code Health , TotT    Labels  TotT 113 GTAC 61 James Whittaker 42 Misko Hevery 32 Code Health 31 Anthony Vallone 27 Patrick Copeland 23 Jobs 18 Andrew Trenk 13 C++ 11 Patrik Höglund 8 JavaScript 7 Allen Hutchison 6 George Pirocanac 6 Zhanyong Wan 6 Harry Robinson 5 Java 5 Julian Harty 5 Adam Bender 4 Alberto Savoia 4 Ben Yu 4 Erik Kuefler 4 Philip Zembrod 4 Shyam Seshadri 4 Chrome
related reading
- Google Testing Blog: Simplify Your Code: Functional Core, Imperative Shelltesting.googleblog.com
- Cognitive load is what mattersminds.md
- Google Testing Blog: Code Healthtesting.googleblog.com
- Software Engineering at Googleabseil.io
- Google Testing Blogtesting.googleblog.com
- Google Testing Blog: Less Is More: Principles for Simple Commentstesting.googleblog.com
- Google Testing Blog: Code Health: Reduce Nesting, Reduce Complexitytesting.googleblog.com
- Google Testing Blog: Communicate Design Tradeoffs Visuallytesting.googleblog.com
- Google Testing Blog: Testing on the Toilet: Test Behaviors, Not Methodstesting.googleblog.com
- Write code that is easy to delete, not easy to... — programming is terribleprogrammingisterrible.com
- How to Write Clean, Testable Codeyoutube.com
- Google Testing Blog: How Much Testing is Enough?testing.googleblog.com