Index

chapter1

chapter2page1

chapter2page3

chapter2page4

chapter2page5

chapter2page6

chapter2page7

chapter2page8

chapter2page9

chapter2page10

chapter2page11

chapter2page12

chapter2page13

chapter2page14

chapter2page15

chapter2page16

chapter2page17

chapter2page18

chapter2page19

chapter2page20

chapter2page21

chapter2page22

chapter2page23

chapter2page24

chapter2page25

chapter2page26

chapter2page27

chapter2page28

chapter2page29

chapter2page30

chapter2page31

chapter2page32

chapter2page33

chapter2page34

chapter3

link one

link one

link one

link one

link one

link one

2.1.4 - Java Code Conventions

Maintaining a predefined code style is important for all the programming languages. We save seen the importance of code maintenance. Producing a maintenable codes is enhanced by following predefined code conventions. Remember we could predict who is who in System.out.println(). IF we inspect image 1.4.1 : 5 - Eclipse Code Assist, we can understand how our predictions are close to the actual situation because the programmer who supplied this predefined package has followed the Java Code Conventions.

Java is one of the languages which understood the importance of setting a well defined code conventions from it's first release. Sun Microsystems has published. Java Code Conventions, which are the optional rules definining the writing style of various language elements.

The official Java code conventions published by Sun Microsystems are last revised in 20 April 1999 and can be downloaded from the official Oracle web site. Oracle is the successor of Sun and actual owner of the Java technology. There is also many other publications on this subject, but all the publications are based on the original Java Code Conventions which is strongly followed worldwide. We will mention one here, Sun developer Achut Reddy has a detailed explanation about official Java Code Conventions. Another publication deserves special attention, a well known and experienced develeoper Scott Ambler, has assembled his practical experiences in addition to the official Java Code Conventions for producing robust Java codes. His book may be downloaded from his site. This book is very useful for every Java developer and we will follow his suggestions in our lectures.

The last revision of Java Code Conventions date back about thirteen years. Despite this significant period in software industry measures, no major changes are suggested from the Java developers worldwide. Java Code Conventions remains current for today and it is stricly followed like it is freshly released. Recent critics suggest only some minor points which may be changed for today's standards. Keith Bennett in his technical blog comment out about some points which may be suggested for updating the Java Coding Conventions. He points that, using spaces instead of tabs, may be a better choice for source code indentations. The reason of his suggestion lies in the fact that there is not unanimiously accepted standards for evaluating tabs in terms of spaces. Different editors interpret tab lengths differently and codes written using one editor may be displayed differently in a different editor. For preserving visual uniformity of produced codes Bennett consults the use of spaces instead of tabs. His suggestion is generally accepted for the present. Another point he suggests, is about the length of the source code lines. Java Code Conventionswhich consult that the lines of the source codes should not exceed 80 columns. This is a limitation dating back in the days of punched cards whose length of line was limited with 80 columns. He points out that the maximum line length of 80 colums may be a conservative restriction for today's practice and if the need arises, more lengthy lines may be used. He may have right about this subject. But leghty codes are difficult to read and with the limitation imposed by Java Code Conventions saying that there would be only one statement per line, lenghty lines are may be pointless. When there is a comment part after the only statement semicolon, it may exceed the 80 column restriction by an acceptable length. Lastly he is mainly addresses to Scott Ambler by pointing out that if a code is beginning to need more comments than the usual, then the complely renoveling of this code portion may be a better choice than the augmenting the comments. This may be also right depending on the situations, but basically the decision is up the programmer.

In summary, we will follow Java Code Conventions in our programs. And we advise our readers to act in the same way. The life of programmers will be more easy if we strive producing understandable and maintainable codes.

<< Index

Polyglott HTML5(XHTML5 compliant HTML5 code)