Author Topic: New interface problems - Digressions  (Read 1882 times)

studentforever

  • Editor
  • Hero Member
  • *****
  • Posts: 3301
    • View Profile
Re: New interface problems - Digressions
« Reply #15 on: December 02, 2015, 01:43:25 pm »
I don't have a problem with the concept, just the difficulty of adjusting my thought pattern between everyday numbers & arrays (the sort I grew up with at your age) the binary, base 8, base 12 & base 16 number systems that I needed for the assembler add on to basic and the complications of vectors in the outside world, 'vector' notation needed for programming, real numbers, complex numbers, integer arithmetic etc.  It would have been OK if I spent all my time in one framework but I never did and I eventually made up my mind not to bother because by the time I had got round to mastering it the Geeks would have changed it anyway!
I also had the switch over from imperial units, (ft, lbs etc) to cgs (centimetre, gramme, second), MKS (metre, kilogram, second) plus some really weird electrical ones and one we used for relativity where the velocity of light was set to 1, to contend with. I think one of my favourites was ASF (amps per square foot) used in electroplating. But I think you will see why I just can't be bothered anymore.

AvastMH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7317
    • View Profile
Re: New interface problems - Digressions
« Reply #16 on: December 02, 2015, 07:18:44 pm »
zero numbering got my brain fairly fried  :o

OK, let's see if I can explain it with the use of an example: This is an array (type of list) of bits of text (called "Strings" in Java and some other programming languages).

String[] dwarves = {"Happy","Grumpy","Sleepy","Sneezy","Bashful","Dopey","Doc"}

Zero-based numbering means that instead of going 1,2,3,4,etc., the index of the array goes 0,1,2,3,etc. So when you access an individual item of the array, which is done by referencing its index, you have to remember that the first item has the index 0, not 1, the second item has the index 1, not 2, and so on.
So if you try the following things (in each case, you are renaming a single item):

dwarves[0] = "Angry";
dwarves[5] = "Stupid";
dwarves[7] =  "Mac";


... then the first two will work fine, but the third will fail and chuck an error message at you.

From what I've read, the reason zero-based numbering exists because it works better on the hardware side, and makes it easier to do certain complex things with arrays and other sequences.
Plus, the designers of some very influential programming languages chose to do things this way, so it's very common today.
I mentioned it because I thought "Maybe the homepage has an unnecessary correction for this built in", since some programs do have necessary ones built in.

Does this make the topic at least a little easier to understand?
Oh! Right!  It wasn't as madly complicated as I thought it must be. Yes - thanks for the explanation Hanibal :D