How to write Good Code

Clarity Input and Output

Most mistakes are coming from misunderstanding of range for the input and output. We need to find the range of input and output specifically.

Each Steps of Algorithm must be Clear

The steps of algorithm separated clearly. Thus, you or co-workers may not misunderstand the code.

Need to Study computer structure

Some codes got issue because of computer structure. If you calculate int type addition, the result is wrong because integer overflow. However, we cannot find why the integer overflow exist if you do not know the computer structure.

The result should come out on time.

It does not matter how good codes you made, the output should be come out currectly on time.

The algorithm should be possible to porting.

In other word, we should not use some function that specific programming languages have. For example, Lisp is specialized in AI and it have many functions to help building good AI. If you use finction that only Lisp has, then you need to change the language to Python, it may cause issues. Unless you have to, you should avoid it.

The algorithm is most efficient.

 Share!

 
comments powered by Disqus