Spend a lot of time with somebody, as many of us are doing in these COVID-19 times and the conversations repeat. Time with any material causes patterns to emerge and familiarity to grow.
When you spend a lot of time with code, the language becomes your own and your fingers can register the next command before your brain needs to process it. Simple pattern recognition and completion. If you've ever gotten several hours into a jig-saw puzzle, you start to load the imagery and shapes into your head so well that just looking at a piece allows you to know where it fits.
But what if you're new to the puzzle?
When you're getting used to the conventions and configurations of an unfamiliar programming language, it may help to wrap some of the code with your own language labeling. mentioned that he often forgets the syntax for a many-to-many join in the model when writing Laravel code. It's easy enough to look up the proper syntax as he knows exactly what to search for. His browser may already remember where he's going after just a couple of keystrokes. That's not bad. But what if he wrapped that code with something he could remember?
In modern languages, they have what are called first-class functions. It means you can pass the label of a function around as if it were a variable. This allows you to re-label your code by assigning the function label to one more useful / memorable to you.
A wrapper - is a term that means a function wrapper. That is, you take the original code and literally put some code before and after it. This new function is one you understand because you created it. We use this concept all the time in real life when we merge concepts with our own experience and context. For me, the command "make a sandwich" - always has me reaching for Gluten-Free bread. Your context might having you use home-baked loaf; veggies rather than meat. For Amazon logistics, they literally wrap existing products into standardized boxes and labels that make them more efficient to work with.
To make life and code easier, take existing shapes that are hard to work with and make them your own by wrapping them with something you can more easily handle. If it's a hard to remember function call, wrap it in one that's better named for the way you think about it.
When you spend a lot of time with code, the language becomes your own and your fingers can register the next command before your brain needs to process it. Simple pattern recognition and completion. If you've ever gotten several hours into a jig-saw puzzle, you start to load the imagery and shapes into your head so well that just looking at a piece allows you to know where it fits.
But what if you're new to the puzzle?
When you're getting used to the conventions and configurations of an unfamiliar programming language, it may help to wrap some of the code with your own language labeling. mentioned that he often forgets the syntax for a many-to-many join in the model when writing Laravel code. It's easy enough to look up the proper syntax as he knows exactly what to search for. His browser may already remember where he's going after just a couple of keystrokes. That's not bad. But what if he wrapped that code with something he could remember?
In modern languages, they have what are called first-class functions. It means you can pass the label of a function around as if it were a variable. This allows you to re-label your code by assigning the function label to one more useful / memorable to you.
A wrapper - is a term that means a function wrapper. That is, you take the original code and literally put some code before and after it. This new function is one you understand because you created it. We use this concept all the time in real life when we merge concepts with our own experience and context. For me, the command "make a sandwich" - always has me reaching for Gluten-Free bread. Your context might having you use home-baked loaf; veggies rather than meat. For Amazon logistics, they literally wrap existing products into standardized boxes and labels that make them more efficient to work with.
To make life and code easier, take existing shapes that are hard to work with and make them your own by wrapping them with something you can more easily handle. If it's a hard to remember function call, wrap it in one that's better named for the way you think about it.
I think the better approach is guiding someone in building actual things where you have a steward who helps fill in the gaps so they don't get stuck looking things up and focusing too much on optimization/polish/memorization/wrapping.
While it's kinda true, a microwave is much faster to heat up food than starting a fire -- you never seem to appreciate the physics until you've had to keep a fire burning long enough to cook your bacon.
One time I was focusing on teaching a nine year old how to program stuff in Laravel. At first I thought he might be able to understand controllers and views. But then i realized that that was too much surface area to cover in the first hour. So instead of using a controller I just used a closure in the routes file to put all the logic into that. And I didn't tell him it was a closure. I just told him that's where the function goes.
From there I switched back and forth between the 'logic' and the 'view'. he seemed to get that.
But in the end, it turned out the more fun part that I would focus on next time was setting up the entire logic infrastructure for him and then helping him come up with creative ideas to tweak that infra. My mistake in this go-round was that I thought that it would be helpful to have him see me write the logic infra but it actually just confused him.
If I wanted to put somebody on a path to learning programming, I'd start by helping them understand there's input and output. Keyboard and monitor.
Then, when you get overwhelmed by having it all on the screen -- and not being able to retrieve it -- you might start thinking of data structures, files, etc.
The abstractions come about quite nicely because of necessity - if you give yourself enough time to get bored with the previou abstraction layer.
Have you started writing any course material yet? I see that you're tweeting titles of what could be courses.