, ,

A Practical Introduction to TypeScript for PHP Developers

 

Experienced developers will have seen the rise and fall of a number of development trends and fads, so it would be easy to dismiss TypeScript, a JavaScript superset that compiles into plain Java. TypeScript, however, improves on a number of areas where naked JavaScript struggles, and already has substantial industry support. This article will outline why you should view TypeScript as more than a passing fad.

First, in addition to any benefits TypeScript brings to Java development, it has the backing of some industry giants. First appearing in 2012, and in spite of it being free and open source, TypeScript is developed and maintained by none other than Microsoft. More than that, the top Java Framework, Google-developed Angular JS, which powers over 4% of the top 10,000 web sites (almost four times as many as it’s closest competitor), has adopted TypeScript as its favourite language. With the functional backing of both Microsoft and Google, and integration with the market leading JavaScript framework, it is unlikely that TypeScript is going to go away any time soon.

Next, consider some of the benefits TypeScript brings to development. As a starting point, TypeScript is seamlessly compatible with JavaScript, and is, therefore, able to make use of existing code and libraries without issue.

TypeScript’s main selling point is the implementation of static typing, generics, and class-based object oriented programming into JavaScript. At a glance, these features, especially static typing, can appear to increase workload rather than reduce it. But this is only true in the short term, as strong typing leads to more errors being caught far earlier in the development cycle. An extra few minutes at the start of a project establishing strong typing can lead to dozens of hours of bug hunting saved down the line.

The main selling points lead on to the spin-off effects, which include improved quality of life and maintainability. Even apart from the readability benefits inherent to strongly typed code, TypeScript allows editors to provide contextual documentation, cutting down on development time and improving developer job satisfaction. Further, typescript implements static analysis error checking, leading to far fewer typographic and basic logic errors which could otherwise cause headaches down the line. Lastly, TypeScript enables editors to automatically refactor code, meaning changing a variable name in one spot can change it throughout the code automatically.

The fact of the matter is that TypeScript is not going away. It has been adopted by major players in the industry, and is, therefore, at a minimum, worth learning in order to include it on your CV. However, TypeScript also adds significant error checking features, meaning that the time spent learning the framework could easily be saved and surpassed over just a handful of projects. TypeScript is not a fad to be ignored, but an advance to be embraced

 

Written by Mathew Kimani – PHP Web Development Talent Sourcing

Twitter- @MattKimani

Linkedin- Mathew Kimani

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *