Tomas Baran
1 min readMar 2, 2022

--

Thanks a lot for your opinion Suragch. I agree with you on many things such as don’t optimize prematurely; simplicity is very important.

One thing I don’t necessarily agree is that you wouldn’t end up with 50 (lazy) singletons. E.g. in my current app, it looks a small app on the outside, it has only 3 tabs and each tab has a few pages/screens. Keep in mind that each screen is consisted of various widgets (which could be controlled not by one big manager but each of the widgets could be controlled by a seperate manager/controller.) Most of my users actually go check every part of the app, so I see very easily how users end up with opening 50+ (lazy) singletons.

On the other hand, I agree that the state managers don’t need to be registered as singletons. You mention they can be registered as a factory. I didn’t know that and got intrigued by this. Can you please provide a concrete example with a code?

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Tomas Baran
Tomas Baran

Responses (1)

Write a response