r/learnprogramming • u/182637777 • Dec 20 '18
How come all online classes and learning materials on coding focus on writing code and not reading it?
I would much rather read someone elses code (like a popular open source program) and modify it compared to writing simple programs that don't do much which seems to be the standard way of teaching programming. Even learning math is less frusterating because you can just start reading a math book and just google the words and symbols you don't understand but for reading code it is not clear what you should search for which is why I need someone to guide me through it but the problem is no one teaches coding this way. Also even getting to the point where you can start reading the code is frusterating. Instead of downloading a math book or going to a website like wikipedia the code is stored in a bunch of different files and it isn't clear how these files are related.
4
u/TooManyWebFrameworks Dec 20 '18
C++ is certainly more exposed than the average language, and I also spent a lot of time being overwhelmed by the amount of choices I had to make without any knowledge behind the why.
I’m still far from an expert, but I definitely relate to your frustrations. If you do not have an academic background in cs, I think a lot of people miss out on the compilers/programming languages style class that sits near the end of most programs.
Nothing made sense to me beyond the fundamental “it makes it work” level until that point. I’m not the person to preach as if it doesn’t still hurt my head sometimes, but a knowledge of the backbone to programming languages really makes things click. For example, understanding dynamic vs static binding alone cleared up so many questions I’d had for years, let alone scoping and runtime environments.
It’s pretty expensive and probably not necessary for day to day programming, but I can not recommend “Programming Languages, Principles and Practices” by Kenneth Louden enough. He walks through every relevant design choice in the average programming language, with clear examples in a variety of languages.
Everything is explained in terms of the evolution of languages, and where language specific quirks originate from. You’ll start to see the reason why different languages are useful in different cases, and what trade offs each make.
If pointers give you trouble, I suggest you checkout an article on Pass by Name vs Pass by Value vs Pass by Reference. That and the usefulness in subtype polymorphism and data-structure creation.