Rewards Reference Domain - Spring Academy
Rewards Reference Domain - Spring Academy
Back To Course
Completed Next Lesson
Rewards Reference Domain
4 of 4 lessons completed
100%
Conclusion
# Purpose
The labs in this course teach key concepts in the context of a problem domain. The Reward Dining application provides a real-world context for applying t
techniques you have learned to develop useful business applications.
This section provides an overview of the domain and the applications you will be working on within it.
# Domain Overview
The Domain is called Reward Dining. The idea is that customers can save money every time they eat at one of the restaurants participating in the networ
"Frequent Flyer" program for restaurants.
For example, Keith would like to save money for his children's education. Every time he dines at a restaurant participating in the network, a contribution is
to his account.
https://spring.academy/courses/spring-introduction/lessons/spring-introduction-rewards-reference-domain 1/5
3/21/25, 9:42 AM Rewards Reference Domain - Spring Academy
The account contribution (reward) will be shared by his two children Annabelle and Corgan. Thus Annabelle gets a fund to help her with her college fees:
This next section provides an overview of the applications in the Reward Dining domain that you will be working on in this course.
The "rewards" application rewards an account for dining at a restaurant participating in the reward network. A reward takes the form of a monetary contrib
to an account that is distributed among the account's beneficiaries. Here is how this application is used:
1. When they are hungry, members dine at participating restaurants using their regular credit cards.
2. Every two weeks, a file containing the dining credit card transactions made by members during that period is generated. A sample of one of these fil
shown below:
3. A standalone DiningBatchProcessor application reads this file and submits each Dining record to the rewards application for processing.
https://spring.academy/courses/spring-introduction/lessons/spring-introduction-rewards-reference-domain 2/5
3/21/25, 9:42 AM Rewards Reference Domain - Spring Academy
The RewardNetwork is the central interface clients such as the DiningBatchProcessor use to invoke the application:
A RewardNetwork rewards an account for dining by making a monetary contribution to the account that is in turn distributed among the account's benefic
The sequence diagram below shows a client's interaction with the application illustrating this process:
In this example, the account with credit card 1234123412341234 is rewarded for a spending $100.00 at a restaurant with Merchant ID 1234567890 on 29
December 2010 (date is in North American date format).
The confirmed reward, number 9831, takes the form of an $8.00 account contribution distributed evenly among beneficiaries Annabelle and her brother C
Internally, the RewardNetwork implementation delegates to domain objects to carry out a rewardAccountFor(Dining) transaction. Classes exist for the
central domain concepts of the application: Account and Restaurant.
A Restaurant is responsible for calculating the benefit eligible to an account for a dining.
An Account is responsible for distributing the benefit among its beneficiaries as a "contribution".
https://spring.academy/courses/spring-introduction/lessons/spring-introduction-rewards-reference-domain 3/5
3/21/25, 9:42 AM Rewards Reference Domain - Spring Academy
Spring Academy
Figure 6: Objects working together to carry out the rewardAccountFor(Dining) use case
The RewardNetwork asks the Restaurant to calculate how much benefit to award, then contributes that amount to the Account.
Account and restaurant information are stored in a persistent form inside a relational database. The RewardNetwork implementation delegates to support
data access components called 'Repositories' to load Account and Restaurant objects from their relational representations.
A RewardRepository is used to track confirmed reward transactions for accounting purposes. It holds the same data as the
RewardConfirmation in the diagram (Figure 5) above.
https://spring.academy/courses/spring-introduction/lessons/spring-introduction-rewards-reference-domain 4/5
3/21/25, 9:42 AM Rewards Reference Domain - Spring Academy
In most of the labs, a test database is provided for you. It is populated with test data by running scripts in
00-rewards-common/src/main/resources/rewards/testdb. They are available as classpath resources.
Summary Instructors
In the lesson, you learned about an existing Rewards Network problem domain that will be used in the Spring Professinal learning path.
Give Feedback
Help us improve by sharing your thoughts.
Give Feedback
Copyright © 2005-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
https://spring.academy/courses/spring-introduction/lessons/spring-introduction-rewards-reference-domain 5/5