How to teach students to work with multiple layers of abstraction? I'm currently preparing to teach a course on data structures and algorithms. In my past experiences helping teach similar courses, I've noticed that many students find it challenging to "hold multiple layers of abstraction" in their head. This problem manifests in several different ways:


Students find it challenging to transition from working on assignments where they need to implement only one or two classes to larger projects involving multiple, interlocking classes.
Students find it challenging to understand in full detail how more complex data structures work.


To help make this more concrete, I'll pick a specific lesson/assignment I'm developing: having students implement a hashmap with separate chaining as a part of a larger project (in Java).

In order to successfully implement just the hashmap, students need to understand that the hashmap has several different "layers" of abstraction.


The Map abstract data type (ADT): in particular, understanding the difference between the ADT and this particular implementation.
The key: understand what it means for a key to be hashable (both in general and within Java).
The hashmap internals: understanding what we do with hashed keys, resizing strategies, etc.
The chain: Understand that the chain can again be abstracted (we can use any map other then a hashmap for the chain).


And of course, once they're done, students need to successfully use the data structures they've written to complete some other task which might have even more layers of abstraction.

Ideally, I want students to develop the ability to selectively "abstract" and ignore different parts of a project when implementing something to reduce mental overhead. Some students seem to intuitively grok this idea but others instead try and hold the entire data structure (or project!) in their head, have a compulsive need to read all instructor provided code, etc, and quickly become overwhelmed. 

In this particular case, I've observed students seem prone to becoming confused by where the hashing logic lives, or losing sight of what the map ADT is asking them to implement in the first place.

Some of this is certainly solvable by just explaining hashmap more effectively, but my core question is this: What are some strategies for helping students become more comfortable working with multiple layers of abstraction? How can I help students develop the meta-skill of being comfortable with abstraction?

I'd welcome answers discuss potential strategies in context of this hashmap example as well as answers that address the more general question.
Link to real life

“Who has came to school by bicycle?”
“OK so we need to know how to make a bicycle”
“What time did you get up? It must have taken a long time to build the bicycle?”

Take it to the limit; be absurd. So the pupils tell you “You don't need to know all this to get to school.” Agree with them.

“Any one here ever fix a bicycle?” — “yes”
“So you have to fix it every time you ride?” — “no”
“But you do have to think about how it work, the inner tubes, the oil, the gears, every time you ride it, right?” — “no”
“Why not?”

Link to past experience, in subject

“Now what about a print statement, we need to know how that work to be able to use it, right?” — “no”

“So over the next few days/week we are going to be looking at a more complex system than before. We can not hold it in your head all at the same time. So I am going to ask you to do what the professionals do: don't try to remember/understand it all at the same time. We only need to understand ‘how’ for the bit we are working on. It is enough to understand ‘what’ for the bits that this uses”



This is only the 1st draft of an idea, and not tried with a class.