Advertisement

good / bad programming practise

Started by April 17, 2002 09:17 AM
3 comments, last by alexdevmaster 22 years, 6 months ago
I really dont like the way i''ve been coding my tetris game, i mean i''m gettin the logic to work but i still think i could have done things easier, which brings me to the question of programming practise, could somebody point me to a resource where i could see a list of definite no no''s in programing games and also a list of what i should be doing would help. I can never be sure that the example source that i have been exposed to is good programmin, so i have no idea what to model my personal style off. Or even better if you know the information off the top of your head, i would be grateful if you just wrote it down in this forum. Another thing i was wondering was the relevance of trying to program in C++ as opposed to C, i''ve always tried to be a C++ programmer but all the source i''ve been exposed is basically C or C-like, i figured maybe i could perfect my C first and then make the jump to C++ when i feel confident about Win GDI and directX, is that a good plan? Basically all i really want right now is for my code to work, but i dont want to develop bad habits or a dependency on C, so that i cant advance when the time comes, or maybe i''m dreading the advance too much, after all many programmers started C because that was the only thing before C++, i''m the type that wants to build from the ground up so that i can appreciate the new technology as opposed to trying the new technology just so that my games look cool, when i really dont know where its all coming from, get my drift "Jus chillin waiting for my time to shine" #define ALEX_DENNIS
"Jus chillin waiting for my time to shine"#define ALEX_DENNIS
C++ is C plus more, so why not go with C++ and "kill two birds with one stone"?
Advertisement
I''ve used C and C++ and if this is your first language (obviously other than C) after a few quick ideas have sunk in you may just find C++ to be a much more steady road than C. Just my opinion, no flames please.

-------------------------
Every servant has his place, no matter lowly or modest. To know it is his greatest comfort, to excel within his greatest solace, and his master''s contentment is his greatest reward.
-
Serve Microsoft today, tomorrow you may be dead.
quote: Original post by kordova
no flames please.


flame

Since you are just starting out, don''t look at how good or bad your code is right now. Just write the game and get it working. Once you are done, step back and look at the code as a whole. Find the places that look ugly and say, next time I could do this better or that better. Then start your next game. Or if you don''t mind spending the time, re-write the Tetris game again with better coding habits. The only problem with re-writing it is that from the outside it will most probably look the same. Anyway, as long as you are programming, you are learning and once you have done a few programs, you can start picking at your code while you are writing it to keep it from getting to ugly. Just don''t spend much time over making it pretty if you don''t come up with the pretty solution right away. You could spend 8 hours trying to make something pretty, but spend half an hour writing it a little ugly. Be more productive early on, then fix the ugly spots later. With practise, you can spot the ugly code while you are writing it and fix on the fly.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

This topic is closed to new replies.

Advertisement