Ruby Conf 12 - Boundaries by Gary Bernhardt
ConfreaksYouTube ↗
Further reading 3
Why does testing a business rule need a database? →Separate who qualifies for a reminder from whether the reminder can be delivered.Why do tests pass when the program is wrong? →Gary Bernhardt’s isolated tests and Andrej Karpathy’s neural network both deliver good news when the code is wrong.Does splitting code actually split its dependencies? →Start with a rule that sends an email. Separate deciding from doing, then inspect layers, objects and abstractions: which parts must still change together when the rule changes?This video helps answer · Where should a business rule end?
Caption notes
Move decisions into a functional core and leave databases and mail in an imperative shell. Tests can then check decisions without mocks that might disagree with production objects.
Original passages · 5
if you don't stub the boundary correctly, your test will pass and your production system will be wrong.the expired users class makes all the decisions and the sweeper class has all the dependencies.Values in your system afford shifting process boundaries.we now have values as boundaries.an imperative shell that surrounds the functional core.