We are about to switch to a new forum software. Until then we have removed the registration on this forum.
This is kind of meta discussion about coding, but no matter if you're new to programming or a blackbelt code ninja, I'd be curious to have your thoughts on this:
I was wondering the other day if other people actually do fully understand every line of code they're writing? Or do they just repeat "patterns" they've seen somewhere and as long as the code does what it's intended to do, then knowing the finer ins-and-outs doesn't really matter so much? (I speak of patterns not in the software design sense, but rather just several specific commands or lines of code in a specific order.)
To give an example, I for a long time didn't understand the "void" in a function declaration. Even reading explanations about it made zero sense. But I knew that if I write "void" in front of the function declaration, then my program will work, so I never really bothered to know why I'm writing it down. It was only after I had to return something from a function for the first time that I got to know about return types and thus also the utility of "void".
Another example, if I use a double for()-loop to set up a grid, I to this day remain confused about which for() is responsible for vertical and which for horizontal placement. In the end I easily manage to draw the grid, but I'm never 100% sure I get that code block. (No need to explain it here. I know how it essentially works, I just need to focus when thinking about it and don't have it ingrained subconsciously).
And yet another example, for the longest time I didn't know that in Object-Oriented Programming "functions" are called "methods". And I would ask questions here in the forum and use "function" when I meant "method", which likely created some confusion. They look and behave the same, so no need to know the difference, right?
I've been dabbling in and out of Processing and other programming languages for many years now (as a hobby) and I'm absolutely capable to come up with and create more or less complex programs. But the continuing existence of these "not-quite-sure-what-they-really-do"-patches of code and syntax just make me wonder how much other people know about their code.
I'd expect that many full-time devs and coders would probably want to slap me for such a laissez-faire approach to programming. But is this so? Do pros know everything about their code? Or do they just have the experience to have a huge resource of patterns they can lean back on, without understanding every single one of them? On the other side, are programming beginners scared off by the seeming necessity to understand everything they write down?
Curious on anyones input.