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

Post Reply
corey__cakes
ES Beta Backer
ES Beta Backer
Posts: 23
Joined: Mon Dec 23, 2013 7:56 pm
Current Project: Canadian Simulator 2017
Favorite Gaming Platforms: GBA, DC, iOS, SNES, WS, 360, N64
Programming Language of Choice: C++, Lua
Location: Your VCR.

My lack of Problem Solving abilities

Post by corey__cakes »

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.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: My lack of Problem Solving abilities

Post by dandymcgee »

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
gamenovice
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 78
Joined: Fri Nov 12, 2010 7:49 pm
Current Project: wii u dev, sdl, and some unity 3D
Favorite Gaming Platforms: PC, GAMEBOY, GAMECUBE, WII, 3DS,PS2
Programming Language of Choice: C#,C++,Java
Location: Tampa,FL
Contact:

Re: My lack of Problem Solving abilities

Post by gamenovice »

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...
Post Reply