Skip to content

Mauitron/The_Road_To_Greatness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

The Road To Greatness

A Learning Aid for Aspiring Programmers


Temper Your Expectations

"Coding is very difficult, but that is no reason why learning to code should be." — the prick writing this learning aid

If you have recently started to code, I'm guessing that one of the first thoughts you had was something along the lines of "This is impossible" or maybe, "I understand absolutely nothing!" This is how I felt at first, and I would normally share some heartfelt and sincere words of encouragement to help you not lose hope. The truth is, you aren't wrong; coding is really difficult.

I am not telling you this because I want to scare you away, but it is important to put the task ahead of you into perspective. You will most likely struggle to understand most things at first, and it is important that you know that, and that it is okay. Understanding what you need to do, why you need to do it, and how it should be done is a long journey, littered with failures, tears, and a slew of programs in your catalog that you're convinced are out to get you. You might find yourself tearing your hair out while trying to check if the number stored within a variable is even or not. You have done this 100 times before, but on this occasion, it seemingly by magic, doesn't work.

You might think I am exaggerating for effect, but sadly no. You will have to learn to love the struggle and enjoy solving different and difficult problems regularly.

Now that I have acquainted you with my sunny disposition, let me tell you why I decided to sit down and write all this. When it comes to becoming good at coding, there aren't really any shortcuts. The closest thing we can hope for is to have a clear path ahead. So, I sit here hoping not to teach you but to at least light the way as best I can. Below, I will list the things you need to learn and why, and at the end, I will list them again, but more condensed, in order so that you can check them off as you continue your studies.


Understanding The Fundamentals

Few things are as important to learn in any subject as the fundamentals. What is the foundation of the subject you are learning built upon? The problem comes in understanding what we mean when we talk about the fundamentals of coding. Some might argue that the fundamentals are how and why a computer does things. Although this perspective isn't wrong, it is not important at the moment. For the purpose of this learning aid, the fundamentals will consist of the following:

  1. Understand how and when to use AI.
  2. Learn the data types you will use, how they work, and when to use them.
  3. Understand how to do if statements and how to nest them.
  4. Understand the different loops and how they work, and how to nest them.
  5. Understand how to combine loops and if statements to achieve the expected outcome.
  6. Understand how the data flows through all of them, and your program.

Learn to Use AI (The Double-Edged Sword)

I am going to be very honest with you: using AI is incredibly useful. It is so useful, in fact, that if you don't control yourself, you will end up not learning much at all. Despite the risk of being misused, it is very important that you learn to use it. Most of a programmer's job is to find information; experience in using AI to find that information is quickly becoming an important skill to have as a programmer. Soon it might even become a mandatory skill.

So, heed my words! If you take any advice at all away from reading all this, I pray it is this one. Don't use AI to look for solutions; use it as a tutor. Remember these questions:

  1. How?
  2. Why?
  3. When?
  4. Is it like […]?

They should generally be asked in this order as well. Let us go through them so that you can understand how to use AI responsibly.

The Four-Question Framework

You have a problem or an idea of something you want to do; what it is isn't important. You open up Claude, ChatGPT, or any other AI of your choice. You might feel stressed because you are short on time but understand that following these steps is important for you to not only do a good job but to learn how to do it in the future.

You put your fingers to the keyboard and ask:

"I have an idea/problem…"

Explain your particular situation and what you want to do in as much detail as you can. Try to use your own words as much as possible to describe what you want done. This helps you understand how to ask questions to an AI and makes you more familiar with all the new words and terminology you will be exposed to.

You then end your explanation by asking how:

How?

"How would I do that?" "How does this work?" "How will this turn out?"

A few moments later, the AI will give you an answer. You should read it carefully. If you don't understand how something works or should be done, ask another how question. If you still find it difficult, ask it to explain it to you in another way, maybe in relation to something else you are already familiar with. When you feel that you are starting to understand a little of what the AI is trying to do, you then ask why.

Why?

"Why would I do it that way?" "Why shouldn't I do it this way?" "Why must I do that?"

Asking why will give you an understanding of the rationale for what the AI is proposing. It will also help you build up an intuition about code structure of your own. AI will often give you bad solutions to problems. It will often give you code that either doesn't work or that won't work further down the line. It is therefore important to understand the motivation behind what the AI is suggesting. Remember, you can ask as many why questions as you want.

