DEV Community

Discussion on: Slowing Down (to go faster)

Collapse
 
jankapunkt profile image
Jan Küster 🔥

Localization was also one of the things that had me start to understand the frameworks, libraries and tools I use to the deepest level. There was this point where I totally messed up on an architectural level and could not localize packages/dependencies in a flexible way without sacrifices of bloating things Up. I started to read much more and more carefully and I never regretted that decision.

Collapse
 
pkaplan profile image
Paul Kaplan

Oh yeah especially the part about bloat, any good references you’d recommend?

Collapse
 
jankapunkt profile image
Jan Küster 🔥 • Edited

Hard to narrow down to specific literature. I mostly read Domain-driven Design from Evans and the C4 model for Architecture plus design pattern and anti pattern and worked my way through the code. Especially dependency injection is in JavsScript so good to implement, because of functions being first-class citizen.

My current l10n setup uses an internal module with an adapter pattern, that is an empty class that provides a common interface to all my components, no matter which i18n framework or package I actually use and this class gets injected the actual l10n handler. I use the common interface even in my packages, make it package devs easy to implement l10n in the way they like, because I don't restrict anyone to use a specific l10n framework but let them use theirs.

This is in the beginning a huge effort but in the long run a total dream to maintain. You would also think that this is more code (regarding the bloat) but it is not. The bloat started when I had to fiddle with multiple times the same l10n implementation in my host app AND in packages AND services. Now I can narrow this down to every part using a minimal part of the interface (that's the good thing when you split code in Functions; use Object-destructuring for parameter definitions) instead of full implementations.