Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Coding Ediquette

Sign in to follow this  


When a person is still fairly new to learning to program, is it a bad habit to get into when you choose to "try-and-error" the code that you have written?

IE.) -- Write a function, compile
or -- Write a loop, compile

What are some good habits to get into that you have found helpfull when you code?

Just thinking a bit before I head off to class.
Sign in to follow this  


Recommended Comments

Usually I compile when I feel that I've written enough code that will provide some sort of output, something I can test. The only reason why I think you'd compile so frequently is if you don't yet have a grasp on all the syntax of a language, in that case, compiling frequently may help you learn the syntax a bit quicker, also it will help you learn to identify common errors and how the compiler reports them.

You will probably find that the more experienced you become, the less often you will compile. Also, the larger the code base, the less you'll WANT to compile, because compiling will take precious minutes away from you.

Share this comment

Link to comment
I find that I compile every time I write a new class, or group of related classes, to make sure there are no bugs that I am introducing to my system before I write a lot.

I generally don't compile after every for-loop, but thats probably because you are not used to the syntax yet.

Anyway, if you are writing Object Oriented base code, I recommend this technique highly:

1) Write how you would like the code to work. For example:

Person Me;

Now, obviously that won't compile. So you have to create a Person class. Okay, still won't compile. So you have to create those 4 functions until it compiles. It will help you focus on code design and appropriate style without clutter if you think "high to low" instead of "low to high." I consider low to high programmers to have very unreadable code that tends to be cluttered and repetetive. It generally means they think about a specific for-loop instead of the system as a whole.

Just a tip...

Share this comment

Link to comment
Hey fellas, I really appreciate the feedback on this question. Thank you for your time.

I really see where you are coming from and how that could potentially add to the project. Luckly, I am in no position to say that I'm attached to a specific 'way' of doing things so I will give that idea a shot.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!