OWASP / OWASP/SecurityShepherd
Refactor Getter.java and Setter.java into DAO pattern
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 515
- Avg merge
- 3h 46m
- Merged PRs (30d)
- 1
Description
Context
Getter.java (2847 lines, 52+ methods) and Setter.java (1567 lines, 28+ methods) are monolithic data access classes that handle all database operations. This makes them hard to maintain, test, and review.
Proposal
Refactor into a DAO (Data Access Object) pattern, splitting by domain:
UserDao— auth, user creation, password management, role updatesModuleDao— module retrieval, status, scoring, cheat sheetsClassDao— class management, scoreboardsSessionDao— CSRF tokens, session management helpersSettingsDao— platform configuration (registration, feedback, scoreboard settings)
Each DAO would:
- Use try-with-resources for all connections (no leak risk)
- Be independently testable
- Have a clear, focused responsibility
Prerequisites
- Connection leak fixes (part of #800) should be done first — fixing leaks on the current structure, then refactoring
- Should not change any business logic, only code organization
Benefits
- Smaller, reviewable files
- Easier to add tests per domain
- Clear ownership of database operations
- Reduces merge conflicts when multiple contributors work on different features
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Getter.java and Setter.java to inventory their database operations by the proposed domains. Complete the connection leak fixes from #800 first, then split the operations into UserDao, ModuleDao, ClassDao, SessionDao, and SettingsDao. Done means focused, independently testable DAOs using try-with-resources without changing business logic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, database
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100