My lack of Problem Solving abilities

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

My lack of Problem Solving abilities

Postby corey__cakes on Sat Mar 21, 2015 9:45 am

Hello! I have gotten to the point of my programming knowledge to know that I have surpassed the noobs. I may have even consider myself surpassing the intermediates but there's really something holding me back from that. Say for example, I wanted to make a shmup. I wouldn't know how to go about doing that to the level of efficiency and object orientedness that I would like. It's not because I don't know how to program with the libraries I need, I just don't know how to program it. There's obviously more than one way to make a vertical shmup. The only way that comes naturally to me is grotesque.

To be more specific, I would cram everything into the main loop and as many local-scoped variables to get the job done. The whole practice that programmers should keep their main loops small and tidy just shuts me down because I cant do it.

When I try to program more cleanly, lets say I add update and render functions to all the objects I want on screen for the shmup. The update function controls all the logic for Object. Lets say that for the alien enemies in the shmup, the fire a laser when they're leveled to the player, the spaceship. Its something simple like this that I cant figure out. How do I get the coordinates of the player into a function of another object? Do I pass it through the function as a parameter? To me, that's messy coding. And how would I create a laser that would update each loop when it is create inside of an if statement? Do I have to suck it up and program dirty? How do professionals program something like this? Am I just trying to be to perfect with my programs? Do I have to find a way that works for me? I haven't found any simple games like shmups that are open source.

What would you recommend?

I also apologize for any grammar mistakes I make. I'm typing this on a kindle fire and they were not meant for typing this much.
What do you call a cow with no legs?

Ground beef.
ES Beta Backer
ES Beta Backer
Posts: 23
Joined: Mon Dec 23, 2013 9:56 pm
Location: Your VCR.

Re: My lack of Problem Solving abilities

Postby dandymcgee on Sat Mar 21, 2015 10:30 am

Hey Corey, you're not alone. We've all been there and I know exactly how you're feeling. Taking the step up from guy who understands programming to guy who actually writes programs can be overwhelming, so let's simplify things.

A natural aptitude for general problem solving is definitely something you need as a programmer, but there's something even more important than that: experience.

This is something of a chicken and egg problem: To gain experience, you need to write programs, but to write good programs, you need experience. The key word here is good. The fact of the matter is, an inexperienced programmer is not going to write beautiful code no matter how much they'd like to. They simply don't have the knowledge required yet. So what do you do?

The answer is simple: stop trying to write beautiful code. Now before you start throwing expletives my way for such a brilliantly brain-dead proposal, allow me to explain. I don't mean you should forfeit the basic necessities: indentation, comments and naming conventions. In fact, you should embrace those things. They are the first step toward writing beautiful code. Rather, don't spend all day trying to write beautiful code in areas you don't yet fully grasp if it's going to prevent you from writing anything at all. To write good programs, you need experience; to gain experience you need to write something. You see? It is no longer a circular dependency. That brings us to:

The best slogan of all time: Just do it. Stop getting caught up on best OO practices and minor "optimization" techniques. All in good time, but you first need to make your program work.

I recently found a video which describes a TDD (Test-driven development) strategy. The fact that this video is using ASP.NET is not relevant. What is relevant, is how the instructor is writing the code to satisfy the tests. The "simplest possible thing" approach applies to your situation. First make it work, then improve, refactor and optimize if necessary. Watch video here.

With all of this, hopefully you are inspired to focus more on solving the problem and less on the elegance of the solution. That is, until you are ready.

One question I did not yet answer is "What if I can't even make it work with ugly code?" This means you are lacking fundamentals or simply trying to accomplish something drastically outside of your skill level (which is okay, because you can learn just as much from your failures as your successes). You may need to go read a tutorial or a book. If you can't find a simple answer, don't hesitate to come post here and we'll do our best to help you along.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
ES Beta Backer
ES Beta Backer
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

Re: My lack of Problem Solving abilities

Postby gamenovice on Thu Apr 23, 2015 6:44 pm

One pattern I've noticed when I try to solve problems is that I usually never solve them the first time. When that is the case, it's usually because I've been able to relate the problem to something I've seen before. So I agree with dandy's post. I'd also say that you really want to screw around with all sorts of coding experiments (for example, how many ways could you segfault :P). It's usually when you've failed a large number of times, that's when you can make reliable predictions and figure out what to do from there.
without code, we wouldnt have life as we know it...
User avatar
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 83
Joined: Fri Nov 12, 2010 9:49 pm
Location: Tampa,FL

Return to Programming Discussion

Who is online

Users browsing this forum: No registered users and 2 guests