# Tag Info

## Hot answers tagged abstraction

43

You can get at this concept very intuitively in strings before you ever get to arrays. Take a string like "hello world" and ask them a subtle-sounding point: does the string begin here: "*hello world", or here: "h*ello world". They'll certainly be able to identify the correct answer. Then ask, "how far from the start of the string do we have to go to get ...

38

Ages in the United States (it's not the same around the world). For the first year of life, children are 0 years old. Only after completion of a year is the age changed to 1. By this logic, a child in his/her second year of life is 1 just as the second element of an array is found at index 1. Edit: another example is the counting of centuries. An event ...

34

An analogy that will work well in Europe, but not in North America: Image licensed under the CC BY-SA 3.0 by Bidgee of Wikimedia Commons. Floors (in European countries) are typically numbered with 0 (or G) as the ground floor, then 1 as the first floor above ground, etc. This could easily be compared to a list/array of floors, with floors[0] being ground, ...

23

The clock (24 hours system) If we look at the clock, we have two examples of counting hours. The 24 hour system starts at 0. The 12 hour system is interesting, neither starting at 0 or 1. The 12-hour clock In the 12-hour clock system we start at 12 and make our way up to 11. This needs some explanation. The 12 hour clock has a funny way of counting, that you ...

11

I don't see anything confusing in 0-based indexing. In fact, it seems that 0-based indexing is not less natural for humans than 1-based indexing. Humans use 1-based indexing just because of following some long-standing, but weird tradition. I remember that when I was a pre-school child (<7 years old) and has not been yet influenced by social traditions ...

10

You overestimate the complexity of 0-based indexing a lot. There is nothing complex in 0-based indexing. On the other side, the topic of the pointers is relatively complex. I don't think it has any sense to introduce pointers earlier, than at the time when a pupil would be ready to fully feel their usefulness and use them in practice. Especially in languages ...

10

This is a great explanation of why 0-indexing exists. As someone who barely knows what a pointer is, your explanation made perfect sense. If you wanted to dumb it down a little you could phrase it as: When you create an array, the variable you assign that array to is actually a pointer to the first element. Lets create an array num. When you want to ...

7

Exponents representing the values of the digits in positional number systems. e.g. the-arabic-system / denary / the-system-you-learnt-in-primary-school. 10³ 10² 10¹ 10⁰ 1000 100 10 1 or binary 2³ 2² 2¹ 2⁰ 8 4 2 1 The binary example in binary 10¹¹ 10¹⁰ 10¹ 10⁰ 1000 100 10 1 This was @GypsySpellweaver idea, see comment.

7

tl;dr: Just say no. This question is difficult on many levels. I seems to me to be a land mine of misconceptions and has the possibility to lead to poor teaching practice. First the difficulties Only concepts can be abstract. Abstraction is about ideas. Animal is a concept. Mammal is a concept. Animal is more abstract than Mammal since it contains the ...

6

Rulers start at zero: At zero centimetres, you have nothing, whereas at one centimetres, you have one unit of length. Memory is similar: You start filling at the beginning (zero), hence, the first x-memory units contain x units of data, the next unit contains unit x+1.

6

Draw ongoing attention to the potentially confusing point by banning cardinal descriptions of an element's position. Avoid referring to the "first element" or "second element" and talk only about "element at index 0" or "at index 1." Insist that your students speak only of indices and not of position in a sequence. If you ever use cardinal numbers in human ...

4

I am not advocating teaching pointers to explain 0-indexing (see mine and other's answers on your other question for how to do that). However, if we have good reason to teach pointers, here is a tip that helped me when I was learning. I have also shared these ideas with other pupils, and they started to make progress. I find code involving pointers confusing:...

4

The most fundamental shift in my programing came from my attitude about details. When I was young I wanted to pull every detail out of everything I touched, pin in down in front of me in one source file and beat it into submission. I could stand in one place and know everything. After decades of programming my attitude is: the less I know the better. Dealing ...

4

Fundamentally, I question the notion that you can test to see if students understand the idea of abstraction beyond a superficial level, even if you don't restrict yourself to asking just multiple choice questions. It's a little hard for me to articulate, but I sort of feel the best way to learn + get feedback on whether you understand abstraction is to ...

4

I would probably ask students to demonstrate their understanding of abstraction by writing code demonstrating solutions to a small problem at, say, three different levels of abstraction. I'd probably leave it to them to choose the levels of abstraction, and optionally write a short explanation of the differences in level of abstraction the code was intended ...

3

Think about human ages. Babies that are newly born are at age 0. That's zero-based indexing.

3

Your tennis racket question, is not good. As tells as that is is abstraction, then focuses on the form, when the most important aspect of a tennis racket is its function. Therefore the answer is non of the above (those are all implementation detail, and you asked for an abstraction). A good abstraction is hitty thing. The 2nd question, is very long, and can ...

3

Distances in boardgames with discrete spaces. For example: Chess, wargames, Dungeons & Dragons played on a battlemap, etc. Counting movement, the space you start in counts as space zero (or more accurately: if a piece stays in the same space, then it has moved zero distance). There are a number of situations in wargames and RPGs where two pieces might ...

3

Let me suggest, pretty strongly, that you may be mixing up too many ideas in too short space for novices to grasp in one go. Spread it out. There is no real reason to introduce arrays along with pointers, nor to give a complex reason for zero indexing at the start. In C, you don't want to avoid it altogether, of course, but you don't dump the whole load at ...

2

UK school years We used to have years 1,2, 1,2,3,4, 1,2,3,4,5,6th form. We then changed to 1,2,3,4,5,6,7,8,9,10,11,12,13 (years 12 and 13 are 6th form, no one know where this name comes from). Then we added reception year, to get R,1,2,3,4,5,6,7,8,9,10,11,12,13. R is just a different symbol for 0. (In the US K is used for 0.)

2

A common example I use is centuries/years. We start with the first century on a range of 0-100 years. Or the first year of a century, which always ends in 00. It describes the amount of x that has passed, not the n-th x. The word "first" is the confusing thing for beginners I feel.

2

For anyone old enough (>30years): In the UK a few years back we had only a few TV channels, first 1, then 2, they slowly increased to 5: BBC1, BBC2, ITV, channel 4, and eventually channel 5 The TVs typically had 10 numbered slots (sometimes 8). the slots where 0 - 9, we would but the channels into the slots 1 = BBC1, 2 = BBC2, 3 = ITV, 4 = channel-4, 5 = ...

2

The ground floor is the de facto 0th floor. Humans are born at age 0. Military time starts at 0:00. Despite the day having 24 hours, it is not correct to write 24:00. As a side-note, Japanese TV uses 0-indexed 12-hour notation. That means 11 AM is followed by 0 PM, not 12 PM.

2

Based on my past experience working on a FRC team, my main advice would be to be very cautious about pushing students to use more advanced abstractions, design patterns, and whatnot. The issue is that if you spend a lot of up-front effort designing interfaces and abstraction layers, you can end up painting yourself into a corner, especially if you're new to ...

2

Being on this site since the beginning, I have many times now encountered this notion that for introductory courses, higher level languages mean that students will deal with more abstraction and lower-level languages mean that they will deal with less abstraction, but I believe that this is fundamentally incorrect. I'm going to actually recommend a frame-...

1

I know that you are looking for a physical analogy, but I'd say I agree with @ctrl-alt-delor about the 'link to what they already know' part. I usually start by introducing a simple algorithm, then show how that algorithm can be parameterized. Then we move on to OO, where I discuss how an algorithm can be parameterized with not just a value, but with a ...

1

I realize this post is old. However, what helped me and what may help others is that 0 is indeed on the number line. The best analogy I can give to support this cause is related to a bank account. If you are -5\$in your account and you add 10\$. Your total sum is 5\$. Placing this on the number line (as seen below) -5 becomes your "0" as you count ...

1

Some train stations (but not many) have a platform 0: https://www.youtube.com/watch?v=SPQRNmXVP8s If you are lucky enough to live in one of these towns, then it may be a very good example.

1

Subtraction paradox: In North-American football, if a runner goes from the 3 yard line to the 4 yard-line, there is a (4-3) = 1 yard gain. However, if your math teacher assigns problems 3-4 (integers), you have to do two problems. So in what engineers call an "analog" system, the Result = Stop - Start; but for integers it can be more complex. So in North ...

1

Light gang switches, same the way you teach binary counting. (Well, the same way that I was taught binary arithmetic back when knowing binary and hex were important.) EDIT: An off transistor (simulated by a light switch) is considered to be 0 (no voltage) and an on to be 1 (voltage passing). Since "all zeros" is a valid configuration, 0 is a valid address ...

Only top voted, non community-wiki answers of a minimum length are eligible