Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

TypeScript Seals My Penchant for JavaScript

$
0
0

By Frank Garcia, CEO and Founder of Cycligent and Improvement Interactive

My life as a professional programmer started off in C. I have written in Basic, Pascal, Python, C++, C#, VB, VB .NET, Java and JavaScript.  Until five years ago, the vast majority of my time had been spent in Java, C and its many varieties, with a healthy amount of Basic varieties thrown in for good measure.

Five years ago, I was architecting a major web application for a client with over 350,000 employees. We used Java on the backend but we began writing much of the front-end directly in JavaScript and so my serious JavaScript journey began.  I say serious because of course I had written in JavaScript, but these were adjuncts to real programs, not real programs themselves.

JavaScript to the Fore

I ended up writing a lot of JavaScript over the course of the next three years. I did not find it all that enjoyable. I longed for my “real” objects and my comfortable, well-worn tools. It was not fun.

At about the two year mark, however, something happened. I began to really change my thinking and the expressiveness and freedom of JavaScript became a boon. By the three year mark, I was really into and excited by JavaScript.

I would go back and code in C# or Java and just felt horribly restricted. It was like the language was trying to control me instead of the other way around. Suddenly, I found myself on the other side of the fence. I was loving writing in JavaScript, and writing in the classic object oriented languages now seemed like a chore.

Cycligent.js

I think part of the transition came from developing a micro-library, Cycligent.js, that allowed us to scale JavaScript to enterprise-level programs effectively. You can find Cycligent.js on GitHub at (https://github.com/cycligent/cycligent.js). While Cycligent.js allowed us to turn the corner, it still had some frustrations, like having to add a line at the beginning of every function to type check arguments. So JavaScript was still less than ideal, especially because it was difficult to refactor and, at the time, there really was not a server side option.

Refactoring

Refactoring was much more difficult with JavaScript than Java or C#. This was mostly a tooling issue. Because of JavaScript’s “freedom” the tools could not be sure of what to change and, thus, refactoring was mostly a manual process.  Even as the tools became more advanced you couldn’t really have the confidence to just let them go do the refactoring process. I am not sure which was worse, doing the refactoring manually, or reviewing what the tool thought should be done.

Node.js

Node.js came along to not only solve the server side issue, but to provide an outstanding server-side platform with capabilities far beyond that of just a web-server. We developed a server-side framework (see www.cycligent.com) and have been writing backends in Node ever since.

While there were still some significant frustrations with JavaScript, it was, for me, much better than working with C# or Java. I enjoyed it. I was productive. For me the choice was clear. That being said, I did, of course, want my frustrations to go away, enter TypeScript.

I would not have tried TypeScript if not for Angular 2. I am not usually at one with the concept of transpilers. But as an early adopter of Angular 2, TypeScript was the path of least resistance. So I began using TypeScript and I am so happy I did.

TypeScript – The Best of Both Worlds

TypeScript gives me the best of both worlds. I am able to keep the freedom and expressiveness of JavaScript to which I have become so accustomed while getting enterprise-level type checking and refactoring capabilities. Declaration of objects and interfaces is a dream.

I use TypeScript both on the client and on the server. My preferred stack at the moment, which I call The CAN Stack, is Cycligent, Angular 2 (including TypeScript) and Node. My database of choice is MongoDB as I can transfer objects without impedance mismatch issues and their associated busy-work.  That being said, I often hookup to SQL DBs as I/we do work with large enterprises.

Thinking about trying TypeScript? I highly recommend it. Please let me know your experiences with TypeScript (and hopefully Cycligent – www.cycligent.com).


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>