Can practicing logic in games improve coding skills?

I noticed that when it comes to trying to program, I sometimes get brain fog. Especially if I’m stressed out or didn’t sleep well-enough or had too many carbs, and I just can’t seem to make logical connections between things very well. Especially with something as abstract as coding.

It made me think back to when I used to weld, and how it didn’t ever really matter how tired I was. Even though being sleepy or foggy-headed made me more prone to mistakes, my muscle memory did most of the welding for me.

So I got a theory: What if I practiced logical thinking for fun in my free time? Would it condition my mind to think logically and make logical connections even on it’s worse days? Things like playing around with circuitry and logic gates in video games, or playing a programming game.

2 Likes

Join the club. Seriously, this stuff is hard. Eventually you’ll get better and it will get easier. Of course by then you’ll be ready more difficult challenges so you’ll be back to occasional brain fog. But that’s just part of the job. Trust me, we all occasionally stare at a problem or piece of code and think, “Damn, why can’t I get this?” I’ve stared at a problem for two hours and then when I figure it out it takes 5 minutes. It’s just part of the job. Someone once said, “Being a professional developer means being professionally frustrated.” This is hard and frustrating - that’s why it pays well.

What if I practiced logical thinking for fun in my free time?

Makes sense to me. I don’t know about circuitry. I would think logic puzzles would have some overlap with coding thinking. But in general, I think expanding your brain in other fields is good too. If you love it, learn it. Keep your brain nimble and resilient. Develop new ways of thinking and understanding the world and problems.

3 Likes

If only I could use a video game to come up with some sort of visual, more hands-on representation of what’s happening with for and forEach, and arrays. Then maybe I wouldn’t get so thrown off and confused by all the different vars in the code and what-not. They all look and sound so similar.

Idk. I’m gonna play Minecraft and play around with redstone circuits or do something more logical but fun today. It’s Saturday.

Thanks for the pat on the back.

Well, you certainly won’t be the first programmer to like gaming.

But I’m not a big fan of gamifying learning programming. Programming is not a game. When you get a dev job you will not be playing games. You will be sitting at your desk, staring at the screen, reading docs, sketching things out on a whiteboard, and trying things out. These skills and patience are important things to develop. I have yet to use a joystick or get points on the job.

I personally feel like logical thinking is logical thinking, not necessarily “fun”, it is a challenge haha. I’m also the sort of person that reads what boolean algebra is on Wikipedia for “fun”.

So first off, I believe learning anything is good for your brain and general health, no matter what kind of learning it is :slight_smile:. I also believe if you want to get better at programming, the best way to do it is to practice programming. Your welcome to train your brain doing logical puzzles, and programming games, but if we aren’t talking about games like TIS-100 then you probably aren’t learning to program. You might be learning concepts related to programming, but at a certain point the only way you “learn programming” is to just do it.

Second, logic gates and red-stone programming is very low level compared to programming at higher levels, like using Javascript. Some concepts do carry over, but most don’t. Learning how logic gates works is a great entry to basic computer architecture, but this is a totally different area than say knowing what Merge Sort is and how it works. Now just to be clear when I say “low level” I mean its lower in terms of where the concept is applied relative to the actual machine code. So think, logic gates are basically physical switches on your cpu board that are handling electronic outputs. These sorts of concepts are the sorts of stuff computer engineers study.

Third, most of programming isn’t physical, rather, its theory which can trip some people up (it did to me). Like understanding most theories, you generally have to use a thought experiments, which can be tougher for people who are more “visual learners” (sounds like you are that type). In these scenarios you have to rely on your own imagination, or find more visual representations. (I recommend computerphile as a good place to watch some videos on programming/computing/math just to tickle your brain every now and then :slight_smile: )

Finally there is a difference between syntax and programming. If your getting tripped up on what var is, or how .forEach works, then were talking more syntax. (mdn is a great resource) More advanced concepts like recursion and OOP are concepts that could be related to syntax (functions, class, etc) but are general to all languages. Being able to tell what your missing is important to taking steps to learning it.

I once learned how to play guitar and once wondered if working out more would help with my guitar playing. My thinking was I would get stronger and have more stamina to play longer and more seriously. I was given some advice that made perfect sense. “If you want to play guitar better, longer, faster, then play guitar more.” I’d say the same goes with programming, your welcome to expand your horizons, train your brain, learn new things, but if you want to get better at programming, then go out and program. It’s the most straight forward way to learn it :smile:

PS. If your having trouble, good that means your learning. Programming is hard, if it were easy everyone would do it. It takes some time and grit to go from “WTF AM I DOING” to “Oh I get it now”, no one, and I mean no one goes straight to “I just get it!” immediately haha.

Playing minecraft or any other game for that matter will do exactly 0 to help you become a better developer. You like playing games? That’s cool. Try programming for 8 hours a day and try playing games after that :smiley: You’ll see how relaxing/fun/not challenging at all even the most challenging games truly are.

In fact, becoming a software engineer and solving problems in front of a PC for 8 hours a day is probably the best way to beat your gaming addiction, if you have one. You’ll get so sick of staring at the screen all the time that when you come home your body will crave anything that doesn’t involve being hunched over at your desk.

You want to become a better developer while relaxing/decompressing? Watch video tutorials, watch videos from conferences, read the articles and forum posts. Listen to SWE related podcasts, read dev.to and fcc, hackernews. Minimize reading content written by people who are just starting out. Embrace yourself in opinions, thought process and vernacular of professionals if you want to become any good at this.

If you struggle with loops/working with arrays read 20 articles written by different people that explain loops and arrays. Watch 10 tutorial videos. Do this in your spare time. Devote an hour a day to this, do this every day. Chances are 95% of them will regurgitate the same things and same copy-pasted examples, but 5% will be a new angle / new way of looking at it, which might help the concept “click”.

One piece of advice that i can give is to embrace/focus on debugging. Using a debugger and looking at how the variables change in a watchlist is a tremendous way to learn how things work and will surely help you quite a bit in understanding loops better. Even writing a console.log() at the beginning/end of each loop iteration that will print all the variables and their values to the console might help you understand how things work and why they make sense MUCH faster than you could otherwise, just staring at the code, trying to make sense of things.

Wow, thank you for the advice, guys. To be honest, I don’t know if I have a gaming addiction or not. I like games, but truth be told, I’ve been pretty disinterested in video games lately, all I’ve been wanting to do is finish this Udemy course and move closer to being a freelancer, but there are just some points in the day where my head gets foggy or I get stumped by some tricky code, like these arrays, and I have to take a break.

But then, I don’t want to stop working towards programming, but I don’t know what else to do if my head’s too foggy or I’m too stressed to code some more, so I just play video games. But I never really feel like I’m getting what I want in life by playing them.

Now I still think there’s some merit to my idea of practicing logic anything as a way to boost my brain, and I still like playing games like Minecraft more than most, but I’ll accept that they won’t help me become a better programmer. I’m relieved to hear there’s other ways of practicing to become a better programmer in my downtime, too.

I’ll check out those sources, and try listening to some programming podcasts. I’ve been looking for something more meaningful and less negative than what I normally watch on the internet, so they just might hit the spot.