How to be a better learner of coding or anything else!

I wish that someone told me 10 years ago what I am going to tell you on setting an auto-learning plan and avoiding “mislearning” bad habits.

After you read this article, I hope that the theory of the “Genius is made and not born” is true. Because it is better to everyone that all of us can learn whatever we want and excel in it at any age.

All what I am going to mention in this article, you already know but never gave it importance, if you suffer with coding or learning in general.

Let’s speak first about reading alphabetically!

If you were able to read this post till now that means you are definitely able to code.

Reading is one of the most complex algorithm a majority of humans has learned and apply it on daily basis since childhood! It doesn’t come as a built-in function inside your brain, but you learned it. So Why it was easy to learn such a very complex task like reading? The weird thing is that you enjoy reading but not coding. Do you remember any memes that speaks about the suffering of programmers in their life?

source: reddit https://i.redd.it/scupjyjwyqs11.jpg

Here I will write about false and right cases of learning using the learning of reading cases! Then I will mention to you why it is easy for you to read right now and fluently and how that relates to coding and algorithms or other learning subjects.

Right case

1st phase:

When a child start to be conscious, she will start to ask her parents about all the objects she encounters in her space , from memorizing pictures(shapes, colors), sensory feelings, auditory labels( produced by others like parents).

She’s exposed almost everyday to the objects in her space and hearing people speaking. So let’s say that she learned a lot about her space before learning how to read.

2nd phase:

The child later will spend a good time learning memorizing the symbols of alphabet from a to z in addition for their sounds. She doesn’t know anything why is that important except to hear her parents or teacher saying to her “Bravo!” or give her candies. She’s disciplined at learning these symbols and motivated without any knowledge about their importance.

3rd phase:

After mastering to recognizing the alphabetical symbols, she will start to be exposed more to words and to pronounce them, finally she will be able to read a sentence and understand it very well!

The level of complexity is high while reading, your mind is just processing everything without caring about alphabets in the word. You can read sometimes a whole sentence without being aware of the alphabet. Why? There’s a part of your mind that became master of recognizing alphabets.

Wrong case

Let’s imagine a smartass parent who decided to skip the phase 1 and 2 -The space of surrounding objects or actions and the alphabetical symbols- and to teach his daughter directly the words. He brought a list of words : machine, candy, letters,…etc.

So he started to teach his daughter directly those words, and she was eventually able to recognize them directly and she can read them, but when she was exposed to a new word, she would go ask others what is the word and add it to her dictionary while she’s not aware of the alphabet till now. Beside the complexity of the symbols, she will have hard days to learn which one is “she” or “the” because for her they are somewhat similar.

Does this remind you a lil bit of yourself when you go to google searching for a solution for your coding problem which is a basic syntax problem.

Of course no one would teach their children in that way, so why are you jumping to the third phase directly when learning how to code?

Let’s jump now into coding!

We are creatures of our own habits.

Today’s market has become harsh on programmers, they need programmers who are fluent in the syntax of a coding language, data structures, and algorithms. Because all companies are competing today mostly on the efficiency of the code in their product(algorithms and data structure) and taking less storage(data structure) and to offer the product in less time than their competitors in the market(fast coders), I will give you later an example of an imaginary business case and I’ll speak about libraries.

Phase 1: Recognizing the space of a coding language!

Fundamentally, all what you are doing on a computer is storing data, creating data, transforming data, sending data, presenting data. You should know the limits of the coding language’ space.

Learn about the syntax of a coding language and its built-in functions, master them, it will take you maximum of 3 months.

Why?

It will make your life easier when writing code and reading code.

Example about how a mind work, I was typing on computer for 16 years. My speed was always no more than 26 wpm and suddenly at 30 years when I started to train specifically on typing, I am now hitting 60 wpm after 3 months. After learning how to type without looking for 10 minutes per day.

How to train yourself to be fast in syntax and thinking about algorithms?

Codingame’ Clash of codes is the best answer!

I am not rooting for Codingame’ Clash of codes. The clash of codes are puzzles that you must solve within maximum of 15 mins and you can choose the language you like. Instead of hitting your head in complex leetcode puzzles for hours, you can just train yourself on simple puzzles and improve your speed by interpreting basic syntax and built-in functions(you can still use libraries). You can also check others’ codes and learn more about the syntax and to be a faster reader of code.

