I hope you all are good and enjoy coding. I’m facing problem from many years, while doing coding. I can understand the idea completely, when It’s time to translate into code I won’t be able to do it. spending hour and hour without getting any solution, at the end I give up and stop doing programming.
I want to know is it common with all? How long it take to be a master in coding.
I have good theoretical concepts on OOPs, functions, loops and other fundamental of code. When I saw line of code on internet I can easily fit it to my own project, but I want to write my own code like professional can do. Can anybody help me how to start what should I do?
There are two core issues.
One is breaking down complex tasks into basic steps that even a stupid machine can understand it.
The other one is knowing complex and advanced algorithms and programming concepts. This one is mostly memorization and practice.
The first one is training and quite an abstract level of thinking. Technically you are supposed to ask yourself, how you would do it by hand and then build up algorithms and commands on top of that - both first in pseudo-code, meaning something that represents formal commands in general, without already referring to a specific programming-language. Ofcourse for this you need to “forget” a lot of prior knowledge, which isn’t always easy.
For example, working with pointers is like remembering where you wrote something on a piece of paper. We don’t usually think about it - same working with arrays.
It’s about breaking down every command to such a low level, that a computer can understand it. This has the obvious problem, that different languages offer different levels of “understanding”. For example, if you told Python a number would actually be a string, it would write the same number as string. If you told that to C++, it would turn the number into it’s ASCII character, unless you mess up the typing → then C++ would just throw an error at you and break down.
So depending on the language and maybe libraries you use, there are many different ways to write pseudo-code.
There’s multiple levels of understanding required to solve a problem:
Understanding the problem itself
Understanding how to break a problem down to smaller/simpler parts
Understand a solution to the problem overall problem
Understanding how to break down your solution to the overall problem into its own smaller parts
Implementing your solution to the problem via its own small parts.
Test/review and see if your solution+problem-understanding is correct, if not repeat.
Actual coding is only #5. Everything before that is problem solving. It’s possible your only at #1 if you “understand the idea completely”, but then aren’t able to jump directly to #5 because you skipped over everything in between, feel lost and give up.
The only real way to solve this is to focus on 2-4 rather than 5. Namely taking a problem, understanding it, breaking it down, and thinking of a solution for that problem. If you jump directly into coding and “feel stuck”, you didn’t spend enough time “in-between”.
The goal is primarily to identify as small of a problem as possible so you can find answers for this small problem, and add that single small answer to your toolbox. It could be knowing about how a specific method in the language works, or an overall concept, or a general approach to a problem. It also could rely on realizing a complex problem as a simpler one, which is already solved.
Again none of this is actually focused on coding, its focused on understanding the problem. Coding is just the implementation of the solution you think of after you understand the problem, break it down, create a solution out of those broken down bits and then, you type it out so the machine can take your instructions.
This is slightly more concerning, as OOP is a theoretical concept, but functions and loops aren’t. Functions and loops are more part of the given language’s syntax, focus on them at a theoretical level isn’t very practical or useful as there isn’t really any theory to them, they are just syntax of the language to help you achieve your solution. OOP on the other hand is a concept you can take from 1 language to another, learn how to implement it via its syntax and your understanding of OOP is more or less the same.
You might be able to “read” some lines you find on the internet, but this approach is directly jumping to #5 from #1, and this assumes you actually found the right answer to #1 and didn’t just copy-paste some piece of code that won’t actually do what you want.
If you’ve been trying this for years, I’d recommend recognizing the flaws in your learning approach and staying away from them, as they haven’t worked for you thus far.
I recommend focusing on the problem solving aspect, and breaking problems down, and less on the actual coding. Sure it feels less cool, you don’t look like some pro-hacker, but it is what is under everything in regards to what you need to know and execute.
Coding/programming is just telling the machine to solve a problem for you. The machine is dumb, so it needs very specific instructions to do its job. That job, or the problem it’s trying to solve is what you, the programmer are actually telling the machine to solve via your programming language. So overall the process is 3 levels deep:
The machine obviously doesn’t know what’s going on, its too dumb and just does what you tell it. If you don’t understand the actual problem, the program you give to the machine won’t work either. So trying to focus on the “programming language” part, without focusing on solving the problem just results in the machine (and possibly you) getting confused and giving up.
Focus on the problem solving by starting with the problem itself. Try, fail, learn repeat.
Programming isn’t easy, it never was, never will be. But anyone can do it if you have enough time, grit and an internet connection.