LSST-strong-lensing / slsim

Strong lensing simulation pipeline
MIT License
18 stars 30 forks source link

Refactoring SLSim #223

Open jacob-hjortlund opened 3 months ago

jacob-hjortlund commented 3 months ago

Current Status

The current structure of SLSim introduces a large amount of dependency between different classes "under the hood", with multiple classes sharing responsibilities. This reduces legibility for new contributors and makes extension / contribution harder.

Proposed Solution

Refactor SLSim, focusing on composition and dependency injection. The aim is to reduce dependence on specific class implementations and instead introduce "contracts" or "interfaces" between classes, i.e we initiliaze object A by passing an instance of object B, with object B providing certain methods and attributes that object A expects, thus filling the contract expected by object A.

This design pattern allows for drop-in replacements for different objects as long as they provide the expected behaviour. This makes tasks such as including new catalogs, simulation pipelines etc. easier, as one simply needs to include an adaptation from the relevant input to the format expected by an already existing part of SLSim.

The overall refactor is visualized in the UML diagram below.

uml_s5

To-Do List