How to learn new programming concepts
Tags: productivity, programming, beginners
Published: 2023-04-02 19:45:52

I have recently realized my historical approach to learning programming concepts is sometimes too impatient, shallow, and ultimately inefficient. 

This blog post is an attempt to solidify in my mind a more efficient, repeatable, and intentional approach to learning new programming concepts.


EDIT: This article probably needs to be shortened.  Here is my summary diagram I initially had only at the end, up front now so you can get a better picture of where this is headed right away:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3j5eb0g3iuiyo7gdubq.png)



I'm simultaneously trying to learn docker and write this blog, so I will give specific steps from my learning.  Even if you don't know docker, hopefully the examples will be useful.


# What does efficient learning look like?
Efficient learning is deliberately asking and answering a set of questions towards mastering a particular concept.

The key goal to enable efficient learning is to <mark> minimize the amount of time spent frustrated and confused on any given subtopic </mark>.  To do this we will:
- Break down frustrations and confusions in to smaller pieces
- Use the correct source material for the state of learning you are in
- Actively teach while learning via blogging to help clarify your points of understanding and confusion.

# States of mastery
1) I have never heard of it, no idea what it is or does
2) Heard of it, have a vague idea of what it is.
3) I understand what it is, but really don't know how to use it.
4) I know enough to be dangerous.  (I can use it, but really don't know what I am doing).
5) I understand the core concepts well, but have not learned all there is to know about it.
6) I have mastered it.

For me, I have to fight against the temptation to live in the state of mastery #4 - know enough to be dangerous.  My goal is to move to the point with all the tools I use, I'm at least at a #5 mastery where I am understanding the concepts well that I am using.

# What are tools for efficient learning software concepts?

Whether you are trying to learn a new javascript front end framework, new npm package, new tool like docker, git or even Vscode I believe these 6 resources to learn from to get to a thorough understanding of any programming concept.

<u>Key resources to learn from:</u>
1) Official Documentation from the source code authors of the tool, package, or framework you are trying to learn
2) A blog you write to solidify what you learn as you learn it
3) Youtube
4) A blank project to test with.
5) Stack overflow/blog resources
6) Someone you know already knowledgeable - coworker, friend, colleague


How do these resources compare to the types of learning?

_Learning Pyramid_
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1jjzqk0maf2gogi8hp4w.png)
From: https://www.educationcorner.com/the-learning-pyramid.html

This resource list touches all of the types of learning in the learning pyramid.

\#|Resource | Learning Type
---|---|---
1 |Official Documentation | Reading
2| Blog You Write | Teach others
3| Youtube | Audio-Visual/Lecture
4| Blank Project | Practice Doing/Demonstration
5| Stack overflow | Reading
6| Colleague | Discussion


Also interesting:
https://en.wikipedia.org/wiki/Learning_pyramid


I'm sure you have used all of these approaches on and off.  The key I'm trying to do is be more disciplined about using more of these every time I'm learning a new concept of any significance.


## 1 - Official Documentation
The most consistent frustration point I see with folks responding to stack overflow posts is other users who don't appear to have read the official documentation.  Their frustration reads something like: "well if you would just read the documentation you would see.. and here's the link for you: clickable link."  Some of you just do this by default and probably won't be reading this article.  But for those of you more like me, let me just state for the record oftentimes **DOCUMENTATION CAN BE BORING!**

In my learning example, the source documentation for docker is here: https://docs.docker.com/get-started/ 

The most important thing about the documentation written by the authors is that <mark> the source documentation is the most accurate and thorough source you have to learn from</mark>.  Yes it can be boring, but it is also the most comprehensive.

### When to use official documentation?
- When you are trying to figure out what else you need to learn
- When you want to make sure you are getting the full depth and breadth of a concept (ex all the options available for a given command)

### When to not use official documentation?
- When you overwhelmed.  This is an emotional block and information overload.  MORE information is NOT what you need.

## 2 - A blog you write about what you learn
This blog will help you articulate the things you understand and clarify the questions you have as you are learning.

### When to use your blog?
- When you can't quite articulate what you are currently confused about
- When you want to express what you just learned for future reference

### When to not use your blog?
- When you haven't read anything at all on a topic

## 3 - Youtube
Find a good youtube tutorial to help explain the concept you are trying to understand.

