How to Think Like a Programmer?
1. What makes a programmer?
To become a programmer you need to think like one, and contrary to the popular belief, this requires practice rather than knowledge or some mental predisposition.
A programmer is someone who has (mostly) the right mental models before he or she writes a single line of code.
2. Hands-on experience is the only way
A beginner doesn’t know what code to write so solve a certain issue, because they don’t have enough experience with “feeling the material”. And yes, code is a kind of material that you need to play around for your mind to be able to build accurate mental models. Theoretical knowledge has very little value at this stage.
3. Braking it down
The first step is to break down the project into its static parts.
A car can be broken down into a lot of small parts that have no functionality of their own. Only once connected, they can move in relation to one another making a moving car out of a bunch of surfaces, tubes and bolts.
Once you have the static parts, you must build the relationships between them.
To further the car metaphor, in order to make the right connections, you need to know the laws of physics: how to generate pressure in cylinders to make the car move, or build an axis to spin the wheels and open doors.
Once you know what the basic parts look like, how they relate and what enables them to have the relationship, you can build a car yourself.
To build a car you need to be able to wield metal, plastic, glass, and a few other materials. In the world of web code, your basic material are HTML markup, CSS styling and JavaScript functions. All you need to wield them is a text editor.
4. What does it really take?
Even if you have a car factory, most likely you will need a handful of attempts to make a car that you can take on a road trip. You will start with small components and connections, making a lot of mistakes along the way; wrong size, wrong material…
Once you full of metaphorical grease and abrasions, your mind and hands will start getting a sense of how things work. This will only happen if you have experienced a multitude of wrong ways. No theory will help here.
5. So what do I actually do?
-
Get basic knowledge of HTML, CSS and JavaScript from an introduction-level tutorial. I really recommend Free Code Camp.
-
Define your dream project on a piece of paper. Draw the screens and write down the things you want people be able to do on your site/app.
-
Choose one page from that you have defined. Dig into all the details of that page to define your static parts. You need basic HTML & CSS experience, or a mentor to help you do that.
-
Once you have your basic parts, you can start building the connections between them. NEVER start coding before you have the logic mapped out, either in your head or on a piece of paper. The #1 mistake of beginner programmers is that they try to solve problems while typing code instead of stepping back and focus on the logic. I talk more on this topic here. Start with simple connections and move on to the more complex ones as your experience and knowledge grow. You will mostly use JavaScript to implement those connections so keep learning the fundamentals. Here you can start incorporating small bits of theory once things get a little complex.
-
Scrap the project and re-build everything from the beginning! Yes, this is not a joke. Rebuilding a learning project from scratch is invaluable as you get to revisit all your thought process from a higher vantage point.
Summary
The idea behind the process is dead simple: break a project into the smallest blocks, connect them to create moving parts, and eventually into one functional device.
However hands-on experience is key. Only writing code, again and again, every day will eventually take you there. I would even measure it by at least one hour per day.
I have a mentorship program that in addition of teaching you code, will help you to build clear mental models by focusing on the “WHY”: the connections, so that you move ahead at maximum speed.