We originally designed Simpla as a distributed system, with no ‘core’ that controlled things. Instead, we built a menagerie of utility components that Simpla’s elements used to communicate with each other and the API independently.
While neat in theory, in practice this caused a lot of issues and didn’t offer any practical benefit:
Many moving parts were hard to maintain and test.
More than anything it meant Simpla was hard to reason about - which component should be considered the ‘source of truth’? Independent elements and not being a framework was good, but fragmentation was bad.
Enter Simpla v1
Simpla core now controls the global state of Simpla on your site. Each element observes the global state to know when it should become editable, save/fetch data, etc. The SDK also provides the low-level methods for talking to the API, for things like getting/setting content and logging in/out.
We chose Redux
We decided on Redux as the pattern to model the new Simpla SDK on.
A ‘single source of truth’ was essential in keeping Simpla efficient and scalable, and this is one of Redux’s core principles. Simpla’s data store holds the entire state of Simpla’s ecosystem on your page. This means one place to read from and to update - simple, maintainable and testable.
Another big benefit of Redux is immutable data. The state of your Simpla app is read-only; making changes (like entering edit mode) guarantees a new version of the state, which means reacting to them is trivial.
Finally, sticking to a well defined logic pattern like Redux makes for a more maintainable, scalable codebase. It will allow us to move faster going forward, while not constricting the freedom of individual elements.
Reacting to changes in Simpla can now be done with a simple
observe method (full documentation coming soon!). Since the state is immutable, this provides us and other developers in the Simpla ecosystem and seamless mechanism to co-ordinate between elements on a page.
Isn’t Redux for React?
The old simpla-core
You may have noticed that we used to have another, undocumented
simpla-core package. That is now deprecated in favour of this new, consolidated library. If you're using the old core package updating to the new one should be fairly seamless.
And that’s it, welcome to the new Simpla! We hope you like it.