For example: As I was trying to learn docker, this was one of the first useful youtube videos I found that helped me move past the "I'm bored and don't get it" feeling from reading the documentation. 
 https://www.youtube.com/watch?v=pg19Z8LL06w

### When to use Youtube tutorials
- When you are almost seeing red frustrated
- When you aren't quite sure what you are trying to learn specifically or what questions to google, tutorials may give specific keywords to concepts you are struggling to understand.

### When to not use Youtube
- When you are in a rabbit hole on a topic irrelevant to what you are trying to learn :)

## 4 - A blank project to test with
This is your sandbox to test and learn these new concepts.  If you try to do this in the middle of your application code you will be significantly less motivated to try something because you will have introduced a bunch of new variables.  

In my docker learning example I got to a point where I understood it but still had questions and had already moved back to trying to put it in my application.  I just stalled staring at the screen with questions but afraid to change anything. Finally I minimized my application and went back to my test project.  The learning continued!

### When to use a blank project
- When you are ready to start answering specific questions of how something works
- When you claim you understand how something works but have never actually used it
- When you are trying to integrate code into a project that you actually don't really understand.

### When to not use a blank project
- When you haven't read anything on the topic yet or know very little

## 5) Stack overflow
I have heard stack overflow referred to as the unofficial documentation source for programming.  Everyone knows there is lots of useful things there!  (These answers are for someone who simply uses stack overflow as a set of content to search through but doesn't actually post questions).

### When is the best time to use stack overflow?
- When you have a specific question that it has an answer

### Worst time to use stack overflow?
- When your question is too general
- When your question is too complex
- When your question is too bizarre or not best practice such that few have ever done it

## 6) Colleague
An actual human you have a relationship with is one of the most useful assets you have.  Sometimes you may be hopelessly confused by something and an experienced coworker can solve something you have struggled with for hours or days in a matter of seconds.

While this sounds amazing, be careful because you need to use this resource wisely!  If you ask your colleagues to teach you about every little detail and show no initiative to do anything on your own, you will soon find yourself with few people that want to help you.  

### Best time to ask a coworker for help? 
- When you have a specific question about a tool or language they have experience with, and can demonstrate you have made considerable effort to learn it on your own.
- When you know a coworker who absolutely loves this tool or language.  At this point, it probably doesn't matter how poor of a job you have done trying to learn it on your own, they will probably be happy to talk about it regardless of the reason.

### Worst time for your coworker to help?
- When you don't have any specific questions
- When you have already asked your coworker 10 or 12 questions on this topic in the past hour ...

## Summary

\# |Tool | Strength | Weakness
---|---|---|---
1|Official Documentation | Very thorough | Very dry and boring
2|Blog you write | Helpful to solidify learning long term through active teaching | May be hard to see the short term benefit.  
3|Youtube | Entertaining.  Helpful to see live demos of concepts. | Not always thorough, correct, or specific enough.
4|Blank project | Practice doing, keeps coding environment simple and focused on only the important things | Not useful on its own.
5|Stack overflow | Very useful knowledge base with active community involvement. | Doesn't teach broad concepts well or specific tools thoroughly.
6|Colleague | Best resource for hard, abstract problems you can't google. | Only resource that may stop helping you if you don't ask for help with discretion.


Ok, now lets walk through learning using my docker examples and how to use these learning resources in practice!

# States of confusion
To be in a state of confusion, you must have something in your mind that you are trying to understand.  To be confused is the first step to learning something!

1) I am not confused.  But I also don't know anything about it.
2) I am confused with vague thoughts I cannot articulate into questions.
3) I am confused and overwhelmed with tons of questions. [Stuck]
4) I am confused and frustrated with a specific question I can't answer. [Stuck]
5) I am confused with a specific question I can't answer but still making steps forward with hope. [Flow]
6) I am NOT confused, I understand!

Lets address each of these states.

## 1) I am not confused, but I also know nothing
This is an easy state to get out of.  Pick any resource you'd like on the topic you are trying to learn and start consuming.  The instant you don't fully understand something and are aware of it, you have entered into a state of confusion.  This is good!


Resource value in this learning stage:

