TypeScript, although very promising language, does not solve fundamental JavaScript’s issue (feature?) with “this” property binding. TypeScript can lead to unfortunate errors since it is heavily used by people coming from C#/Java communities, who bring coding patterns with them. Let’s have a look at code example from TypeScript playground: class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return “Hello, ” + this.greeting; } } let greeter = new Greeter(“Alexander”); console.log(greeter.greet()); // Hello, Alexander Now, lets make slight change to…Continue Reading “TypeScript is actually JavaScript and one still has to be careful”

This post is not the usual one. I wanted to show you how it looks and feels refactoring and improving old C# 5 code using features of C# 6. Doing it in the traditional way by simply writing and giving code snippets is not very productive and I have decided to try out other media – actually doing a screencast. I have done it for the first time and therefore quality is not as good as you might want, but I promise to do it better in…Continue Reading “Refactoring old C#5 code to C#6 code”

C# has a very nice little feature named implicit user-defined type conversion. By far not every developer knows about its existence because its application is very limited. However, sometimes it can be very handy to help you increasing the readability of the code by removing unnecessary clutter. For example, you have to write many functions, which take double[ ][ ], transform it in some way and return double[ ][ ]. Very soon you will want to extract low-level operations on double[ ][ ] into separate…Continue Reading “C# implicit user-defined type conversion”