Cadastre-se agora para um orçamento mais personalizado!

Programming languages: Microsoft's TypeScript shows vision can beat skepticism

05 de outubro de 2022 Hi-network.com
Image: Deagreez/ GETTY

It's been 10 years since Microsoft unveiled TypeScript, a programming language that would develop alongside JavaScript but offer new ways for developers to manage large and chaotic applications.

The TypeScript team and Microsoft technical fellow and father of C#Anders Hejlsberg unwrapped the first preview of TypeScript in October 2012, describing it as a superset of JavaScript that brought static typing to the dynamically typed language. The goal was to catch errors faster and extend JavaScript from building web pages to larger applications running in the browser, devices and the cloud. 

Featured

  • New iPhone 15 Pro overheating reports: Still too hot after iOS 17.0.3 and fresh issues arise after the update
  • Generative AI will far surpass what ChatGPT can do. Here's everything on how the tech advances
  • iPhone 15 Pro review: Prepare to be dazzled
  • The best USB-C cables for the iPhone 15: What the experts recommend

As Daniel Rosenwasser, a senior program manager on the TypeScript team, noted recently: "When TypeScript first debuted, there was a lot of skepticism -and understandably so. To some JavaScript users, a team trying to bring static types to JavaScript might have sounded like an evil plot or a joke."

Also:The most popular programming languages and where to learn them

Yet TypeScript is firmly a top 10 most-popular language today, along with Python, Java and JavaScript. It's also the fourth 'most loved' language in Stack Overflow's annual survey, behind Rust, Exlixir, and Clojure. A major turning point for TypeScript happened when the Angular Team at Google announced it would build its web framework in TypeScript. 

Hejlsberg has described TypeScript as an "alter-ego" to JavaScript that's faithful to current and future ECMAScript proposals. 

TypeScript has two birthdays -by 2012, it had already been under development for two years internally at Microsoft. 

Ahead of the tenth anniversary of its unveiling, Hejlsberg explains to why he started working on TypeScript: prior to 2010, the browser wars were over, Google had created its powerful V8 JavaScript engine for Chrome, JavaScript had gotten somewhat faster, and HTML5 was happening.

But at the same time, developers were building huge JavaScript apps that lacked features such as modules, classes, and -crucially -a type system, which allows developers to "reason about your code" in the way modern tooling, such as VS Code's IntelliSense, allowed with code definition, code completion, and more. 

"A type system is one way you can reason about your code. It's the ability to check your code before you run and deploy it. Without types in a language, that's almost impossible," Hejlsberg explains. 

"So, we started looking at what we could do to address these issues to build better tooling for JavaScript. That was really the genesis of TypeScript. The key was to add a type system to the language in a way that doesn't take away all the things that made JavaScript so popular in the first place."

Hejlsberg realized TypeScript had to be open source to win JavaScript developers. 

In 2012, Hejlsberg had an interesting discussion with Lars Bak, who co-developed Dart at Google in 2011 and created V8. Dart and TypeScript were aiming to solve Javascript's problems with two different approaches. 

While TypeScript was solving the problems for applications through a type system and tooling, the Dart approach offered object-oriented language and optional static types with performance advantages via a Dart virtual machine in Chrome. Hejlsberg and Bak wanted JavaScript to run faster and agreed it couldn't be achieved through ECMAScript standards.   

As ZDNet's Mary Jo Foley asked when TypeScript launched in 2012, why didn't Microsoft just back Google's Dart instead? Microsoft could have done so, despite TypeScript being a rival in the JavaScript space. And, as she noted, developers also had Script#or CoffeeScript to make JavaScript programming easier.

Also: What is digital transformation? Everything you need to know about how technology is changing business

Hejlsberg's answer eight years later was to ask why developers should "bend over that far backwards to write in JavaScript... Because surely you're not going to build a best-of-breed development experience for JavaScript by telling people to write in a different language." 

He continued: "So we started looking at what we could do to address these issues to build better tooling for JavaScript. That was really the genesis of TypeScript. The key was to add a type system to the language in a way that doesn't take away all the things that made JavaScript so popular in the first place."

Rosenwasser, speaking of TypeScript's success, noted recently that TypeScript's design goals "really point TypeScript towards simply being a type-checker for JavaScript, adding only syntax that's necessary for type-checking."

He said: "TypeScript had to be free and open source, and done in a truly out-in-the-open manner. It also had to interoperate seamlessly with existing JavaScript, co-evolve with JavaScript, and feel like JavaScript. TypeScript never set out to build a separate, distinct, and prescriptive language. Instead, TypeScript had to be descriptive -innovating in the type system around conventions and patterns found "in the wild" of the JavaScript ecosystem."

Rosenwasser said there have been requests for TypeScript to be a "a linter, a bundler, an optimizer/minifier, a build orchestrator, a bundler (again), and more." But he also said Microsoft doesn't want to disrupt the ecosystem too much by displacing them. 

"Given all the different bundlers, different runtimes, different build orchestrators, and different linters over the past years, it's been crucial that TypeScript integrates well with each of these without trying to displace any of them," he noted. As a result, if Typescript needs a new feature, the team doesn't just add it to TypeScript, but works with the JavaScript standards body to guide or champion new features so that all JavaScript developers can benefit from them.

Developer

It's the end of programming as we know it -- againDevelopers feel secure in their jobs, but they're still thinking about quittingThe future of the web will need a different sort of software developerThe best Linux laptops for consumers and developers
  • It's the end of programming as we know it -- again
  • Developers feel secure in their jobs, but they're still thinking about quitting
  • The future of the web will need a different sort of software developer
  • The best Linux laptops for consumers and developers

tag-icon Tags quentes : Negócio Revelador

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.