Advertisement

Would you release bad code?

Started by October 25, 2009 10:12 PM
27 comments, last by WazzatMan 15 years ago
Recently, I've been in a fury trying to do as much work on my game as possible before I lose the free-time I currently have. As I near completion of the first release, I started thinking about going open-source. But then I realized my code, which has been written over the past year, would be so completely embarrassing for any "real" programmer to see that I don't know if I could ever release it. And beyond that, if any beginner programmer were to reference the code for learning things like networking, physics, etc. they would be lead into a whirlpool of hack-arounds, redundancies, and random comments I write when I'm high. I'm self taught, so I'm too lazy and uneducated to restructure the game. But I believe the game has some innovative gameplay that might warrant the release of the code. So what would you do? Have you ever released code you were embarrassed by? Would you?
I wouldn't release code unless I believed that the code itself, not just the finished product, had some value.

You say the game has innovative gameplay, but are people going to reuse any of that code? And if it's messy and hard to understand, will they learn much about that gameplay from looking at the source?
Advertisement
Absolutely terrible open source code??

You act like that's a rarity...
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
The code itself has (some) value, it's understandable and not too messy.

It's just embarrassing code. Bad logic, bad commenting, and overall bad practices are used.

I imagine reactions like, "I see what he was doing, but why the hell did he write it like that?"
What kind of messy? These are the ones I tend to encounter the most often.

Easy to fix:
Not enough comments; Go through your code (Or at least the non trivial code) and add comments.
Too many comments (Tends not to be a problem, unless it's too distracting); Just mass delete (What kind of comments do you make when programming high anyway?)
Bad tabbing and brace placement; Fix it up line by line
Variable and Method names; Search and Replace

Harder to fix:
Bad algorithms; Rewrite
Unorganized data structures; Rewrite

Most programmers end up rewriting bad code anyway. The main exception is when a hard deadline is coming up and resorting to hacks tend to be necessary (These tend to cause problems later which then also need to be fixed.)

I kind of feel this way on the project I have worked the longest on. I know I should use a linked list instead of an array for a certain thing, but I have put it off because too much is dependent on what is already there. There's also some weird orphaned code that I keep thinking I am going to use later.


Maybe you should focus on one piece of your project, fix it up, and release only that.
The sentence below is true.The sentence above is false.And by the way, this sentence only exists when you are reading it.
Quote: Original post by Platinum314
have put it off because too much is dependent on what is already there. There's also some weird orphaned code that I keep thinking I am going to use later.


These are largely my problems. Bad solutions to problems that I initially intend to be temporary, but end up keeping because eventually too many things become dependent on them for me to rewrite the solution.

As to what comments I make when I'm high? When I'm trying to solve problems, I tend to "think outloud" in the form of comments, and I never delete them.. so mostly irrelevant rubbish
Advertisement
My personal opinion is that in general you're going to find that unless you've written something that is immediately useful to a lot of people, just puting the source code up on sourceforge or whatever, not a lot of people will download it anyway.

What I've found from the little bits and pieces of code I've put up on my website over the years is that the majority of people who are browsing it (particularly those that have come from google) are looking for some solution to their problem, and if your code doessn't obviously solve their particular problem immediately, they'll either just ignore it or (at best), they'll leave a comment and say "hey, can ur pgrm do XYZ? pleezz, thx!" and then they'll never return.

And I actually think some of the code I've release has actually been pretty good [wink] so I can't imagine what kind of response "bad" code would get :-)

Having said that, if you're not going to be able to work on the code yourself in the near future, it might be worthwhile to release it as a kind of "insurance policy" against your computer bursting into flames or something... if the code is there on sourceforge, at least you'll be able to get it back again!

For people to actually start downloading/using your code, you've really got to maintain the site, keep it active and release updates, and so on.
Whats the worst that could happen, with a few exceptions its better to focus on accomplishing goals than to worry too much about code cleanliness.
Do you know what's embarrassing to real programmers? Working on a hobby for x years and not having anything to show for it. As a bonus, you can get feedback (on your game), and improve the code over the years. That's the beauty of code.

Just ship it.
[ search: google ][ programming: msdn | boost | opengl ][ languages: nihongo ]
Yeah, eventually I just got over the obsession with having to have the perfect code and just doing something that worked.

That's how it is in the real world; I wouldn't call anything I've done for money "great" code. Some of it might even be "good" code, but most of it was built under constraints and is understandably lacking.

I wouldn't call 95% of the stuff out there in open source to be "perfect code," either. Not if it has a usable product at the end of it.

This topic is closed to new replies.

Advertisement