Update #3 – (Brain) Muscle memory

As you can read in my bio (see About me), I have been trained as a Software Engineer many years ago, somewhere in the mid 1990’s. After a few years programming, I drifted away to analysis, project- and program management and several Agile roles like Release Train Engineer and Scrum Master. Meanwhile I kept involved with technology, but I did not code regularly anymore.

Now that I am coding almost every day for my Java course, I realise that also the brains have some “muscle memory”. Interested to see what I mean by this?

Well, it turns out that there are still a lot of similarities between what I learn today and what I learned so many years ago. Especially for topics that I would expect non-programmers to find hard, I discover that it is still “in my system”. Examples of this:

  • Array indexes that start with 0 (in stead of 1). So when looping you do something like below.
for (int i = 0; i < array.length; i++) {

More natural would be something like this

for (int i = 1; i <= array.length; i++ {

Anyway, I somewhere remembered this ‘oddity’ and have no problem with it

  • Reference types versus Value types

Primitive types like int, double, boolean are value types. They hold a value and when copying them to another variable with the ” = ” operator, you only copy the value and have two separate variables with 2 separate values

An array is a good example of a reference type. If you “copy” an array to a new variable with the ” = ” operator, you only create a new reference to the same object. If you change a value in the array, it will be changes in both variables.

int firstInt = 10;
int secondInt = firstInt;
secondInt++;
// now firstInt = 10, secondInt = 11

int[] firstArray = {1,2,3,4,5};
int[] secondArray = firstArray;
secondArray[0] = 99;
// now both firstArray[0] and secondArray[0] are 99!

There were some other instances when something “clicked” when doing an exercise or challenge, clearly something that came around when I started programming. So it is nice find out that the hard work of over 25 years ago is not completely lost!