When you are satisfied with the answers you have gotten thus far, it wouldn't be strange if you felt you could stop there, but the next two steps are equally important. We often want to hurry and get things done, but if you think back to what I said in the beginning, programming is hard. If you want that feeling of everything about programming being absolute gibberish to go away, you need to persevere, so what do you do? You ask when:

When?

"When would I use that loop?" "When would I use that method?" "When shouldn't I use this?"

By now, you know what you can do and why you should do it; you also need to know when it should be done. This step is sometimes not as obvious as it might seem. It might not be clear to you when a solution should be implemented or what it depends on to function. There are often situations where one solution is better than another; asking when to use something will help you understand it in the context of actually using it. This knowledge, as it grows, also helps you to intuitively understand what steps you need to take to realize your ideas. You can't build a project without knowing what to do or where to start, right? Now that you feel like you understand how something is done, why one would do it that way, and when to do it, it's time to confirm our understanding. We end this journey with, So it's like…

So, it's like…?

"So, it's like working as a postman?" "So, it's similar to how a bank stores my money?" "So, it's like a combination of a number and a string?"

These questions look different each time; the point is to put what you've learned into something that is similar to something you already understand. You would be surprised how often you can compare some abstract concept in programming to something mundane in everyday life. Asking these questions not only affirms your understanding but also allows the AI to potentially fill any gaps in your comparison.


The Building Blocks

Data Types

Data types are like the various ingredients in a recipe. Each type of data serves a specific purpose and should be used correctly for the recipe, or your code, to turn out well. Most data types you will encounter include integers (whole numbers like 1, 2, 3, etc.), floats (numbers with decimals like 1.324...), strings (text), and Booleans (true/false values). You can also think of Booleans as yes/no values if that helps in using them. There are more than these, but these are the ones you will encounter the most often, I suspect.

Each of these data types allows for different kinds of functions; in other words, they can help you do different things. Just like a recipe, some of them combine well, others not so well. For example, you can add integers and floats together, but you can't directly add strings to integers. I think you can see why: adding text to a number in coding is similar to adding oil to water. Unless you do it in just the right way, they won't mix.

You can think of all these data types as buckets or drawers that can only contain one type of data. If you want to combine two data types, they will need to share a bucket, meaning they need to be changed to the same data type. Understanding data types helps you avoid errors and write more efficient code. Knowing when to use each type allows you to store and change your data in the ways you want.

If Statements (Asking a Question)

If statements are the way you make decisions in your code. You can think of them as asking the program a question: "If this condition is true, do this. Otherwise, do something else." Learning to use if statements allow you to ask your program to choose different paths based on whatever inputs or conditions you want.

If statements are very important to making your programs dynamic and responsive. Without if statements, your programs would only be able to do one thing, produce one result. It wouldn't be able to adapt to anything really. Learning to think about, and ask, the right questions is very important. It not only helps you as a programmer to more quickly make decisions and create options for your users, but it also allows you to make more complex and useful programs as a whole.

Loops (Doing it Over and Over)

Loops are very similar to your mom telling you to clean your room. It's all about laziness and repetition! Your mom doesn't want to clean your room for you. Loops let you repeat an action, or in other words, a block of code multiple times without having to write it out each time. There are different kinds of loops, like for-loops, while-loops, do-while-loops etc. And even though they all do similar things and can be used, almost, interchangeably, each of them has its own use cases where they are both easier to use, and to understand.

Loops lets you automate repetitive tasks. You can imagine this not only helps with efficiency, but it also helps reduce the vast amount of errors you might introduce trying to do it all by hand! For example, if you need to process each item in a list, a loop will do this much more efficiently than writing out the code for each item manually.

You can also be sure that because it is a loop, it will do the exact same thing every time it loops around. Understanding how to nest loops and combine them with if statements will give you the power to, not only, write more sophisticated programs but also solve most problems. Only knowing these, and data types, allows you to do a lot. These are the most common tools in programming.

Combining Loops and If Statements

The real power of programming comes when you start combining loops and if statements. For example, you might loop through a list of numbers and, for each number, check if it's even or odd. If it's even, you do one thing; if it's odd, you do another. This is where things get interesting because now, you're not just doing one action, but you're doing different actions based on different conditions.

Understanding Data Flow

