How to Improve Logical Thinking?

I think the hardest part about this is that when you are solving math equations using logic, you are balancing an equation for the purposes of reduction. This can help make things legible, and it can demonstrate an understanding of like terms, but when you code something you aren't reducing it or making something legible, you're creating functionality. When you use logic to break down games or puzzles or circumstances you aren't utilizing the same skills. There's a problem and you use your logic or reasoning to solve the problem.

That is not what you do when you code. When you code you are doing it backwards, instead of breaking things down or isolating them you are trying to take the building blocks that exist that you usually fundamentally use to deconstruct something and use them as a basis for construction. You are unsolving a puzzle or jumbling things in order to achieve a specific goal. This is a specific skill and training it is different than training for reduction or simplification.

Because it's a different skill it needs to be practiced differently. I think instead of general logic trainers or games or whatever, it would be better for you to analyze other code in your language doing similar things. Try to find code that isn't super crazily shorthanded to be pretty but doesn't need detailed comments to break down and try to analyze that. Break down the individual building blocks other people use to establish very specific functionality and then try to understand how those building blocks can be implemented into your code. What parts are contingent on other information, what parts aren't, where you can expand or reduce the inputs or functionality of those blocks.

Build a personal library of code snippet building blocks and see how complex of a thing you can make without straying from the usage of your separate, specific pieces. Write them down. Write them down on sticky notes or something. It seems convenient to write everything in code digitally because you're at a computer but if you write smaller things down physically and refer to them like that they will be able to solidify in your memory more easily, it's almost like indexing when you get it down. Write a function for counting up or down on a sticky note. Write a function for referencing other scripts or accessing variables. Break stuff down that you think would be fundamentally useful and write them down. Write rules about those functions, write caveats, applications, alternate ways to write them that doesn't change the actual function.

Once you start doing this you'll be able to pick out parts of things that are common or uncommon and what things can be connected to other things or substituted for different functionality and then instead of trying to like top-down perfectly create some complex structure you just start building up all of the little parts of it. You'll get the hang of combining things and shortening things or which things work better or more efficiently for different tasks. It sounds like a drag but if you do things this way, syntax won't matter, language won't matter, you won't even need to necessarily code with code, logical structures will be something you can implement in electrical systems, robotics, theory, game design, architecture, almost anything you can think of is basically just various logic building blocks stacked together to make complex functionality. It'll stick better, it'll be easier to learn and it will be more widely applicable.

In 6 months when you don't use a syntax anymore but have to go back and relearn it, you might only have a day of brain fog where the dots don't connect but as soon as you start picking out building blocks it will all come back so much easier.

/r/learnprogramming Thread