Working on a platform for multiplayer/collaborative apps. Some sketches for what user written code could look like.
@threepointone I like classes 😿
@mehulkar a barrier to entry for most. maybe. I'll try anyway. I could always support multiple styles.
@threepointone oh I don’t like them enough to support both though. All of those styles are fine. Stack trace is easier with named things, but can achieve that with any of them!
@mehulkar @threepointone classes are fine I think?
@andrewingram @mehulkar such a departure from everything else. leaning towards option 3 atm
@threepointone I definitely think classes aren’t the move. feels like it would be a DX hurdle
@jlengstorf I’m gravitating towards option 3 atm, it’s also testable/composable
@threepointone cool, yeah. I like that. Looking forward to actually trying this out šŸ‘€
@jlengstorf you’re on the screener vip list
@threepointone @jlengstorf option 3 (and 1) may also lead you to define a standard like Storybook did with stories. It could work across different engines without modification.
@patak @jlengstorf that’s the vibe I get too…
@threepointone would simple functions or objects do better than classes? What are classes getting you in this case?

@mattpodwysocki there’s always some state to hold for a ā€œroomā€ (like the content of a document being edited by multiple connections/users) so the class gives a convenient place to hang this state. Honestly that’s all. I’m leaning towards 3 atm, easier to test and compose.

(Also, hi!)

@threepointone hi!

I get that. On the Azure SDK we are moving to option 3 ourselves or at least allow for a hybrid approach of the classical sense and the option 3 compositional approach https://gist.github.com/mpodwysocki/321a24404bd38be4980c331d8da9537c

modular-design.md

GitHub Gist: instantly share code, notes, and snippets.

Gist
@mattpodwysocki love this resource, going to copy some of these justifications. Thanks!
@threepointone yeah I’ve got further thoughts I’m probably going to add to it but the design itself is already in some of our SDKs like this https://www.npmjs.com/package/@azure/notification-hubs
@azure/notification-hubs

Azure Notification Hubs SDK for JavaScript. Latest version: 1.0.0, last published: 5 hours ago. Start using @azure/notification-hubs in your project by running `npm i @azure/notification-hubs`. There are no other projects in the npm registry using @azure/notification-hubs.

npm
@threepointone but feel free to take what you like and glad some folks are finding some use of it!
@threepointone I’m interested why event listeners aren’t as secure
@jamiebuilds compromised/malicious third party libs can also register listeners. The function/class form also lets you inject secrets and bindings and let’s you decide how to thread that down through your code, but harder to do this with the listener form (These are the same arguments for the listener versus export form of Cloudflare workers)