https://kotlinlang.org logo
#san-diego
Title
# san-diego
r

Rene

03/04/2024, 6:57 PM
I’m learning the Factory pattern in Kotlin, What’s your suggestion for creating a user with a Enum membership. a) using the method that describes the user created: User.createVipUser(“Tim”) which is clear based on the name or b) using a generic createUser(“Joe”, Membership.VIP) specifying the Membership Type and implementing the logic only using a create function , both approaches will be in the Factory companion object.
2 Views