After 3 months of 2 hours per day in CoC, you’ll become a master of the syntax and can imagine exactly what’s happening in your code, in addition faster at reading code and puzzles for exams.

Your mind will process it directly to you unconsciously like reading. Remember?

Phase 2: Libraries, data structures, algorithms.

Now that you became at ease with writing and reading the syntax and imagining the algorithms. You should now think about libraries like the following:

A library is meant to meet specific needs or a whole business domain. If you work in data analysis, Pandas is a good choice library to master. You can go directly to the documentation and read about pandas and what solutions it is offering. BUT WAIT A MINUTE? Do you have a good knowledge in Data Analysis? Which is a great part of the Pandas space! You have to be always aware of your own knowledge gaps. Most of us use Pandas for its DataFrames.

Do you hate reading the documentation?

Try reading documentation for 3 months, you’ll become at ease in reading any documentation and take from it what you need.

So what about Data Structures and algorithms?

It’s all about optimization so a company can execute their services with less storage and less time. When you are working on your PC, it’s okay to you to write the code like you want but in a company that is using cloud computing or their own hardwares with massive data to process, you should think about optimization. Here’s a small virtual case on processing time optimization.

You manager is asking you to write a code for a function as the following:

Your manager’s request

So the client will enter an integer n and your code will give him 4 pairs of integers a and b.

So you think about it as you will be searching for a and b, so you’ll have two for loops to try integers under 1⁰¹² range and your code will stop when it finds the 4 pairs like the following code.

Your unoptimized solution

You tried your best with the range 10000 instead of 1⁰¹² and it took 1 mins 19 sec. And it was refused by the technical lead or the architect because it is not in the right range and in addition it is taking a lot of time that would put their service at higher price.

So why you wouldn’t think about it like the following, you write it with one for loop for b and I calculate a and check if a is integer like the following code while keeping the range at 1⁰¹².

You optimized solution

It is taking now 15.9 ms.

Your mind will start to suggest for you solutions unconsciously but the most important is that you know very well the space you are dealing with and reading it. That cannot be achieved except by practicing on simple and later on harder puzzles.

Dynamic Data structures:

Obviously, instead of repeating the S many times for the list of [sell, stock, stop] you will create a family tree of parents and children. It will absolutely take less space on RAMs. In addition, it will be take less time by the cpu to search for a word. Each row will have a maximum of 26 alphabetical symbols, it will take a maximum of 26*45 loop if the longest word is of 45 letter which is still a lot less that 470,000 loop if you want to search the Webster’s Third New International Dictionary and Addenda Section.

(image courtesy — http://www.mathcs.emory.edu)

A company will try to reduce the computing time and storage for their service as much as they can to reduce paying for hardware resources.

Eventually, special algorithms and dynamic data structures aren’t a lot and you don’t need to discover them but to be aware of their existence and to know where to use them by understanding exactly where they are used.

Now you know why FAANG are so obsessed with data structures and algorithms and the speed of a coder exams. I hope you can relate what you are doing directly to the business. The destiny of the company you are serving is your destiny, so try to bring them optimized solutions instead of just doing your job. Be a master in the space you are working with.

To learn Dynamic Data Structures and advanced Algorithms you can visit www.algocademy.com they have cool stuff.

Phase 3: Stackoverflow and Hand-on projects

If you passed the phase 1 and 2, you can now visit stackoverflow and solve other people questions, or to get answer for a problem. You’ll be able to understand what you are reading and to get to know new libraries used in the solution. You can now communicate better your issues because you are more aware of the space of your language or domain.

Hand-on projects without the phase 1 and 2, they can give the illusion of the mastery. But they are still great if you passed 1 and 2, you’ll have more ability understand what they are exactly doing and to manipulate their code and change it as you wish.

Last words

Last words, practise and your mind unconsciously suggest on you solutions. Don’t spend too much time on a problem, take it as an opportunity to discover your knowledge gaps and try to take your time when reading and you’ll be faster by the time. Accept the fact that your mind take time to absorb.