Why Angular and Typescript

The decision was made to hire an outside firm to do the bulk of the rewrite of the scouting system. The backend is going to be in Java running on an Apache Tomcat instance and the frontend is going to be written with Angular. In order to be able to handle the customizations in-house after the bulk is written, I figured it would be a good idea to learn a bit about it.

Templating in general

Everything is very “inline” so it blends with HTML fairly seamlessly. Angular makes use of various brackets and braces to keep itself separate from plain HTML. Combined with their own structural directives, it’s fairly easy to build a templated page. The ecosystem also does a bit of lifting for you when creating new components, creating an HTML, TypeScript, CSS, and test file for you.

Comparisons to Django

Django is a little less integrated into the HTML of its templates. Which makes a bit of sense, Angular makes heavy use of JavaScript at the end of the day, so works within the paradigm of manipulating the DOM. Django is more server-side, so it’s trying to build the page before hand.

Django also covers that backend side. You can use Django to build your datastore and API as well.

Comparisons to Javascript

Typescript is a superset of Javascript, which means all Javascript is technically Typescript. But not all Typescript is Javascript. Which means, if you know Javascript, you know enough Typescript to get started. And Javascript itself has changed a lot over the years. Combined with that and all of the ways Typescript guards against Javascripts nastier corners, it’s just a better Javascript.

What I Like

The inlining of the commands and directives of Angular is nice. It feels like an extension to HTML. Typescript is also, like I said, a better Javascript. You can pick up the Typescript specific bits at the rate you choose. Stricter typing is something I like. I’ve not run into an instance where dynamic typing is required. And it seems more often than not just a way to avoid designing things.

What I Don’t Like

I still write way more Javascript than I should. Typescript needs to be “transpiled” before being run. Javascript makes me lazy. I like saving the file, refreshing the page, and inspecting the results. Although saying that out loud, I realize I could likely just have that be the build process for Typescript.

Things I Had To Adjust To

Promises, promises. Or, actually, observables. I just think the “promises” line is funny. It feels all async with no await. It also gets me all “nesty”. I find myself chaining calls, which is just chaining subscriptions, so I wind up nesting closures. Especially when I’m just spitballing ideas. I like seeing a thing work so I often prototype as I go.

I also need to spend some time separating the three things: Javascript, Typescript, and Angular. It’s been a minute since I’ve done any serious work with Javascript, and there’s a lot of changes. So some things I think I like about Typescript might be things Javascript just does now. And then there’s the parts where something is part of the Angular ecosystem, but seems part of Typescript because I just don’t know any better. There’s also the case where something isn’t a part of either per se, but is a third party library used by Angular. Which I think Observables fall into.

Final

So, I have a long way to go, but I hope I have the chance to get there. I have a couple of projects I think I might implement with Angular so I can get a better understanding of what things are.

By toast