An implicit input is internal or external state that affects a computation without appearing as an explicit method argument. References to mutable state and dependencies such as databases are hidden inputs. section 6.3 section 6.6
Implicit inputs matter because they change both design and testing:
- They prevent a method from behaving as a mathematical function, because identical explicit arguments may produce different results. section 6.3
- They block output-based testing, whose strongest maintainability depends on having no hidden inputs or outputs. section 6.6
- They create a trade-off: gather possible data up front for stronger separation, or let an application service decide when to query it for better performance. section 6.5
Database dependency in AddRecord
Passing an IDatabase instance to AddRecord introduces a hidden input through external state. Gathering access data before the decision preserves a functional core but may perform unnecessary queries; delegating the query decision to the application service improves performance while weakening separation. section 6.5
public FileUpdate AddRecord(
FileContent[] files, string visitorName,
DateTime timeOfVisit, IDatabase database
)
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":2,\"ch\":26},{\"line\":2,\"ch\":44}]]"}
!@%STYLE%@!
Inspect the method signature that exposes the database dependency and reveals how external state enters the computation. section 6.5

