What I Learned Today

No frills, just learn

Posts in the C++ category

C# Lists and Dictionary

In C# there are several key differences to C++. Microsoft Website spells them all: https://msdn.microsoft.com/en-us/magazine/cc301520.aspx

Garbage collector instead of deconstructors providing a different approach to micromenagment of memory and lists, jagged arrays and dynamic memory allocation are already available into the language. It supports also negative index to counting from the last element, similarly to Python.

About lists instead of the usual self-made textbook-example class, there are specific embedded classes for Lists and Dictionaries.

List<type> name = new List<type>();
name.Add(element);
name.Remove(element);

Dictionary<type,type> name = new Dictionary<type,type>();
name.Add(key,element);
name.Remove(key,element);

The Practice of Programming

I started reading "The Practice of Programming" by Kernigan and Pike.

The book hinges on the concepts of simplicity, clarity and generality as foundation of a good code. Eventually automation can bring something to the table generating code from algorithms.

It starts by the usual "obvious" remarks about style: (more…)