Thursday, December 24, 2015

C# vs TypeScript in Visual Studio 2015

Recently, I have coded JavaScript Analysis projects of equivalent functions in both C# and TypeScript in Visual Studio 2015. C Sharp is definitely the winner. Let me explain.

Shortcoming of Typescript compare to C#

1. When usage of myStatement is detected but not imported, Visual Studio will help you import: 
var myStatement1=require("ast/myStatement")
it is incorrect, and need to manually correct back to
var myStatement=require("./ast/myStatement")
C# does not have this problem.

2. Refactoring of class won't affect the naming of usage of class in the other files
e.g., by refactoring the naming myStatement to myStatement1,
it will change from
var myStatement=require("./ast/myStatement")
var myStatement=require("./ast/myStatement1")
in classes uses myStatement1, still myStatement is using, C# does not have this problem

3. The Test Explorer needs to parse for a long time, C# is fast.

4. The compiler scanning each typescript file takes quite for a while during starting while C# is very fast

5. C# has windows form for fast UI prototype

6. The Typescript UI sometimes just hang, C# does not have this problem

7. The solution Explorer sometimes left with a big gap after cleaning the js and file, C# does not have this problem

8. Many datastructure are lack off, and difficult to see the contents like Dictionary (from in debugging mode. C# does not have this problem

9. The typing in typescript is lazy type, and there is no real class constraint. When you want to use it as a class for OO language like C#, you might create some hidden bugs that you might not aware. You can use C# without such problems.

Shortcoming of C# compare to TypeScript

1. Need to go through Edge.js for running node.js indirectly.

2. Lack of understanding of JavaScript by always coding in C# (Fortunately I have coded quite sometimes in typescript).

3. Actually there is no real shortcoming of C#, it enables fast development without concerning on those superficial stuff, and put real concern in logic.