The Uncomfortable Truth About Learning How to Program
Here's the deep, dark secret secret they don't want you to know. The revelation may shock you!
Join the DZone community and get the full member experience.
Join For FreeI stayed up the whole and wrote the code on paper. Yes, on paper. Can you imagine that?
But it was back in 2004. I was learning C++. That was the first language that I learned.
In the first few classes, I was feeling awesome. All those beginner things like variables, statements and the comforting printf
function that makes your program speak.
Until I was hit by the concept of loops and nested loops. They knocked me down on the ground and I ended up practicing the concepts on paper the whole night.
But I can tell you now that it was worth the effort. Whenever you are learning any new language or framework you will be learning quickly in the start.
If you have learned to code HTML or Python. The beginning is always easy and you are accomplishing something new every day. When you see yourself progressing you feel good and when you get stuck– you know it sucks.
But advance concepts require more time to digest. The following picture represents the typical learning curve for any programming language or framework.
The flat curve represents when you are learning advanced concepts of programming. Here learning a programming language becomes painful. Really painful.
The Challenges Are Important to Learning
If you are a junior developer you know that in the start you will fly through the basics and easy problems but when faced with difficult problems your learning curve will flatten.
For junior developers, this pain is amplified when there is no one to help them out. They feel alone and even the developers at StackOverflow scold them for asking questions(which seniors consider as naive questions).
Most people fall off at this painful moment. But in my opinion, this is the golden moment. The moment when you start to feel the challenged while learning. Because that leads to long-lasting learning.
This is the pain that I felt when learning advanced concepts in C++. There were many hurdles. Help from my classmates was not possible and the computer at my home was malfunctioning.
The only working method was to practice even when I don’t have a computer, so I practiced on a piece of paper and later verified my programs on a computer.
My persistence through the challenges is still benefitting me. After that, I have never fallen during my life whenever I encounter loops or nested loops.
Difficulties Give You a New Perspective
Another painful moment for me was when I was programming a real-world application in Visual Basic 6. I still remember wanting to pull my hair out whenever I have to make changes to my code.
It was largely because of bad code structure. Procedural programming leads to bad code structure, and VB6 is a procedural programming language.
But I have seen people using Java and C# as procedural programming languages. Even I have fallen into this trap because every object-oriented programming language allows you to write code in an object-oriented way, but does not force you to.
The pain of bad code structure pushes me to create good code structure which has led me to learn object-oriented programming. If I didn’t snatch my hairs out then I will still be using C# as a procedural programming language.
I did not learn object-oriented programming for the sake of learning another programming language. I learned it because I wanted to write a good code structure. Now I create code structures where changes are easier to implement.
So, in my opinion, if you don’t experience the difficulties caused by bad code, you will not strive for the quality code.
Why Nobody is Telling you the Truth?
There is only one reason: the feeling of accomplishment. Do you know why many books and coding tutorials start with "Hello World’ stuff? Because the "Hello World" is easy and it will give you a feeling of accomplishment.
If they tell you the truth and throw the hard stuff at you, what will happen? You will stop reading or watching. They don’t want that.
Their claims are high, like "Kearn python in 24 hours" or "Learn PHP in 21 days." I know because I have read a lot of books on programming. Learning a language consumes more time than 24 hours or 21 days.
I am not against the basics or "Hello World." I know you have to start from basics and then progress. But many programming books and tutorials start and stop at the basic stuff.
One classic example is object-oriented design books and tutorials. They start with the basics of an object-oriented programming language like the definition and syntax of class and objects. But we all know that is not related to object-oriented design.
There is a difference between object-oriented programming and object-oriented design. To differentiate between object-oriented programming and object-oriented design, there is a phrase in the book UML Distilled by Martin Fowler:
"Knowing how to use a hammer does not make you an architect."
But unfortunately, many books and tutorials perpetuate the crime of including the basic programming stuff in object-oriented design books and tutorials.
They do it because object-oriented design is hard and even harder to apply in your own projects, and is not possible to attain an immediate sense of accomplishment. Therefore, they include the fluff and keep readers in the basics and the easy stuff. Get rid of the fluff and learn using a real-life and real-world example of object-oriented design.
Published at DZone with permission of Muhammad Umair. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments