3 ms·
Something I've seen a few times in Go and java: Make login() a constructor for the AppClient, or declare what's essentially a factory called "AppClientConfig" w
by tetha 3y ago
Something I've seen a few times in Go and java: Make login() a constructor for the AppClient, or declare what's essentially a factory called "AppClientConfig" with a login() function to create the AppClient.
I've only recently started to think about using factories like that, so I'm very sure there are patterns of dynamic state I wouldn't have a recipe for, but it's a prety appealing idea to me.
- nerdponx 3y agoThat's another good way to do it for sure, and IMO badly underused within the Python ecosystem specifically.
- paholg 3y agoThat's called RAII, and I'm a big fan (not of the name, though. It's a terrible name). https://en.m.wikipedia.org/wiki/Resource_acquisition_is_initialization https://en.m.wikipedia.org/wiki/Resource_acquisition_is_init...