\# |Resource | Usefulness | Notes
---|---|---|---
1|Official documentation | GREAT! | good foundation to start from
2|Blog you write | Bad | You don't know anything yet to blog about
3|Youtube | Good | Watching a video may be a great place for you to start learning from if it is a good source
4|Blank Test Project | Bad | You don't know anything yet
5|Stack overflow/blogs | OK| Googling the concept generally will create new information for you to consume.
6|Coworker/Friend | Bad | You don't have any questions for them.

Note on coworkers: If you want to learn a new concept but don't know anything about it, this may be the worst possible time to use coworkers.  Possible exception is if you know someone passionate about this topic.  


## 2) I am confused with vague thoughts I cannot articulate into questions.
This is a more tricky state to exit.  Here are the main ways I exit this:
- Keep reading/consuming resources until you start to learn keywords.  These keywords will be new subconcepts for you to start to learn and are the keys to unlocking deeper understanding (often your google search terms)
- Intentionally write out or think through your vague thoughts.  You feel confused.  Specifically about what?  (this is where resource #2 a blog you write below is really useful!)


\# |Resource | Usefulness | Notes
---|---|---|---
1|Official documentation | OK | May give you more words to articulate what it is you don't understand.
2|Blog you write | Good | Probably most helpful for me.  Forces you to clarify your general confusion.
3|Youtube | OK | May give you more words to articulate what you don't understand.
4|Blank Test Project | Bad | You don't have anything to try in a state of vague confusion.
5|Stack overflow/blogs | Bad | You don't know what to google.
6|Coworker/Friend | Bad | You don't have any specific questions to ask them.


## 3) I am confused and overwhelmed [stuck]
This is a somewhat passive and almost defeated state of being stuck while learning.  This may be the worst state of being stuck, but don't worry, it is natural and happens to everyone.

The first step to solving this state is recognizing it is an emotional problem that may require you to first <mark>take a break</mark>.  Once you are mentally ready, then you must organize and prioritize your mental space into a list of prioritized questions that you may begin attacking one at a time.

\# |Resource | Usefulness | Notes
---|---|---|---
1|Official documentation | Bad | Reading official documentation is rarely a bad thing.  However, in this state you aren't dealing with a technical problem but an emotional problem.  If you are **overwhelmed** by all the docker container usages and options, the official documentation probably won't help you deal with this.
2|Blog you write | Good | Probably most helpful for me.  Forces you to clarify your general confusion.
3|Youtube | OK | May give you fresh insight especially if the youtuber connects with your frustration learning the software concept.
4|Blank Test Project | Bad | Confused and overwhelmed is no state to be coding in!
5|Stack overflow/blogs | Bad | Technical websites likely won't address your emotional state.  "Why is docker hard" likely won't yield many useful results.
6|Coworker/Friend | Good | This may be a useful space to verbally process your frustrations.


For example:
Right now I am learning about Docker and Docker Compose.  I have setup my yml file for docker compose and got it working in a basic example.  My next step was to try to learn about volumes and get them working with docker compose, but in the middle of that my "docker compose up" command doesn't work.  Now I am in the state of learning where I am just frustrated and overwhelmed by lots of questions.  Here are some of my questions that are overwhelming me:
- Why does docker compose up fail?
- Why does docker compose --verbose not work?
- What about docker compose do I not understand?
- Is my docker volume setup correctly?
- Do I have the right path for my docker volume command?
- Is there a correct way to debug docker compose?
- Why did my docker compose up work previously and not now since I added volumes?
- What should I focus on now?

The last question is above key.  Answering that question "What should I focus on now" , moves us out of confusion state #3 into confusion state #4.

NOTE for those interested in my docker example: How did I end up solving these questions?
I focused on why my docker compose up failed, but then quickly realized the answer to my question "Is there a correct way to debug docker compose" is to just use the base docker commands without compose.  This led me down the path into a specific question I had a very hard time with relating to docker run with volumes.  It ended up being a syntax issue that I solved via the help of a coworker.


## 4) I am confused, and so frustrated with a specific question I can't see straight [stuck]

This is a more aggressive state of being stuck than #3.  Depending on how you handle your frustration you may either go back to state #3 and feel overwhelmed.

In my experience, this step is common when trying to sort out syntax that isn't well documented.  Or in other words, when you run the code you got off of stack overflow and it just doesn't work.

From my docker learning I felt this most acutely when trying to attach source code to my docker container using a volume in the run command.  I had gotten to the point where everything I found on the internet didn't work and I just kept running the same exact set of commands over and over which obviously didn't work.  By one of the definitions of insanity (doing the same thing over and over expecting different results), I was headed in a bad direction.  My solution ended up being:
```
docker run -v "$(pwd)\src:/src" -dt test:1.0
```
which has multiple layers of potential confusion points to it.  I had to understand:
- docker run syntax
- powershell syntax (since this is where the commands were running)
- windows pathing (first half of the $(pwd)\src section is in windows)
- linux pathing (second half of command is in linux: /src since docker containers run in linux)

At the end of this I ended up finding a coworker to help and he literally solved it in less than a minute.


Resource value in this learning stage:

\# |Resource | Usefulness | Notes
---|---|---|---
1|Official documentation | OK | may help
2|Blog you write | OK | May help you further clarify what is going wrong
3|Youtube | OK| you may stumble upon your solution in a good video
4|Blank Test Project | Great | Specific questions usually come when you get to coding.  Having a specific test or tests to prove you understand is critical
5|Stack overflow/blogs | Great |Stack overflow is great for helping you find usage issues
6|Coworker/Friend | Great | Specific questions are perfect for coworkers who are otherwise busy with other things.



## 5) I am confused with a specific question I can't answer but still am making steps forward with hope. [flow]

This is the state of flow while learning.  We want to be trying to answer a single question at a time with hope that we will master the concept.

The key to staying in this zone is to make small deliberate steps forward.  If you start getting tripped up on something, decide if it is a new concept you need to learn, or if it is a distraction you can or should set aside and tackle later.

\# |Resource | Usefulness | Notes
---|---|---|---
1|Official documentation | OK| Official documentation doesn't usually include a lot of usage examples.  Probably not the most likely place for an answer, but it is rarely a bad place to start.
2|Blog you write | OK | While this won't give you an answer, it may help clarify further what your question is and is a great place to capture the subconcepts surrounding your question that better focuses your search to answer the specific question at hand.
3|Youtube | OK | May give you the example you are looking for, but in general youtube videos will not contain all the use cases, flags, and debugging steps you have to jump through sometimes to get something working.
4|Blank Test Project | Great | You are asking a specific question, use code to prove when you understand! Ideally if you do Test Driven Development, you would have a test case that keeps failing because you can't figure out how to get something working.  Once you understand it, your test passes.
5|Stack overflow/blogs | Great | Stack overflow excels at debugging specific errors.
6|Coworker/Friend | Great | This is probably the best place to ask for help from a friend/coworker.  Now you have demonstrated you put in the effort to learn a new concept and have a well formed question that you are trying to get working in code.  This is a place I'm always happy to help a coworker if I have the expertise.


#6) I am NOT confused, I understand!
Good work!  You made it.  This is a great place to use most of the resources to solidify what you learned and move forward.


\# |Resource | Usefulness | Notes
---|---|---|---
1|Official documentation | Great| Now re-reading through the official docs may solidify your current understanding and give you new insight.
2|Blog you write | Great | Write down what you learned! Solidify it! 
3|Youtube | OK | Likely the worst time to use youtube.  Now you understand it in your own words, do something with it!
4|Blank Test Project | Great | Go write some code!  You get it!  If you really understand it, start copying examples from you test project into a project for a customer.
5|Stack overflow/blogs | Great | If you are the type to post, go do this now.   Help others understand it!
6|Coworker/Friend | Great | Share with others what you learned.  This is a great way to solidify your understanding.


# Summary

Here is an attempt to put it all together in a diagram.  



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3j5eb0g3iuiyo7gdubq.png)




Hopefully this has been helpful for you.  I'm looking forward to putting this into practice more consistently!

Since one of my favorite things to do is to improve at things I enjoy, it should come as no surprise then, that I wrote an article with a similar idea 2 1/2 yrs ago. [Self-assessment, how do I become a better programmer] (https://dev.to/thebridge2/self-assessment-how-do-i-become-a-better-programmer-5h77).  In this post here, I didn't include books, or classes as a resource like I did in the previous post but it should be straightforward to see how those resources might link to the other resources I did mention.  


When I finish my docker post I was working on while learning docker and writing this post, I will link it here.