How to think like a programmer (need suggestions)

Hi all, I've been learning JavaScript for a while and am familiar with methods, objects, etc., use Codewars to practice coding... the problem is that I will spend a very long time working out the code, a lot of it is trial and error, and when I'm done it's like the entire experience is gone... so when I encounter the same problem again, it is like it is the first time I've ever seen it, it takes forever for me to finish, and I use essentially the same 5 methods, if-conditionals, and for-loops for every problem (I've completed almost 230 Codewars katas using different arrangements of these methods, conditionals, and for-loops). I know other methods/processes/structures exist, but it doesn't occur to me to use them in the exercises. Ever. Obviously, algorithms & data structures give me nightmares.

​

When I venture out of my comfort zone, the solutions I come up with are very complicated and do not look anything like others' solutions. Other people in my coding boot camp who have completed the same exercises I've completed and have read the same material I've read seem to understand the required steps and come up with creative ways to get to the solution in just a couple of lines.

I have a very strong liberal arts background (art/music/literature, etc.) and would find it helpful to somehow integrate these systems/patterns of learning and production to coding/programming. I did complete calculus (many, many years ago), but I am having trouble using what I can remember of problem-solving in math to problem solve in coding--nothing seems to translate, and I feel like I do not have a context to work with at all.

All suggestions are welcomed. I am currently refactoring all of the codewars I've already done and hoping the repetition will make something stick. Thanks in advance!

Posted Jun 20, 2021, 3:02 AM UTC

89
matimeo_•

Just wanna start by saying PLEASE don’t worry about your liberal arts background (although you don’t seem to be, which is great). I’m personally of the mindset that if you put your mind to it and are committed, you can learn this stuff with enough time. That time varies for everyone though, so please don’t be discouraged. When I started learning programming, it took me just as much time as you did to really pick this stuff up, so no worries!

The programming mindset is really the most important thing to master, so it’s great that you want to work on it. At the end of the day, most languages all rely upon the same core concepts, so once you have the mindset you can basically pickup another language a lot easier. I wouldn’t recommend trying to approach this too much like a math or calculus problem. Maybe others have found this helpful for them, but I personally haven’t, and maybe that’s true for you as well. Programming is not so much math, or more just logic and problem solving. Lucky for you though, with your background in art and music, visuals and patterns are incredibly useful for learning the programming mindset (as well as professionally too).

I am also a more visual learner, and what I found the most helpful when I started is just drawing diagrams and flow charts to walk through the process. For any given problem, try to initially ignore JavaScript and all of its concepts. Instead, write out in words, plan, draw a picture, or whatever else may be best for you to walk through the problem. Go through step by step, and try to be as fine grained, or as specific, as possible. If you find yourself being too vague, try to draw or write in more detail what must occur at that step. I personally find flowcharts to be the most helpful, because you can then usually translate them right into code with a bit of work. Flowcharts also help with visually recognizing patterns that often occur, such as with manipulating data with a loop. There’s a good website called Lucidchart that might be worth checking out!

I hope this all helps. If you need any further clarification left me know, I wrote this pretty late in the night! Good luck, and have fun learning!

3
jenntoopsOP•

Thank you very much for your insights. I haven't tried flowcharts--that may help with loops. I have used Lucidchart once for something unrelated to programming--it didn't occur to me to apply it here. I will try that.

Thanks again for your suggestions and encouragement. I hope you enjoy the rest of your weekend.

2
brrotendo•

I've been learning JavaScript for a while

How long?

Other people in my coding boot camp who have completed the same exercises

Have you asked any of the proctors/instructors for help?

I am currently refactoring all of the codewars I've already done

Maybe try something completely new, or take a break and build something. I'm also new to programming, but when I've run into the same exact problem in music (e.g. learning and trying to memorize drop 2/drop 3 chords, etc.) and I start feeling like I'll never be as good as my peers, I'll take a break from what I'm doing and play something else for a while.

I'm not sure how much books will help, but my friends who have been programming for 20+ years have recently recommended "How to Solve It", "The Model Thinker" and "Pragmatic Thinking and Learning: Refactor Your Wetware."

2
jenntoopsOP•

Pragmatic Thinking and Learning: Refactor Your Wetware

Thank you very much--I have been working on Javascript on and off for over a year. I do ask for help, but my questions are repetitive and it doesn't help when people say, "apply the methods that you used in the previous problem to the new one"--the new problem seems entirely different to me and my understanding of the solution to each problem is isolated to that specific problem (absolutely nothing transfers to a new problem). I have pretty much stopped asking questions unless it is desperate and I have exhausted online resources.

I think the last book is my best bet to understanding enough to continue. I appreciate your input and hope you find fulfillment and satisfaction in learning your instrument(s).

3
Non-equilibrium•

its hard to think like a programmer in your first year

2
ManuelDeLanda•

what are the 5 methods that you use over and over again? and what are examples of other methods/processes/structures exist that you feel you aren't tapping into enough?

I basically rely on 4 or 5 methods for every solution I have to write. There are ways to refactor it down to 2 or 3 elegant lines of code, but isn't the point of refactoring is to wait to refactor when you do have time? Like why challenge yourself to get something perfect the first time when if it works functionally, there is always an opportunity to revisit it to make it more readable or better at performance?

1
jenntoopsOP•

I love .map(), .sort(), .splice(), .substring(), .reverse(), .split(), .join(), and I am starting to like .filter() more. I only use .reduce() for numbers requiring basic mathematical operations but have been told that I need to delve deeper into its full capabilities to get the most out of it. I can use .forEach() when someone tells me it is a good option, but I am very uncomfortable with it and haven’t used it at all in Codewars Katas.

I have tried Leetcode exercises, but I don’t understand the questions most of the time—i.e., the exact parameters and expected return. In one situation, the parameter was some kind of list that was neither a string nor an array, and I did not have a way to convert it to either… in other words, I was at a loss as to how to manipulate it in any manner. This was an “easy” JavaScript leetcode exercise.

Thank you for seriously considering my question. Another commenter referred me to Mozilla—I am on the Mozilla website every day, but the manner of explanation and examples are still are difficult for me to understand. This is why I am looking for sources to rewire the way I approach programming entirely.

Thanks again and have a great week!

1
ManuelDeLanda•

In one situation, the parameter was some kind of list that was neither a string nor an array, and I did not have a way to convert it to either… in other words, I was at a loss as to how to manipulate it in any manner.

everything is technically a string tho, innit? i'm curious what the value was exactly that you couldn't immediately visualize the way to parse it?

data structures and algorithms shouldn't give you nightmares, they should be dreamy visualizations! json is most of the time basically usually just an array of arrays or an array of objects.

I think once you figure out reduce then you already got quite the knowledge under your belt. I think getting into frontend dom manipulation and or getting into backed libraries like lodash would be a natural next step

1