am i crazy or are #php backed
enums the factory pattern with a little extra spice? i think i would be displeased by prefixing my factories with the enum keyword though. anyone do this? tell me more.commit c1f2d4e
Well, it makes sense that you’d see it that way because of the superficial similarity, but be careful, there’s a trap here, and it’s to confuse syntactic convenience with architecture.
Ultimately, a backed enum lets you do something like…
I don't see the problem if it's for creating simple instances. For example, I've used it for deciding which event to fire.
But for factories with a lot of decency injections I'd stick to a proper factory.