Declarative programming states the result or relationship you want and leaves the execution method implicit. It emphasizes what to achieve rather than how to achieve it, contrasting with imperative programming’s step-by-step instructions. section 7.6.3
Calculating an average
An imperative implementation initializes a total, loops through ages, adds each value, and divides by the list size. A declarative implementation states the operation directly with ages.average(). section 7.6.3
Writing executable scenarios
A low-level scenario lists field entries, date selection, distance selection, and button clicks. A declarative scenario describes the business outcome: looking for a hotel within a distance of a city for specified dates and nights. section 7.6.3
val ages = listOf(20,40,50,15,80); val averageAge = ages.average();
View the concise average calculation that expresses the desired operation without exposing its iteration steps. section 7.6.3
When I look for a hotel within 10 km of Paris for 2 nights on 04-04-2019
View a scenario phrased as a user goal rather than a sequence of interface interactions. section 7.6.3