Understanding how data flows through your program is very important, it might be the most important skill you can develop, as it allows you to reason about the totality of your code. If you know how data moves, you will also, by definition, know what comes next. Allowing you to plan your program and not get lost. It will allow you to optimizing, debug and extending your code more easily. To clarify, when you write a program, data is often passed through various functions and variables, or parts of your program, if you will. Understanding this flow helps you see the big picture of how your program works.

It also helps you identify where things might be going wrong if you encounter bugs. Additionally, it allows you to optimize your code by identifying where your code is failing, or is running poorly, and making your program more efficient. Finally, a solid understanding of data flow helps you figure out what to do next when adding new features or extending existing ones because you then know where you need to build the next part of your program.


(Bonus) Learning To Use The Terminal

If you do not know how to use the terminal I am making the assumption you might be using Windows, and you don't have much experience with the terminal. Learning this might sound daunting. The first time you open the terminal, whether it be cmd.exe or PowerShell, you'll have no idea how it works, I would be lying if I were to call it user friendly, but it is important to learn though. Most things you create as a developer is not going to be completed, you use the terminal to run your programs in development, install things needed, create symlinks, navigate through your system etc etc. Learning this will really make everything a lot easier.

Here is a short list of useful commands to use in the terminal on Windows, to get you started. It isn't as difficult as one might think.

Essential Terminal Commands

c: - This could be any letter really. It is the label of your hard drives. You can find them if you open file explorer if you are unsure which ones you have. Common labels are c: d: e: and so on.

cd - This is the foundation of every navigational action within the terminal. You can think of it as standing for 'choose/change directory'. If you write it by itself, it should repeat back your current directory. Before the example, let us clarify the situation. lets say that we are currently in c:\, it will be shown on the command line, and we have a folder there with the name 'vscode', and in that folder we have another folder with our repos. we want to navigate to these. Then it might look something like this.

Example:

c:\> cd vscode
c:\vscode\> cd repos
c:\vscode\repos\

Now we have effectively moved from c:\, also referred to as root, all the way to our repos folder.

dir - This one list all the files and folders in the directory you are currently at. This is very useful as it's hard to remember the exact folders and files you have. A very common pattern is to write dir, then use cd to navigate to a folder, then use dir again etc etc. If you use Powershell or any linux terminal, you can use ls to list this information instead.

And finally, to run a program from the terminal you just type the name of the file and the file ending. If you want to run a program you are currently developing, you will have to look up what your compiler recognizes as commands.

Examples:

Paint.exe
# In Rust:
cargo run
# In any node framework:
npm run

Putting It All Together

Now that you have an overview of what you need to learn, here's a more condensed list you can refer to as you continue your studies:

1. Learn to use AI responsibly as a tutor, not just a solution provider

  • Learn to understand the code given to you
  • Learn to see when it works, when it doesn't and when it can be improved
  • Understand how to ask questions to benefit your learning
  • Resist the allure of cheating yourself by copying code

2. Understand data types: integers, floats, strings, Booleans

  • What are Booleans?
  • What are integers?
  • What are strings?
  • What are floats?
  • What are decimals?
  • What are char?

3. Master if statements and how to make decisions in your code

  • What questions can you ask?
  • What operators can you use in an if statement?
  • Learn how to ask many questions in one if statement
  • Learn why nesting if statements are good, and when you can combine them

4. Understand the different types of loops and how to use and nest them

  • What is a for loop used for?
  • What is a while loop used for?
  • What is a do-while loop used for?
  • What is a for-each loop?
  • Understand these, and when to use them

5. Practice combining loops and if statements for more complex behaviors

  • Learn why you would want to combine them
  • Learn when you should avoid nesting loops
  • Learn how loops within loops work, how do they run?
  • Understand why these are used together and how they are used together

6. Study how data flows through your code to better understand its structure and logic

  • Learn to understand how to read errors
  • Learn ways these errors can be avoided
  • Understand the order of operations (what runs before and after what)
  • Learn how to test your code to find the reasons for errors
  • Learn how to search for this information on your own
  • You are finished when you can solve your problems yourself, by looking for the information you need

Final Words

Remember, learning to code is a journey, and it's okay to take your time. Focus on understanding each concept deeply, before moving on to the next, learn to enjoy the struggle. But more importantly, learn to have fun with it. Build whatever you want, chase what motivates you. And finally, with patience and practice, I'm sure you will do amazing things!


"Learn to be arrogant enough to think you can do anything, be naive enough to actually try" — the same, annoying, know-it-all from the beginning

About

A Learning Aid for Aspiring Programmers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors