Cunning Planning

A Short History of Sorting in C#

Recently, while reading Jon Skeet’s excellent book“C# in Depth” I came across the long and varied history of sorting in the C# language. It provides a tantalising view of how the language has evolved over the years. Apart from being a great example on C# in particular it’s also a good example on how languages have improved over the years to become more expressive, while maintaining backward compatibility with earlier versions.

C# Abstract Properties, Virtual Properties and Access Modifiers

Properties in C# are first class citizens, this means that they can be declared as abstract, virtual, private and protected. This is not the general use case though, most of the time properties are used to encapsulate fields. class Customer { public int Number { get; set; } public string Name { get; set; } } Customer customer = new Customer(); customer.Number = 9; customer.Name = "Mrs Lovett's Pie Shop"; n the example above, auto implemented properties are used to aid encapsulation.

Emulating Classical Inheritance in Javascript

Javascript isn’t a classical language, at least not yet. It’s prototypal, which is a bit like every object being a class in waiting. You can create graphs of objects where one object inherits from another, but the idea of classes doesn’t really exist. This can be a drawback, specially with code encapsulation. It becomes difficult to hide private implementation details from public interfaces to the object because Javascript provides no native access modifiers.