4 ms·
The article mentions object-oriented programming several times as a helpful paradigm (especially for domain-constrained problems where DDD is helpful). I’d als
by TimTheTinker 8y ago
The article mentions object-oriented programming several times as a helpful paradigm (especially for domain-constrained problems where DDD is helpful).
I’d also like to point out that functional programming is tremendously helpful for solving these types of problems, especially when combined with use of modules. TypeScript is absolutely capable of modeling, checking, and otherwise handling types in a functional programming context.
— this is one of its best strengths in my opinion, and one reason I now prefer TypeScript over C#.
- mandeepj 8y ago> TypeScript over C# TypeScript is a transpiler for JS. C# is a server side language. Can you please clarify how former is the replacement for latter?
- charrondev 8y agoI don’t want to speak for the OP here, but when I refer to Typescript in comparison to other languages I tend to mean Javascript + the type system provided by the Typescript. Typescript is not even necessarily the transpiler nowadays. I use Babel for that and use Typescript exclusively for static type analysis in CI and during development.
- weyman 8y agoThey could just be referring to the language itself e.g. syntax and structure, not necessarily its primary use case.
- dcre 8y agoJS is also a server-side language.
- TimTheTinker 8y agoI didn’t mean as a replacement for C# or an alternative for a given project. I meant my personal preference as a developer (I do often get to choose what language to use, if only by where I choose to work or what projects I take on).
- sonnyblarney 8y ago"C# is a server side language" Node.js is very popular, making TS/JS available 'on the server side'
- lewisl9029 8y agoI really hope I don't come off sounding needlessly contrarian, but I've had the complete opposite experience when it comes to TypeScript and functional programming. I posted about the specific issues I ran into here, and they seem to be pretty fundamental w.r.t the ability of TypeScript's type inference to work with function composition in general: https://news.ycombinator.com/item?id=19600475 https://news.ycombinator.com/item?id=19600475 But the fact that you (and presumably plenty of others) seem to be having a great time with functional programming in TypeScript leads me to believe that there might be something I'm missing that could vastly improve my experience with functional programming in TypeScript as well. I'd love to hear any further thoughts anyone might have on this topic.
- kaoD 8y ago> But the fact that you (and presumably plenty of others) seem to be having a great time with functional programming in TypeScript leads me to believe that there might be something I'm missing I've noticed "functional programming" turned into an umbrella term. For some people it means Haskell: strongly typed lazy evaluation with a focus on ADTs and functions that operate on them (i.e. methods) to achieve composition. Heavy use of pattern matching. For others it means Clojure: dynamic language that favors raw duck-typed data manipulation. Heavy use of macros. Then there's the pointfree crowd: very little use of literal functions, most of them are just composition of curried/partially-applied primitives. For many it just means "I use map/filter/reduce". And for most, it's just a mix-and-match of subsets of all those. My experience matches yours: Typescript is mostly fine with map-filter-reduce and that's it. I'd love to be proved wrong though.
- innocentoldguy 8y agoI found functional programming in TypeScript a bit cumbersome. I think Elm is much more accessible if you’re looking to do functional programming in a JavaScript environment.
- koyote 8y agoAlthough I haven't used TypeScript extensively, I fail to see how it has better support for functional programming over C#. Could you provide some examples?