DEV Community

Discussion on: What are the least intuitive fundamentals and best practices in software development?

Collapse
 
cjbrooks12 profile image
Casey Brooks

The whole concept of application "state". It's very much a part of the language of React and other functional-style frameworks/libraries, but that doesn't mean those are the only things that deal with state.

It can be especially difficult to understand state and its impact in a world like Android, where there isn't an established pattern for state management. Android has built-in support for marshaling state immutably between UI components without them needing to share a global object, but it is very tedious and requires an incredible amount of boilerplate, even when using code-gen tools. So most codebases don't do this properly, and subtle bugs start to become major issues as more and more of your app is sharing a data source with no governance.

But once you get used to the idea of passing all data around as immutable objects and not allowing yourself to "set and forget" variables, your codebase will become much easier to read and maintain, especially for new developers who didn't originally write it. Everything they need is handed to them, they don't have to go hunting for it.