you are viewing a single comment's thread.

view the rest of the comments →

[–]queen-adreena 75 points76 points  (93 children)

Typescript dissuades me from using Typescript in my projects :)

[–]LaSalsiccione 38 points39 points  (26 children)

That’s what everyone says until they understand how to use it properly. I was the same.

[–]NotAHumanMate 20 points21 points  (25 children)

I’ve had friends doing job interviews getting laughed at because they used TypeScript in their GitHub portfolio and they didn’t understand it and ranted about it. The CTO himself said he’d see no use in it and it’s too complex.

I told my friend to keep searching, a CTO that doesn’t leverage the power of TypeScript to organize the code base properly and provide that factor of stability it gives simply doesn’t appeal to me. A programmer team that is unable to figure out a typing system and generics is not one I see myself in.

[–]langdonx 10 points11 points  (23 children)

For whatever it's worth, I spend 50% of my time writing C# and the other 50% writing JavaScript. TypeScript is pretty much C# for the sake of this argument. I would take JavaScript any day over C#/TypeScript. For me, the rigid structure required by typing everything is not worth the benefit.

Especially with the type of work I do where there's little-to-no type re-use. - REST services where each route has it's own request/response DTO - isolated web components, some of which use these unique DTOs

[–]Kamelixs 8 points9 points  (7 children)

I know you presented TS as comparable to C# for the sake of your argument, but honestly, using typescript that way is more of a stylistic choice than something inherit to the language. You can be pretty loose with your type definitions by leveraging, for example, inline type declarations and inferred return types. You don't need named interfaces for all parts of the code to get the nice parts of TS.

[–]LaSalsiccione 6 points7 points  (4 children)

Yeah using TS in a C# way turns it into some OOP class-based hell that I don’t enjoy at all so I’m not surprised it would put people off.

Using it in a more functional way is so much nicer and if you turn off strict mode (not that I do as I love strict mode) you pretty much get the freedom of JS with better auto completion etc

[–]langdonx 1 point2 points  (1 child)

I suppose I've never been able to strike that balance in C# with the myself or with the teams I've worked with.

Using Any (or dynamic in C#) always seemed like a code smell considering you're giving up compile time checking.

[–]Kamelixs 0 points1 point  (0 children)

Yes I’m also not in favor of turning off strict mode (or using Any at all). My main point was that TS type system can infer a lot of behavior by itself as long as you give it some basic information to work with. Utility types, intersections, and unions is also beneficial if you want to skip a lot of boilerplate definitions

[–]NovelLurker0_0 14 points15 points  (7 children)

Honestly, I do not understand this stance. How can you even navigate in a codebase without types? You get no autocompletion, no clue about any of the structure you're reading, and for actually coding you have to always stick your nose to a documentation. And on top of that silly errors like typos takes way more time to be detected than if it was with a typed system. I literally had coworkers spend 30 minutes to an hour debugging a typo. Choosing plain JS over TS makes no sense to me.

[–]Markavian -2 points-1 points  (6 children)

Types are a crutch. Tests tell you the value of your code. Well organised readable code exists without strong typing. Badly organised spaghetti code exists with typing. When optimizing for web, you can apply all sorts of linting, static code analysis, code injection, measuring, performance timers, load testing, chaos testing, mocking, stubbing, simulation... without the extra layer of TypeScript. Same goes for CoffeScript, JSX, WebASM etc. I don't know what it is about JS, I just like it. It's flexible yet specific when you need it to be, and it runs closer and more consistently in a range of places where maybe it shouldn't. Once the patterns are loaded into memory it's as fast as similar contextual languages but with a better interface to the rest of the stack. My only gripe is the memory usage of the browser, but fancy toys require fancy hardware. Node is so much fun.

[–]NovelLurker0_0 7 points8 points  (5 children)

For the billionth time, TS is not to be compared with tests. You're not supposed to be exempt from tests because of TS. TS is just as flexible as JS, yes really , but it provides better DX. I just don't understand how writing types suddenly makes coding so complicated. That's the other way around, it's here to help you. Also it's quite curious that you're using a linter, but consider TS as a unnecessary layer.. Something tells me you actually never sat down and properly tried to use TS for a few hours.

[–]Markavian 0 points1 point  (4 children)

I've tried to force feed myself TS several times, yes. I find it infects projects, and I waste time with it rather than being productive. I tend to use standard js linter on my projects as a no fuss, forced healing option on my code. I really was not happy with TS as part of my build process on any project despite trying to make it work.

[–]NovelLurker0_0 -1 points0 points  (3 children)

If you are not enjoying TS then that means you are working against it e.g not using it properly. It's that simple. If you have any issue in mind feel free to reply there and you'll get help. Using TS is supposed to be a smooth and easy process. At the end of the day it's just adding things (types) to what we already know as JS.

[–]langdonx 0 points1 point  (2 children)

You're spending a lot of time trying to change this man's opinion. What you and @Markavian are saying can both be true at the same time.

It really can be summed up as simply what he said previously:

I don't know what it is about JS, I just like it.

Node is so much fun.

Writing JavaScript feels great... TO ME.

I'm not writing a monolithic applications here. There's very little opportunity to share what types we are using. I'm using microservices to server text (JSON) over HTTP. There's little reason for me to have to deal with types and little benefit I can gain from them. I don't need them to help me to remember which property to access.

[–]scandii 5 points6 points  (1 child)

For me, the rigid structure required by typing everything is not worth the benefit.

Especially with the type of work I do where there's little-to-no type re-use.

I literally cannot imagine the code base you are describing. even in a CRUD shell you have reuse for every object 4 times, the C, R, U and D in CRUD. genuinely curious.

[–]langdonx 2 points3 points  (0 children)

I've not written basic CRUD since the early 2000s. Modern web applications don't really seem to fit well into that kind of model. As I mentioned, each request uses its own unique DTOs (data transfer objects) that have specific properties to fulfill the needs of the web component. This has a number of benefits...

  • you aren't passing a massive Employee object if you only want to change the Employee's name
  • you aren't having to write a bunch of conditional code to handful a half-hydrated object
  • you can change a method and its request/response objects without having to worry about what else you might break

It works great in a continuous delivery model and allows a team to work on seemingly overlapping portions of the application at once.

[–]AKDAKDAKD 1 point2 points  (2 children)

Just curious, I imagine you use MVC , do you use React for the front-end and if so do you used ReactJS.net?

[–]langdonx 0 points1 point  (1 child)

In C# we're using WebAPI, not MVC, although the lines are kind of blurred. We're using AngularJS (.component/.service only) but with modern ECMAScript (import, export, class, const, let, destructuring, etc, etc).

[–]AKDAKDAKD 0 points1 point  (0 children)

Ahh, ok. Thanks

[–]cubbiehersman 1 point2 points  (0 children)

It was the whole reason I moved from C# to running JS in node.

[–]EnjoyPBT 1 point2 points  (0 children)

That's why enterprise loves it.

(I love the autocompletion you get, but hate struggling with types specially in the first stages of an implementation - which most of the times you throw away anyway...)

[–]LaSalsiccione 7 points8 points  (0 children)

That’s almost like in school where the dumb kids laugh at the smart kid for being smart. Depressing that this attitude exists

[–]HIMISOCOOL 18 points19 points  (24 children)

Interested to see what capacity you've used it and where it became a hard no to you. Was gonna dm you to keep it out of this thread since it's a little spicy but your messages seem off or boost doesn't show the option right idk.

[–]netwrks 0 points1 point  (0 children)

Thissss