Wildbook icon indicating copy to clipboard operation
Wildbook copied to clipboard

Refactoring Shepherd for testing and maintainability

Open vkirkl opened this issue 10 months ago • 2 comments

This is a multi-issue story with the goal of breaking the Shepherd class into sub-packages and new classes to facilitate testing and improve maintainability. This iteration will identify and migrate only high priority methods and provide an example for further refactoring as resources allow.
[Sub-issues will be linked as they are created.]

High level tasks include:

  1. Enumerate backwards dependencies of Shepherd, ShepherdPMF, and ShepherdProperties; mark orphaned code for removal;
  2. Create new directory structure / subpackages Suggested directory structure with example files:
    src/main/java/org/ecocean/shepherd/
         core/
             Shepherd.java (Coordinates operations between services and utilities)
             ShepherdPMF.java (Persistence Manager Factory, if not separated out)
         services/
             EncounterService.java
             MediaAssetService.java
             ... 
        utils/
             MediaUtils.java
             QueryUtils.java
             ValidationUtils.java
             ... 
      ```
    
  3. Migrate Shepherd and ShepherdPMF to core
  4. Identify util methods in Shepherd and prioritize for migration to new util classes based on usage in backwards dependency analysis; migrate high priority methods; add tests; prune code flagged for removal
  5. Identify entities and their CRUD methods in Shepherd and prioritize for migration to new service classes; migrate high priority entities (e.g. Encounter); add tests; prune code flagged for removal
  6. Identify transaction handling methods; add tests

vkirkl avatar Feb 04 '25 18:02 vkirkl

Work done on this story for 10.7: #1074, #1079, #1080, #1083, #1084

vkirkl avatar Apr 07 '25 17:04 vkirkl

Keeping alive as a parent story to track refactoring ... not just 10.7 work.

vkirkl avatar Apr 10 '25 19:04 vkirkl