-
Notifications
You must be signed in to change notification settings - Fork 1
Enterprise Developer Experience #106
Comments
Generally I'm off-put by the look of decorators and how they're often used to hide behavior. I wonder if I'm in the wrong given their persistent use in popular frameworks such as Angular and Spring. Other serverless frameworks are also using them and I've not seen any pushback on the pattern. I suppose this means developers are at least ok with them. ECMA Script decorators have been stuck at Stage 2 since 2019-01-15. In Typescript they are hidden behind the compiler flag Originally we wanted Stochastic to feel like a functional architecture while allowing developers the flexibility to use whatever feels most idiomatic to them within the handler functions. Ultimately I want whatever will make it easiest for people to grok their code. Code should be written first and foremost for humans to understand and only incidentally for compilers. @sam-goodwin How do you feel about this? How would this impact type narrowing on handler functions? |
I have also worried about how enterprise developers may be expecting annotations, but I think the idea that There are two reasons I think we should not use decorators. First, decorators do not capture information at compile time (at the type level). See microsoft/TypeScript#4881. We make use of that type-level information to provide helpful inferences that simplify and constraint the DX: We can validate that a type-signature is correct with decorators but we can not infer anything from them. If you look at our Another reason to not use decorators is that this doesn't make much sense.
The fact that something is a If we were to decide to move to decorators then we would be abandoning much of our current DX. We can leverage them where it makes sense, but I don't agree we should use them for our core declarations, Command, Policy, etc. I do agree with your sentiment that enterprise developers may be expecting something like Spring/Axon annotations and acknowledge it as a DX risk we need to collect feedback on. But using decorators would limit us in ways that I think would be decremental to the overall DX. I hope our DX is simple enough such that this is not a problem. |
To emphasize the points above, we should provide a demo of how we make use of these declarations to guide the experience. The contents of the |
If we were to switch to a decorator approach, then I think we would end up looking a lot like TypeGraphQL: https://github.com/MichalLytek/type-graphql. It's definitely something we should consider. |
I have to disagree here. If the DX strategy is based on keeping the developer in the IDE, that's fine. VB6 did that, as well, and had a lot of success. As did the Borland products before VB6 (enter irony). However, the generated code was untenable. You needed the proprietary IDE in order to modify the code. IDE's should not teach and protect the developer. That's, arguably, the job of the compiler. IDE's should be a force multiplier. So, is the direction of the DX to create a vscode extension? Or a new compiler? Something else? |
No, it is done with pure TypeScript. The types flow throughout the DX. Decorators don't have this capability. |
In an effort to meet the target audience (i.e., enterprise developers new to distributed applications and/or cloud) where they are, adopt development paradigms similar to what they use today. Ideally, the paradigms are language features (or similar).
For example, the following is a snippet from one of the Stochastic examples:
Using TypeScript decorators, the following captures the sentiment of this issue, using idioms common to enterprise development:
The text was updated successfully, but these errors were encountered: