Is Redux using a sanitized God object pattern

redux

While learning about Redux, the God-object pattern(or anti-pattern) came to my mind- both have a single big object holding all the app data and methods to manipulate them. But Redux has put some constraints like making the Object immutable and events pure functions maintaining strict signature.

So the question came, is Redux using a sanitized version of God object? Or, there is something to do with Javascript not being classical strongly typed OOP?

Best Answer

What is a God object? From Wikipedia:

Most of [a God object containing] program's overall functionality is coded into a single "all-knowing" object, which maintains most of the information about the entire program, and also provides most of the methods for manipulating this data. Because this object holds so much data and requires so many methods, its role in the program becomes God-like (all-knowing and all-encompassing).

The Redux store only contains one data object and only requires 2 or 3 methods. In this respect it's hard to imagine thinking of it as a God object. It is decidedly not "all knowing."

Now if your reducer is not broken up at all, if all of the logic is in one function, then that might qualify but it's a simple matter to break up the reducer into a bunch of smaller pieces to avoid the situation.

Related Topic