Atma Xplorer

Xploring Games, Computing, Photography

General Programming Tips

Every developer follows a set of guidelines no matter what language he/she is handling. These guidelines can be good or bad depending on how they’re used and on how much they speed development up or slow things down.

General guidelines

  • Avoid white spaces in the source code while possible.
  • During initial development, make methods/functions public. Allot proper permissions once you’ve singled out which methods needs to be private for data encapsulation.
  • Follow a naming convention. It’s tempting to use X, Y and Z as variables and method1, method2 and method3 as method names but doing so would be counterproductive. You’ll be spending half your time trying to cipher what each of them does.

Delete unused blocks

Instead of commenting stuff out, it’s much easier to save another version of your code and delete it. Versioning/version control helps out if you need to test parts of your code without reducing readability.

KISS (Keep It Simple Stupid)

Avoid trying to make your code impressive by making it more complex than it needs to be.

A lot of long-time developers (which will probably be part of a Quality Assurance Team) will appreciate code that is simple and easy to understand. Instead of relying on your documentation to explain things piece by piece, why not let the code do it?

The time you will spend on simplification will reduce the time you spend relearning the code if you have to make changes later on.

Comments AND documentation

Even with simple coding, there’s some need for comments to explain things like do’s and don’ts on using blocks of code, etc. Don’t elaborate on the explanation on the comments. You can do that on the documentation with a short reference to the block of code in question.

Avoid repetition

Use refactoring or similar techniques if possible to remove lines of codes that do the same thing. Duplication is bad. This is specially critical when developing web applications. You need to lessen the stress on the server as much as possible which is why there is a need to reduce the number of queries that your application is going to require.

If you absolutely need to reiterate, put things into a loop instead of using multiple instances of almost-the-same code.

Tags: ,

Comment ( 1 )

Have Something To Say ?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

website stats