DEV Community

loading...

Discussion on: React: thoughts from an Angular developer

Collapse
mikejunt profile image
Mike Juntunen • Edited

I'm also a relatively junior developer who was taught with Angular, and indeed a lot of what you mention about React frustrates me enough that I've put off learning it until I'm forced to do so.

With that said there's only one place I really disagree with you:

I don't understand why anyone would want to program in raw JS and every time I'm forced to do so I'm constantly frustrated by the lack of everything from predictive input to typo protection. I suppose that TS is a bit of a hill for people who aren't used to it but it's so very worth it. In fact, understanding it (and Angular architecture generally) has enabled me move into other object oriented languages much more easily (C# in my case, as my employer works in a .net stack with Angular frontend).

To my eye TS makes javascript into a normal programming language with mostly expected behaviors (though you can still avail yourself of truthy/falsy checking whether a variable is defined or undefined).

The only reason in my experience to write raw JS are libraries that mostly force you to do so. Even then in my experience just copy/pasting it all into a TS file is extremely efficient in catching a variety of bugs

Collapse
wkrueger profile image
Willian Krueger • Edited

Ive usually noticed 2 kinds of people who run from TS:

  • Programmer who got traumas from old Java days. They fear the types will hinder the development too much and usually fail to grasp that TS is nothing like java/C# because its is a lot more flexible.

  • Programmers who started at JS/python and never effectively got to work with static typing

Collapse
dawlz profile image
Dawlz

I am the second kind but after working with TS on a react project, I found it kinda interesting.

Collapse
mikejunt profile image
Mike Juntunen • Edited

I understand it seems like extra work starting out, but man the amount of time and energy you save is really unparalleled and it's no great question why modern languages pretty much always incorporate these features

I've actually wondered why no one has ever attempted a TS/C# equivalent for Python. I know it's used for some different applications than C/JS but you'd think the benefits exist

For me, understanding how TS was created and structured to let C# developers apply familiar programming principles to JS enabled me to follow that path backwards and use my understanding of what TS did to understand how C# was intended to operate.

Working in React, or raw JS in general feels like a concession to today: a necessity because it's what we're already using, because its faster for a simple implementation, and so on. Working with TS and Angular makes me feel like I am also developing skills that are transferrable to other languages and applications. I am a junior full stack dev, so that kind of transferability is important to me.

I think a lot of TS-skeptics probably don't know or haven't really stopped to absorb the fact that TS is set up to allow any valid JS code to work: if there's something you want to write w/o using TS's features, it's guaranteed to work. So it really doesn't have a downside: You can take what benefits you want, even if that's just defining object interfaces so that your IDE knows what your object keys are, and still write any code you don't want to use those features with without modification.

Thread Thread
wkrueger profile image
Willian Krueger • Edited

there IS a "TS for python", but its still growing. It didnt have the explosive growth of TS.

The guys at dropbox (which had Guido Van Rossum) pionereed mypy. From the mypy experience they incorporated PEPs on what python type checkers should agree.

mypy has a bit of a lackluster editor experience, so MS is pushing their own python type checker, PyRight, which is more IDE-friendly. Yeah, and they hired Guido. I frown that pyright is written in javascript (not even typescript... probably for easier VSCode integration).

Havent used pycharm lately but they probably also implement their own type-checking instead of relying on mypy.