Comments and Programming Style

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Single-line comment

//

JavaDoc comment

A comment designed to be parsed to produce web-based documentation.

Multi-line comment

A comment that begins with /* and continues until */

JavaDoc comment

A variation of the multi-line comment It begins with the characters /** and is designed to be parsed by a software tool called javadoc. This tool picks out particular elements of the comments and generates web pages that document the code.

Two types of block style:

Aligned End-of-Line

Aligned style

Aligns the opening and closing braces vertically Used by Rephactor Java

Program Style

Formatting decisions that dictate what a program looks like.

Block style

Formatting that determines where the opening brace appears in code.

Conventions

Guidelines that go beyond language syntax that programmers should follow.

Comment

Human-readable text embedded in code to explain its purpose and processing.

End-of-line style

Puts the opening brace at the end of the preceding line of code.

Consistent indentation

Methods are indented in classes, statements are indented in methods, and some statements are indented within other statements. All of these situations should be indented the same way, and to the same level, every time. An indentation of 4 spaces is fairly standard, though consistency is key.

Compiler

Only ensures that your code follows certain specific rules of the Java language.

At a minimum, each class and each method in a program should be _____________ by a comment that explains its purpose

Preceded

Block style

Related to indentation Which governs where the opening brace ({) appears

Multi-line comment

Starts with the characters /* and continues until the closing */ characters.

White space

The spacing between symbols, words, and statements in a program.

White space

The spacing between symbols, words, and statements in your program. Each operator should have a single space on either side of it, which is more readable than having no space or too much space

Comments

To explain it's purpose and processing. They exist only to aid the developer and anyone else reading the code. Also referred to as documentation.

Program Style (and examples)

What your program looks like and how easy it is to read White space Indentation Block style


Ensembles d'études connexes

Writing and Graphing Equations in Two Variables

View Set

FIN205 Topic 7: Valuation of intangible assets

View Set

Final test Introduction hospitality

View Set

II Lecture Chapter 18 Certification Style Exam Quiz

View Set

Chapter 43 Trauma Systems and Mechanism of Injury

View Set

Emergency Medical Responder: First On Scene Chapter 1 & 2

View Set