How to become the best programmer in the world (My journey)
Coding (Php 7.x)Oct 11, 2019
Malcolm Gladwell, Journalist and author came up with the idea that you need 10000 hours to master a skill, let's see if it's true
How long does it take to become the best web developer you can?
How often do you need to practice to master the skill of programming?
What do you need to do to speed up the learning process?
Are we alone in the universe?
I am sure you have asked yourself all 4 of these questions at least once in your life.
you WILL NOT find out the solution, I can’t help you find these answers nor I can predict the future and know how much effort you will put on it,
One thing I can do though is telling you about my journey on how I achieved my first 10000 hours.
What is the 10000-Hour Rule
Malcolm Gladwell is a Canadian journalist, author, and public speaker.
He has been a staff writer for The New Yorker since 1996 and he has published six books so far.
Another information that I shamelessly stole from Wikipedia is that he is the author of Outliers,
In this book, Gladwell studies and wrote how skilful people became successful.
The most famous insight of the book is his 10000-hour rule theory.
According to Gladwell, every person need to dedicate at least 10000 hours to master the skill of his choice,
This is true for cooking, singing, playing a musical instrument and, of course, coding.
Even though his idea has been criticized a lot we cannot deny that the more you spend working with your programming language of choice the more insight you acquire and the better you get.
As a little summary here there is a list of the 7 best concepts of his book
- As billionaire Mark Cuban also said, diversification is for idiots, do not jump from one idea to another, focus on one skill and one alone, if you love to code just do it
- Talent is overrated if you want to improve the only solution is to grind on your goal
- Gather as much information as you can about the skill you want to become proficient it, read someone else’s code, attend conferences
- Practice, practice, practice, practice, get 1% better every day
- Overcame the quit point, after the first exciting period everything will become dull and boring, here is where you are going to find out if that is the path you want to pursue
- Track your progress, if you have been coding for a while you know, every time you look at a script you wrote a year earlier the seem very bad, that is good news you can write better code now
- Lastly being close to specific circumstances and situations, if you grow up in brazil it is very easy to become good at football if you can use a pc at schools or work it is easier to come across programmers or developers
My journey as a PHP developer
Gladwell theory really stuck with me because I have done every one of these steps years before I came across his book.
And that what this post is all about.
I am going to reexamine the path that brought me at my current point hoping that it will help you and maybe even save you some time.
Start with HTML
Whether you want to become a back-end developer, a dev-ops, or you are dreaming about a career in front-end here is where we all start.
HTML and CSS are the fundamental skills that you must know and the first you encounter if you want to work for the web.
Let me start by saying that this is the easiest and fulfilling phase among them all,
This is the phase of discovery, you learn a lot every day.
It’s amazing, you do not know what you do not know,
I remember that I started learning HTML with a group of peers in a school class, every day we were sure we were going to learn something new, we were sure we were getting closer to the finish line,
That is an incredible feeling, your passion is at its higher level as well as the surprise for every new tag or new CSS property you discover.
Today you insert a text into a web page, tomorrow this text is positioned in a precise spot within the page, the day after, you coloured it, add particular styles on hover, etc.
The problem with this initial phase is that after a while you get confidence,
I still remember when I was finally able for the first time to recreate a wireframe I had on paper into a web page with pixel precision, that was a real ego boost.
I have arrived!
So did all my classmate.
We were happily going up the hillock without knowing that we were at the feet of the Mount Everest
images from Principles For Success by Ray Dalio
Hey Server, Let's talk! PHP as procedural
If you grow up in a European country or you have been close to a football environment in your childhood you know that there are 2 types of persons.
The FIFA lovers or the Football Manager passionate.
(If you do not know what I am talking about they are two videogames about football)
Even though these two titles have been created around the same topic, they are two completely different product.
The first is shining, have the last trendy footballers in the cover, you can do a lot of tricks while playing, and requires a brand-new GPU every year.
The second is humble, the image used as cover cut the face of the protagonist, the game itself is composite of tables, number and data and until a couple of episodes ago they did even show the match graphically.
Needless to say that I loved it!
Buying a forward because he was tall and would fit my run-on-the-sides-and-cross style, or use the offside tactic against speedy foes, spending hours fine-tuning the module.
It was a great time,
Now, I can now do the same comparison between front-end guys and the backend team.
The first looking at the new things Jquery, then Angular, now ReactJs, Redux and hundreds of new crazy ideas every week.
The second using PHP and Java per 20 years or more, retrieving data from an old good MySql database and, in some, deliver it using REST or SOAP (remember that?) APIs.
That was the world I wanted to live in, screw JavaSript.
… turned out that was NOTHING LIKE THAT.
So far I believe that one of the biggest mistakes I have done in my career is to jump straight to a backend language, in my case PHP without wanting to learn anything about the behaviour of the page.
Maybe because the school system doesn’t work, most likely I just didn’t care. the fact is that I spend my teens sleeping on my desk at school or skipping class altogether.
The teachers were boring and the classes about languages like C++, assembler and TCP/IP model.
Not the most fun for a 13 / 14 years old kid,
something I remember though is that between a nap and another my ears captured words such as classes, methods, encapsulation and dependency injection.
Forward several years later and with the beginning of a career in the most stimulating (in my opining) web development field, I find out about OOP just when I was sure I know it all.
PHP had no secret anymore until casually I saw a tutorial about the basics of OOP.
I was hooked, I spend the next few days writing and testing classes, creating inheritances between them, instantiating objects, this, self-learning about magic methods as so on.
As I arrived at the top of the mountain I find out that there was another, much bigger and more difficult to climb just hidden behind.
In the beginning, it did have much sense but I heard again about the same concepts that my teachers tried to teach me years earlier this time there was no time to sleep, this was serious.
Object-oriented programming is not 100% of the time the way to go for your project, you learn this with experience, but this is another level you must take to master this skill.
Composer changed it all
Sometimes you do not why but there are particular situations that you will remember for years and years.
The following is for me one of them.
It was mid-2015 I just arrived in a new country and while I was barely speaking the language I was trying to get your head around what was the job situation for a web developer in the new place.
I was on the second floor on one of the most iconic symbols of London the double-decker bus while I was reading job ads, lots and lots of ads looking for strange works one of it was PHPUnit and automated test.
I did a bit of research and seen weird terminal panel, composer, autoload, require and lots of other devilries like that.
I thought I would never catch up with those stuff until I realized it was just the next natural step.
The next mountain, and here things started to get serious.
I realized that the first things I needed to care about among all those keywords was Composer.
Composer is an application-level package manager for the PHP programming language if that means nothing to you no worries.
It just meant that Composer is your best friend, the tool you will never leave aside.
It changed the way people write PHP code, it certain ways it changed PHP developers themselves.
Composer allows you to download little packages directly into your application, you need to manage dates: briannesbitt/Carbon, doing testing? sebastianbergmann/PHPUnit is what you need, moking data: use fzaninotto/Faker, use an HTTP client for your API guzzle/guzzle, watch the error of your script in a cool way filp/whoops.
Composer is like a restaurant where you can order all the types of food you want on demand.
Learn how to use it and most important learning about it, its existence changed the world for me.
I am sure it will do for you as well.
Never waste time again, PHP Frameworks
Although I believe pure PHP in an astonishing language by itself creating secure and reliable systems for your applications is a demanding task.
Adding that you need to do that for every website or web application you want to make the task just became strenuous.
Well, frameworks are there for you,
A framework is a set of files and components put in place in a certain way that focuses on building the structure of any application you need.
They are open-source, written by hundreds of contributors and trustworthy.
Plus there are dozens of them and you can simply learn them by reading their documentation or watching videos online.
The MVC Architecture
While entering this new world of framework there was a word that I heard and read more and more time,
The Word was “model–view–controller” and for me, initially, it was a difficult concept to catch,
Problem is: it is not something you need to learn, there is no code to look upon when reading about MVC it is just a principle, and architecture they say.
If you are already at this point in your career or about to leap into a PHP framework you may find it difficult too.
So what is MVC? and more important why is MVC?
In the old day all the code was written in a single file with some include() and require() here and there on a good day there was even some require_once().
Having business logic and data written in a single file was a problem under various expect.
The code wasn’t testable nor scalable.
Two characteristics that you may want in your web project,
Then the first models of this concept started to come out
The idea is to divide the code in 3 part: the business logic, the UI and the input logic.
Each of these parts got his section in the file system, the Model, Controller and View.
There is nothing complicated about it nothing to spend nights sleepless to learn, just bear in mind that they are in charge of 3 different part of your application.
The models retrieve and store data in/from a database
The views are the HTML parts, the pages in which you see the actual data
The controllers manage the interaction with the user, they fetch the data the user need “talking to” the model of competence and select which is the view the need to show this data.
It is a common practice in PHP frameworks like CodeIgniter and CakePHP to have big and fat models full of methods that are called by much slimmer controllers.
PHP framework you may want to test are:
How an architect changed the way we write code? Design Patterns!
At the end of the 1970s, an experienced architect called Christofer Alexander realized that even having fresh ideas and modern point of view, in order to make a building the new and young generation of architects needed to solve the same problem he had to solve when he was studying and starting his career.
the law of physics did not change yet.
From this revelation he published two books:
A Pattern Language: Towns, Buildings, Construction dated 1977 and The Timeless Way of Building in 1979.
In those books,
he first cast the words design pattern and published them as 253 solutions.
If you are new to design patterns consider them as just common methods to write your code in ways that have been tested during the years and proved their soundness overtime.
The same concept was applied in another book, much more famous in the programming work, as it currently considered one of the bibles every developer should have on his shelf.
The book is called “Design Patterns: Elements of Reusable Object-Oriented Software” and it has been written by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides also called the “Gang of 4” in 1994.
The original book has examples in C++ (it again) and Smalltalk, by now you can find dozens of version in almost every language.
The book is composite by two parts: in the first one they describe all the problem that comes along with object-oriented programming on the second part they describe 23 design patterns
I would suggest having a deeper look at them one by one but here is my 60 seconds introduction to design patterns.
There are 3 different types of design pattern:
- The ones you need when creating an object (Creational Patterns)
- The ones that design the relationship between different entities (Structural Patterns)
- The ones that increase the flexibility between all the objects in your script and ease the way they communicate with each other (Behavioral Pattern)
The simplest way to start learning them is by doing them here there are the easiest one you can implement today Singleton (Creational), Abstract Factory (Creational), Decorator (Structural), Strategy (Behavioral) and Observer (Behavioral).
Data structures & Algorithms
If your knowledge arrived at the point of having learned or start to grasp data structures and algorithms Congratulation!.
You are now a Jedi Grand Master,
you are able to write amazing code not to mention get a job at each of the FANG companies in California.
You are at the top of the Everest and the view is fantastic up there.
So, what are data structures?
Data structures consist of all different methods that permit to store data,
Let’s make a basic example:
Imagine you have to make an application that helps cooks baking cakes.
You must have a table with all the ingredients and their nutrition facts, then let’s assume you may need the category’s table in here you put two records (liquid and dry ingredients)
Now you can store the data in two different ways:
sugar: dry, baking soda: dry, eggs: liquid, flour: dry, honey: liquid, etc...
Or you can store in this way:
Liquid: eggs, honey, Dry: sugar, baking soda, flour.
Both work but depending on which method we choose to apply we change the way we store hence the software we will write the software.
That’s an elementary example of what data structure are.
Then you’ll have algorithms,
You can define algorithms as the operation you need to perform on the different data structure plus the set of instruction you need to execute these operations.
Returning to our example we can say that the steps to make a tiramisu are:
- Break few eggs and put the yolks in a bowl
- Add mascarpone cheese
- Add the whipped whites of the eggs to the mixture all these liquids
- Add the sugar
Basically, you have a problem to solve, in this case, you have a few ingredients but you need a cake, and a series of logical instructions that let you solve that problem.
As I said this was just a basic example,
there are a lot of other features that are included in PHP or your prefered language such as Binary search, sorting (merge sort & quick sort), dynamic programming (memoization, divide & counter), etc.
The good news is that you do not need to learn all of them.
The goal here is to keep improving
The 10000-hours rule makes sense, there is nothing hidden about the fact that the more you practice the better your skill will eventually become.
Mastery though is another thing.
That not just matter of doing the same things or write the same code over and over again, mastery is intended as the research of the perfection,
Like a complex script that is bugless and runs at light-speed.
That’s above here is impossible to achieve and that’s the point.
Evaluate where you are in this path right now and get closer to the next step, the next, bigger mountain to climb.
This is a never-ending trip, either you are a beginner that just learned the “head” and “body” tag or Linus Torvalds that wrote the Linux kernel.
Did I forget a step?
Or there is something you want to add? Head over the community and share your opinion.