News for hackers. Stuff that matters.
Re:What's New in F# 9 by CharlieDigital on Monday November 11, 2024 @09:13AM (#42107236)

    > C# culture is closer to enterprise Java than it is to Typescript
I mean, this really depends on what you're looking at.

Here's a sample from the MongoDB client: https://github.com/mongodb/node-mongodb-native/blob/main/src...

Here's a sample from Storybook: https://github.com/storybookjs/storybook/blob/next/code/core...

Here's a sample from Prisma: https://github.com/prisma/prisma/blob/main/packages/client/s...

Here's a sample from Cal.com: https://github.com/calcom/cal.com/blob/main/packages/core/Ev...

These are all fairly mainstream repos so it's not a one off to see "enterprise" style coding in TypeScript.

It's rather the specific use case that determines the style of the code that's written. In the examples above, there's no need for the teams to choose JavaScript classes and inheritance to model the logic, yet it likely better fits the programming model of those modules.

Look at Nest.js as well: https://github.com/nestjs/nest/blob/master/packages/core/rou...

The whole codebase of Nest.js looks an awful lot like Spring or ASP.NET (controller syntax) probably because there's a lot of crossover in terms of what APIs need at scale and how to logically organize that logic.

It just so happens that most use cases for C# and Java favor applications at a larger scale. Another key difference being object scope and lifecycles -- something that rarely comes into play in the generally single-threaded Node runtime. This being one of the key reasons why dependency injection is a thing in C# and Java land.

There are no comments on this comment yet.