Tag: programming
Good coding practice, part one
by Joseph Burchett on Nov.26, 2008, under Joseph Burchett
Good coding practice is so very important so I thought id start a series of posts explaining what I think are the best ways to improve your code, this is the first one I have dubbed “Do’s and Don’ts”.
Do’s
-Try and program with the future in mind, you know think of it like playing chess, you need to always be a few steps ahead of yourself. Future planning in any situation is always a good thing.
-Remember to always pace yourself, if you can’t figure out the source of a bug just relax… take a deep breath and start back tracking to find the source of the issue.
-Design your code using UML or similar tools before you even start the actual coding! A well thought out code design will make for easy coding in the future.
-Unit testing is key, well only in the parts of your code you are sure you need to use it! You do not have to test every single little aspect of your code, just the parts you know it will be needed.
-K.I.S.S. “Keep it simple sweetie” or some times “Keep it simple stupid”, either way don’t over do it, spend time to think of the shortest and easiest way to achieve something in your code.
-Always document and comment your code, ALWAYS!!!
-Code with modularity in mind.
-Learn design patterns, they will greatly improve the way you code.
-Don’t s
-Never taking a break… bug’s will fustrate you there is no getting around that, but don’t dwell on it! Take a break, walk outside… come back to it with a clear head.
-Don’t plan to far ahead! Yes I stated before that it is good to plan ahead but don’t plan to far head… This may make for blotted code and a waste of a lot of time for things you may not even use.
-Don’t have HUGE functions that are like 30 or 40 lines, if you do everything in smaller chunks it makes for easier debugging, cleaner code, and well just good practice.
-Don’t be full of yourself! Trust me you are not the best, there will always be some one out there who can code ten times faster and better then you can… So don’t be afraid to ask people who you know are smarter for help.
-Don’t depend on schools to teach you everything you need to know, if you want to be a good programmer you must keep on learning even outside of school.
Of course there are many, many more things you should do and not do… But just to get the ball rolling I figured id mention a few before diving deeper into the topic of “good coding practice”. In the next part in this series I will discuss a bit more in depth on the first stages of coding.
If you are interested in learning more about Unit testing id suggest you watch this slide show… It does a really good job in explaining what it is all about. Slide show...
Also I would recommend listening to episode 388 of .Net Rocks where they interview Bob Martin on clean code.
Joseph Burchett
by admin on Nov.16, 2008, under Joseph Burchett
Well I am a programmer on this lovely team of indie game developers…. Yup, yup… Uhm, what else? Hm, *rubs chin*, well I do a bit of web development on the side
Yah, a bit *shifty eyes*. My part in the first game we produced; Astro Mines, was Uhm, Did some game play programming, and did some web stuff… I do lots of random other stuff.
