I totally agree! This is actually how it's done in the Rust ecosystem. Though, instead of create, the typical naming convention is new. But create also conveys the same semantics! 👌
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Cool trick indeed!
You could define one factory by convention, e.g.
await Spotify.create(code)
and apply in your codebase.I'd prefer that to "fetchUser", because you will need more static methods if you want to add behavior.
A single entry point for a class, and then you can have as mathods as necessary.
I totally agree! This is actually how it's done in the Rust ecosystem. Though, instead of
create
, the typical naming convention isnew
. Butcreate
also conveys the same semantics! 👌