# Refactoring the load system

**URL:** <https://discourse.sourcecred.io/t/refactoring-the-load-system/629>\
**Category:** Initiatives\
**Tags:** ✔️completed\
**Created:** [February 5, 2020, 9:59am UTC](https://discourse.sourcecred.io/t/refactoring-the-load-system/629 "2020-02-05T09:59:46Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Beanow](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sourcecred.io/beanow/32/98_2.png) [@Beanow](https://discourse.sourcecred.io/u/Beanow)\
**Post date:** [February 29, 2020, 1:48pm UTC](https://discourse.sourcecred.io/t/refactoring-the-load-system/629/11 "2020-02-29T13:48:43Z")

</div>

> [@decentralion](#):
>
> I’m worried that the new load system goes overboard on DI in a way that is frustrating/has lots of boilerplate for making changes

Perhaps a good moment to share some retrospect thoughts :]

Agree there’s frustration/boilerplate left. However, this initiative/refactor started because the previous version was impossible spaghetti, where all the tests would break if you change how the pipeline itself worked. (Such as breaking up the mirror+graph step into two separate steps).

Introducing such pipeline changes have gone from nightmare to doable now, for example [Expose a ReferenceDetector to createPluginGraphs](https://github.com/sourcecred/sourcecred/pull/1673) made a change in the pipeline.

Something that I feel became more effortful is having to declare a Loader interface and object for every plugin. While more work, I think it’s an improvement over the before-situation of directly depending on plugin-internal functionality in the load pipeline.

Another trade-off that creates more effort, is how `LoadContext` is required to be a “dumb” composition class, [not allowed](https://github.com/sourcecred/sourcecred/pull/1658#discussion_r376811872) to implement any logic. It makes for way more robust and easier testing, but is also an extra step and not the most intuitive abstraction.

* * *

A main source of frustration I experience still (before the refactor as well) is how configuration values propagate in multiple formats throughout the entire system. From `src/cli` to `src/core` to `src/backend` to `src/plugins`.

Having the instance system, reworked CLI and a better configuration abstraction, I think will greatly reduce code churn here.

Possibly some of these points will be included in [Productivity / Quality of Life for instance maintainers](https://discourse.sourcecred.io/t/productivity-quality-of-life-release/651). However:

> This initiative is to **save time and make it easier** to maintain a SourceCred instance.

I’ve deliberately not included **easier / time saving for developers** here. So if these further refactors are time consuming and don’t help instance maintainers much, I’m inclined to punt on it for a while.

---

_[View the full topic](https://discourse.sourcecred.io/t/refactoring-the-load-system/629)._
