📜 ⬆️ ⬇️

Interview with TypeScript Developers

TypeScript is a relatively new programming language that is compiled into JavaScript. Its main advantages are classes and type checking at compile time. The TypeScript compiler is open source, and the development is sponsored by Microsoft.

However, both the language and the compiler are still young and few people have experience in using it in real projects. But very rarely do you have a chance to try a new development tool on a real project: the risks of failure are too great and most customers will not accept this.

The more pleasant to meet people who had a chance to check it in “combat” conditions. I got to talk with two guys who made a TypeScript report editor.
')


Who you are? Introduce yourself.


Michael: Hello! My name is Michael. I have been working in DX ( Developer Express Inc., Tula office - interviewer note ) for 14 years. I started with Delphi (VCL), then there was C # ( eXpressAppFramework ) and for 3 years I have been actively writing in JavaScript / TypeScript. From the beginning in the DevExtreme team, where I was one of the team leaders, and since last year I have been developing the Web Report Designer .

Sergey: My name is Sergey. I taught at Tula State University, worked in the IT departments of large companies, now for almost 6 years I have been working at DX. He started with C / C ++ (MS Visual Studio, C ++ Builder), worked on the DX project on the eXpressApp Framework, then on the DevExtreme team, and now I'm working on the HTML designer for XtraReports Suite .

Who is on your team? How did they come about?


Michael: At the very beginning, our team consisted of me, another developer from DevExtreme and a developer from the Reports team. I must say that, historically, DX is strong mainly with its VCL, .NET and ASP.NET components. But we are optimistic about the future and do not want to lag behind the train of modern programming, which now, of course, is HTML5 and everything connected with it. But, again, I’ll make a reservation, C # programmers mostly work with us. Now we want to change this imbalance slightly.

Sergey: I am “another developer from DevExtreme” :) I worked there as a form designer, integrating with Visual Studio and PhoneGap containers for our framework.

How did you decide to use TypeScript?


Mikhail: I heard about TypeScript at the RIT ++ 2012 conference. Then it was one of the first versions. Frankly, it was damp and there were not many things that appeared in the next versions. But nevertheless, I tried it in small sandbox projects and I liked what worked.

Sergey: The DevExtreme framework is written in JavaScript and the project templates for MS Visual Studio at first were also only JavaScript-based. But in 2013, some of our users asked us to make definition files .d.ts for our framework and TypeScript-based project templates. We supported TypeScript and got strict typing and intelligence, which helped our customers a lot when “entering” the framework. We liked how the code looked in client projects. After that, we ourselves wanted to use TypeScript.



Why not use other solutions: CoffeeScript, for example?


Michael: The main reasons we chose TypeScript were:
  1. Close to C # syntax.
  2. Good integration with Visual Studio. This is rather a purely our advantage, as I noted above, we are all C # programmers, and this automatically means that our hands are sharpened by the "visual".
  3. Many things present in the language will soon be included or have already entered EcmaScript6. JS-code after compilation turns out very similar to what was in TypeScript code ( A small overview of the innovations: https://github.com/lukehoban/es6features - comment intverviewer ).
  4. A fairly flexible typing system and full JavaScript compatibility. In other words, you can choose which part of the system will be typed and which part will not - and this allows you to make very flexible solutions that are not available in the same C #.
  5. Microsoft stack.

With regards to CoffeeScript. From what I've seen, this is a good alternative to TypeScript. But now at CoffeeScript I do not see significant advantages in comparison with it. And if the TypeScript code base can be easily converted to EcmaScript 6, then I think it will be much more difficult to do the same with the CoffeScript project.

Sergey: At first, I was skeptical of all the wrappers around JavaScript. For me, TypeScript seemed easier when entering. Perhaps due to the proximity of syntax to C #, the possibility of using JavaScript code fragments in TypeScript code, the proximity of the translation result to the source code of the program, which allows you to debug even without map files if your code is used in some other place. And, of course, typing, intelligence, and quick code transitions help in working with a large project.

Did I understand correctly that you are considering the possibility of abandoning TypeScript with the release and universal implementation of the EcmaScript6 standard?


Sergey: I think that there is no sense in rewriting existing projects, but starting a new project right away on JavaScript EcmaScript6, if Visual Studio gives intelligence and type checking in the editor, why not. I'm used to these buns and I do not want to refuse.

What is the benefit for you that TypeScript is integrated into the stack of Microsoft development tools?


Mikhail: Our customers are mostly developers who are “sitting” on the Microsoft stack. And if they use something, then this is the thing that Microsoft recommends and promotes, and without any conditional it is TypeScript and we had to try it in order to better understand our customers.

Sergey: It's easy to start using TypeScript - it is even installed on Visual Studio Express Edition. You simply add a TypeScript file to the project, and you write - you do not need to configure anything else. For the sake of interest, screwed TypeScript to Sublime - you can work this way.

What difficulties had to be overcome?


Michael: In fact, we didn’t experience great difficulties with TypeScript. Perhaps only at the beginning, while developing the structure of the project (what, where and how it should be). But this is because of the principle: everything once happens for the first time.

Sergey: A couple of weeks I got used to the TypeScript syntax: my hands were typing either JavaScript or C # code.

How do you debug and profile the application?


Michael: We used a composite approach in debugging. Namely, the layout - basically, looked at Chrome, as it is convenient. There and debugged. Thanks to the map files, everything happens very organically and you do not notice that you are working with TypeScript, and not JavaScript. The only thing that sometimes there are problems with updating the source. You have to save more so that the code is regenerated. Microsoft's credit includes a very fast compiler since version 0.9.

Sergey: We are debugging the application in Chrome, it seems to me that it is more convenient to debug the tests in IE + VisualStudio: you can go back any line or jump a couple of lines ahead. Although in chrome, you can also restart skop. When debugging in Chrome, sometimes map files do not come up (sometimes at the very moment when they are most needed), but due to the readability of the resulting JavaScript code, this does not create any special problems.

How do you test the code? Writing tests?


Michael: In our company, TDD is a mandatory code development methodology. Therefore, everything was written on the Test First-methodology, and we must pay tribute to Knockout - it helps a lot in this matter. Those. First, the layout is written, then the binding is obtained that defines the interface to the view of the model. Next, we write tests for this twist model. Something like this if in brief. As a framework for unit testing ... There are no surprises here: we used QUnit. We have a continuous integration (where without bikes) in our DX, but we had no problems with it either.

Sergey: QUnit + “qunit.TypeScript.DefinitelyTyped”

Do you use any extensions for Visual Studio?


Mikhail: We used Web Essentials, which, I think, is the de facto standard for those who write something under HTML5, JavaScript.

Are you using frameworks? How do they integrate with TypeScript?


Michael: But where is jQuery without :) Yes, of course, we used a number of third-party TS libraries, descriptions of which can be easily found in Nuget Packages Manager using the TypeScript.DefinitelyTyped keyword.

Sergey: Knockout.js, Globalize, WebApp.js. Definitions for third-party libraries that are not in the Visual Studio Gallery can usually be found on GitHub. For example, definitions of common controls (such as select2 and others like it) are already there. If I didn’t even find it there, then it’s easy enough to write the necessary d.ts file for yourself, or if you’re too lazy, you can add to any .

How did the localization of the product?


Sergey: They used “Globalize.js”: they added a “globalize.TypeScript.DefinitelyTyped” package to the nuget project - and that’s it.

What advice can you give to those who decide to write a project in TypeScript?


Mikhail: Write. You'll like it.

Sergey: Try, compare. The network has answers to almost all questions.

Source: https://habr.com/ru/post/233657/


All Articles