-
Notifications
You must be signed in to change notification settings - Fork 0
Week 9 Exercise Ready for Review #46
Copy link
Copy link
Open
Labels
api:externalWork related to external/public API selection, integration, and resilience.Work related to external/public API selection, integration, and resilience.area:persistenceEntities, DAOs, JPA/Hibernate mappings, and database concerns.Entities, DAOs, JPA/Hibernate mappings, and database concerns.area:serviceBusiness logic and orchestration (e.g., DrillService, ChallengeRunService).Business logic and orchestration (e.g., DrillService, ChallengeRunService).area:webControllers, JSP/JSTL, view models, and UI wiring.Controllers, JSP/JSTL, view models, and UI wiring.checkpointUse for Project Checkpoints. Include acceptance evidence (tests, screenshots) when used.Use for Project Checkpoints. Include acceptance evidence (tests, screenshots) when used.priority:P1-highHigh importance; schedule next.High importance; schedule next.project:mvpUse for all issues/PRs that belong to the MVP release. Will auto-add labeled items to the board.Use for all issues/PRs that belong to the MVP release. Will auto-add labeled items to the board.status:needs-reviewReady for code review or product approval.Ready for code review or product approval.status:triageNewly filed or uncategorized. Needs initial review, labeling, and priority assignment.Newly filed or uncategorized. Needs initial review, labeling, and priority assignment.
Milestone
Metadata
Metadata
Assignees
Labels
api:externalWork related to external/public API selection, integration, and resilience.Work related to external/public API selection, integration, and resilience.area:persistenceEntities, DAOs, JPA/Hibernate mappings, and database concerns.Entities, DAOs, JPA/Hibernate mappings, and database concerns.area:serviceBusiness logic and orchestration (e.g., DrillService, ChallengeRunService).Business logic and orchestration (e.g., DrillService, ChallengeRunService).area:webControllers, JSP/JSTL, view models, and UI wiring.Controllers, JSP/JSTL, view models, and UI wiring.checkpointUse for Project Checkpoints. Include acceptance evidence (tests, screenshots) when used.Use for Project Checkpoints. Include acceptance evidence (tests, screenshots) when used.priority:P1-highHigh importance; schedule next.High importance; schedule next.project:mvpUse for all issues/PRs that belong to the MVP release. Will auto-add labeled items to the board.Use for all issues/PRs that belong to the MVP release. Will auto-add labeled items to the board.status:needs-reviewReady for code review or product approval.Ready for code review or product approval.status:triageNewly filed or uncategorized. Needs initial review, labeling, and priority assignment.Newly filed or uncategorized. Needs initial review, labeling, and priority assignment.
Projects
StatusShow more project fields
In Progress
StatusShow more project fields
In Progress
@pawaitemadisoncollege - week 9 ready for review
This submission completes the Week 9 Exercise: Service using DAO (and Extra Challenge).
References PR #47
Main
Rather than creating a redundant new service, I expanded and clarified my existing ChallengeService, which already performs the same function described in the exercise:
No ID → returns all (findAll)
ID provided → returns one (findById) *Returns an entity as required for the challenge
This approach keeps my project consistent and avoids unnecessary duplication, while still fully demonstrating the DAO → Service pattern and the “extra challenge” requirement.
Supporting components
ChallengeDao – DAO providing persistence operations
ChallengeService – wraps the DAO for application/business logic
Week9ChallengeService – lightweight delegate demonstrating clear exercise intent
Week9ChallengeServiceTest – validates delegation logic
Files to Review
Rationale
I noticed that my existing ChallengeService already aligns with the intent of the Week 9 exercise. It consumes a DAO, abstracts persistence concerns, and returns either a full collection or a single entity depending on context.
To make this connection explicit, I added a small Week9ChallengeService layer that delegates to ChallengeService, making the “DAO → Service → Controller” relationship perfectly clear for grading purposes.
This also avoids introducing much dead code (I can just remove the week9 related class/test) — the pattern is real, used, and directly beneficial to the overall app structure.
If expanded externally, I would expose the same logic via a simple REST endpoint:
This would expose /api/challenges for all challenges and /api/challenges?id=42 for one — as an entity completing the “extra challenge” at a web-service level.
Screenshots
Browser:
Week 9 getAll screenshot
Week 9 getById screenshot
Tests:
Reflection
Key Learning Points / Takeaways:
Challenges:
Problems Solved / Resources Used:
Summary Statement
All service tests are passing, and the new Week9ChallengeService fulfills both the base and the “extra challenge” requirements.
This solution is functionally complete, test-verified, and aligned with Week 9 objectives while remaining consistent with the app’s real structure.