Differences between C, C# and Fortran

Explaining the programming language differences to a psychologist.

Some days ago, I enjoyed a very nice discussion with a couple of persons, the majority of them not having programming as their main center of interest. But, we ended up comparing C, C# and Fortran.

It was a lively discussion, so on the fly I tried to find a way to understand the main differences for somebody having no ideas about programming. I focused the difference on the memory management part. Here is the way I tried to express the differences.

Imagine your program is doing some work like you on a desk. You need paper and pen. The paper is the memory used by the program.

In Fortran, before you start to do the work, you grab sheets of paper, you mark them to tell when and for what part of the work you are going to use them. Once done, you start to work. When you start a part, the sytem will give you the paper you need (because you marked them) and will remove them at the end. If you need more paper at some point than what you decided at the start, sorry you cannot.

In C, you do not anything at the start. When you start to work on a part, you pick the paper you want. At the end of each part, it is up to you to clean your desk or keep some paper for the next part. But if you forget a sheet of paper during a part, you can start to accumulate trash on your desk.

In C#, it is a bit like C, you do nothing particular, but when you need some paper, you ask your assistant, your assistant do not know your needs, so he will give you a bit more or not enough, so you may need to ask more or you may have a bit too much on the table. What is nice is that your assistant is learning, it improves a bit with time. At the end of a part, the assistant will also carefully inspect your work and remove what he considers are the sheet of papers you do not need anymore. This is nice, but it costs a bit of time.

At the end, in Fortran you need to define everything before, but the results are a very fast system, in C you can do some nice optimisations but you need to manage a lot and this is error prone and in C# you enjoy the work of your assistant at the cost of some inefficiencies here and there.

Fluid Phase Equilibria, Chemical Properties & Databases
Back to Top