Showing posts with label coding standards and styles. Show all posts
Showing posts with label coding standards and styles. Show all posts

Sunday, August 14, 2011

About 80 column rule and tabs

I always try to use the sacred 80 column rule and so limit all lines to a maximum of 79 characters. Limiting windows to 80 characters makes it possible to have several windows side-by-side and makes the code more readable. Nowadays, the newer editors and users of editors have forgotten this and make it really hard to read code.

Another thing I would like to mention is tabs. I do not like to use tabs and replace them by spaces. My strong opinion is that tabs are evil. This rule also helps, when you are working with such languages as Python, where it is very important to never mix tabs and spaces.

Tuesday, July 5, 2011

About coding standards and styles

A few notes about C/C++ and Python coding standards and styles. On my opinion, the main point of coding standards is to provide a set of rules for using particular programming language for a particular purpose in a particular environment. Thus, by taking particular programming language there can not be one coding standard for all used and all users. For a given application a good coding standard is always better than no coding standard.

For the very first review the GNU Coding Standards can be taken.

C/C++

As was mentioned above the reviewing of C coding standards can be started from GNU Coding Standards. For more details the Bjarne Stroustrup's C++ Style and Techniques FAQ can be taken. Here I was found not only recommendations about style, but also answers on FAQs such as Is "int* p;" right or is "int *p;" right?. Bjarne Stroustrup's also recommends for reviewing the JSF air vehicle C++ coding standards for the system development and demonstration program as a good coding style for embedded systems, which I found very helpful.

Another interesting guide is Guido van Rossum's Style Guide for C Code. This guide gives coding conventions for the C code comprising the C implementation of Python. However it contains a very basic rules that some users will find very helpful.

Java

Just  Code Conventions for the Java Programming Language.

Python

On this moment I use Guido van Rossum's Style Guide for Python Code. I found it as a very basic for all applications that I did.