Coding Guidelines. Introduction. General Points. Avoid redundant initialization/assignment
|
|
- Buck Goodwin
- 5 years ago
- Views:
Transcription
1 Coding Guidelines Introduction General Points Avoid redundant initialization/assignment Use of "!" instead of explicit "== true" and "== false" Anonymous inner classes. Members sort order Naming Abbreviations Braces and Identation Javadoc Comments Shorter one-line Javadoc Method Arguments Spacing Package Importing Semantic Units Whitespaces and empty lines Line Breaking String Output Java 5 Java Warning suppression Assertions and parameter validation tostring(), equals(), hashcode() Getters and setters TODOs Commented out code Appendices: A. Configure IntelliJ IDEA code style B. Broken tests Introduction This document describes formatting rules and guidelines for software source code. Note that this document does not cover best programming practices or techniques. It is solely concentrating on source code formatting and conventions. Java coding guidelines are largely based on SUN official Java coding conventions: doc.html. Below are the only exceptions, clarifications and additions to this standard that are specific to Apache Ignite development process. Rationale Studies have shown that 80% of development time spent on software maintenance which involves software source code understanding, refactoring and support. Established and enforced code formatting rules and guidelines improve source code readability, promote team code ownership, allow engineers understand new code more quickly and thorough as well as simplify maintenance. Overview of TODOs Javadoc: Define indentation policy with multi-line parameter descriptions. Imports: Review the requirement that Javadoc references to classes not imported by source code must be resolved by an import rather than by citing the FQN in Javadoc. This does not play well with OSGi and messes up any dependency analysis efforts. General Points Avoid redundant initialization/assignment
2 String s = null; Bad s = "GridGain"; String s = "GridGain"; Good Use of "!" instead of explicit "== true" and "== false" Use shortened form of boolean expression where it does not compromise the readability. Anonymous inner classes. Use shorter form of "callbacks" are allowed now where it does not compromise the readability: collection.add(new A() public void m() { // Do something. ); Members sort order Same as described at Oracle's Java Code Conventions. Naming Except for types ( classes, interfaces, enumerations and annotations) and semantic constants names all other names should start with low-case letter. Types names should start with an upper-case letter. In the both cases a camel style should be used. Symbol '_' (underscore) should be used only to separate upper-case letters in the names. Constants ( final class attributes that have constant semantic and not just made final because of inner class access or performance considerations) should all be upper-case. For example (class comments ommitted):
3 class Window implements ScreenObject { /** private static final int MAX_INDEX = 10; /** private int currindex; /** private int serialuid; /** uid UID. Class name. public String classnamebyuid(long uid) {... Abbreviations Types and methods names are NOT abbreviated except for well-known cases such as EOF, Fifo, etc. See Abbreviation Rules for list of currently accepted abbreviations. Braces and Identation K&R bracing and indentation style should be used. { starts on the same line as the opening block statement. For example: while (true) { if (false) body(); else if (true) { foo(); bar(); else abc(); Braces are required in all cases, even if not required by syntax, except for the cases when next statement is one-liner. For the latter, braces must not be used, e.g.: if (somecondition) a = b + c; else a = b - c;
4 4-space characters should be used for both tabulation and indentation. When multi-line operator (try-catch, anonymous class instantiation, etc) goes after some condition it is required to use braces: if (somecondition) { try { invocation(); catch (Exception e) { e.printstacktrace(); Javadoc Comments All javadoc commetns should be approximately 80 characters long. Always keep in mind that we create Javadoc for people to read - it should be easy to consume and easy to understand. When you need to insert Java code snippet: Use Put into <blockquote class="snippet"></blockquote> to convert Java into colored HTML 1. Target XHTML 1.0 Transitional (inlined fonts) 2. Style: Kawa 3. Tab-space: 4 4. Alignment: left 5. Line numbers: ON 6. Table border: OFF 3. Copy <font...> tags into <blockquote> (make sure to remove <code> from both ends) When you need to insert any non-java code snippet: 1. Put into <pre class="snippet"></pre> When creating table: 1. Use <table class="doctable"> 2. Use <th> for header columns. 3. No other styles on <th>, <tr> or <td>. To mark important text used <strong> HTML element. For paragraph titles user <h1 class="header">. Every type should start with at least minimal Javadoc comments including description in the following form: /** * Type description. Every method, field or initializer public, private or protected in top-level, inner or anonymous type should have at least minimal Javadoc comments including description and description of Javadoc tags, where applicable. For example:
5 /** * Description. * i Integer parameter. f Float parameter. Long comment, foo * bar, foo bar, foo bar. Double value. public double foo(int i, float f) { /** * Some meaningful comment. static { NOTE: multiline comments in Javadoc tags should be indented by 4 or 5 characters depending on configuration of IDE. In most IDEs the single TAB click will produce only 1 character identation which is not enough for readability. Second click on TAB will shift it to (1+4) 5 characters. This is the only exception from 4-characters tabulation rule. It is ok to have empty (/* /) or auto-generated Javadoc comments for code elements that are "work in progress". However, it is not allowed to not have a Javadoc comment at all, i.e. every field, method, initializer or type regardless of visibility scope should have at least empty Javadoc with minimally required Javadoc tags (see above). Description must be separated by one blank line from Javadoc tags. / / or // comments should be avoided in between methods, fields or types. Such comments in most cases should be used within the methods. All comments should follow English grammar and punctuation including starting with upper-case letter and ending with '.'. No technical jargon is allowed in the comments. All identifiers in the Javadoc comments must be placed within <tt></tt> or linked to, if possible, using {@link ClassName or {@link ClassName#method constructs. Shorter one-line Javadoc Method's javadoc should be equals to /** {@inheritdoc in case it overrides or implements method without changing contracts declared at parent's javadoc. Use a shorter version of {@inheritdoc. /** * public void m() {... Bad
6 public void m() {... Good One-line Javadoc comments allowed and preferred for fields. /** Array index. One-line comment is only allowed for fields. private int index; TODO Define indentation policy with multi-line parameter descriptions. Method Arguments Two styles of method parameter declaration are allowed. First style is preferred when all arguments can fit in a single line before the page delimiter (120 char limit). public void foo(object obj1, Object obj2, Object obj3,..., Object objn) If arguments can't fit to single line, arguments are splitted by 120 char limit to several lines. Second style requires new line for every argument. public void foo( Object obj1, Object obj2,..., Object objn ) Mixing declartaion styles is not allowed. Spacing Source code has special spacing rules (mostly inherited from Sun's Java source code guidelines and mentioned here for better clarity). In comma-separated enumerations there is always a space between comma and the next element in the list. For example, foo(p1, p2, p3) Notice spaces between comma ',' and the next parameter. There is always a space in between operands and binary operation itself. For example: a += b; b = a; a * (c + b) / d There should be no space between unary operation and its operand. For example:
7 !a, ~b, -b, b++ Notice also that all assignments by this rule should have space around '=' symbol: int a = b Comments should be separated by space from "// ", "/, "/** "* or " ". For example, / Notice the space. / Package Importing Use per-class importing. In case of the naming conflict - use fully qualified names (FQN). Use imports instead of FQNs in Javadoc links. Import should be ordered alphabetically, but packages starting with 'java.' should be declared prior to others. Static imports should follow same rules as regular imports and be separeted by a new line. import java.util.arraylist; import java.util.collection; import org.apache.ignite.lang.igniteuuid; import org.apache.ignite.thread.ignitethread; import org.jsr166.concurrenthashmap8; import static java.util.concurrent.timeunit.milliseconds; import static org.apache.ignite.events.eventtype.evt_node_failed; import static org.apache.ignite.events.eventtype.evt_node_joined; import static org.apache.ignite.events.eventtype.evt_node_left; Semantic Units The source code should be broken into minimal semantic units and all such units must be separated by one empty line. To simplify the recognition of semantic units, the every line of the source code should be separated by one empty line except for the following cases: Between lines in continues comments (/ /' or //) that span more then one line. Between import statements. After { and brackets. Between Javadocs tags in the comment. Between code comment and corresponding code line. Between Javadocs comment /* / and corresponding element (type, method, initializer, or variable). Between one-line case statements in switch operator. Between identical (similar) language constructs, i.e. identical (similar) method calls or operations, e.g. multiple setter or getter calls can be grouped together without empty lines between them. Whitespaces and empty lines Source code line should not be longer then 120 characters (to be visible on most conventional monitors). 4 space characters should be used for tabulation and indentation. IDE should be configured to replace tabulation with spaces (to properly see source code on the platforms with different tabulation sizes). Empty lines should be used according to following rules: Where Number of empty lines required Before package statement 0 Before imports 1
8 Between imports and static imports 1 Before class header 1 After class header 0 Between class definition and EOF 1 Between class members (filelds, methods, initializers) 1 Between minimal semantic units in the method or initializer body 1 Note that single blank line SHOULD NOT be used for the mere decoration of the source code. Avoid using double empty lines. Blanks space (1 space character) should be used before opening ( or {. { and should always be the last tokens in the line (except for the possible comments). However, blank space should not be used between method name and opening (. Example: /** * Class definition example. @java.version class Foo { /** * Example method. * i Example parameter. MyException Thrown in case of any error. public void method(int i) throws MyException { if (i > 0) { // Do recursion. try { for (int j = 0; j < 10; j++) method(i--); catch (MyException e) { e.printstacktrace(); switch (i) { case 10: return i - 1; case 11: i += 2; i /= 10; break; default: assert false;
9 // No javadoc for anonymous classes. MyInterface itf = new MyInterface() public int mymethod(int p) { return p++; ; if (i < 0) { // Exit now. System.out.println("Woo-hoo"); System.out.println("One more Woo-hoo"); return; Line Breaking If source code lines and/or Javadoc lines get longer than 120 characters it should be broken. The rule is to start consequent line 4 spaces to the right relatively to first line. All other lines 3rds, 4th, etc. (if overall line gets longer than 120x2) should start on the same indentation as 2nd line. No other decorative rules are allowed. In other words, the current line should never be indented more then 4 spaces to the right from the previous line. The line should be broken on the last '.' or ',' character that fits into 120 character margin. String Output All output debug/logging output including tostring() methods and exception messages should follow the next BNF: output: prefix prefix ": " postfix prefix '[' nv-pairs ']' ; nv-pairs: pair pair ", " pair ; pair: name '=' value ; prefix, postfix, name, value: java.lang.string ; For example: throw new CacheException("Invalid type [type=" + type + ", xid=" + tx. getxid() + ']'); throw new WorkflowException("Invalid rule: " + rule.getname()); Note that all prefix, postfix, name, value should follow English grammar, in particular, start with upper case and end with the dot '.'. If it is necessary to output error message (e.g. from exception) as name-value pair it should have err name. For example:
10 throw new GridException("Failed to instantiate bean [type=" + GridConfiguration.class + ", err=" + e.getmessage() + ']', e); Do not use error, errmsg, etc. Java 5 Java 5 added many additional useful features that significantly improve quality of When overriding methods from parent class always annotation. Generics Allways use generics when types of classes are known in advance. Use foreach loops whenever possible. for (String s : list) {... Java 8 Java 8 added lambda expressions and Stream API. While lambda expressions are more expressive and concise, good old anonymous classes are still preferred in Apache Ignite code base. Stream API is convenient means of data processing but usages of this API should be avoided in most cases because it can lead to unpredictable and uncontrolled creation of class instances and therefore create additional pressure on All annotations must be placed on a separate line, except as in the following example: @Override public String tostring() { return annotations should be in the same sequence as shown in the example. We do not annotation. Warning suppression Don't use statement warning suppression. Bad public static <T> T[] newarray(class<t> type, int length) { //noinspection unchecked return (T[])Array.newInstance(type, length);
11 public static <T> T[] newarray(class<t> type, int length) { return (T[])Array.newInstance(type, length); Assertions and parameter validation When correctness of code depends on some preconditions or expectations (including values of the call arguments) they should be expressed explicitly using assert statements. In public API methods functions from GridArgumentCheck class should be used for argument check instead of assert. Capsule(State state) { assert state!= null; Good this.state = state; Good public SomePublicConstructor(int max) { A.ensure(max > 0, "max > 0"); this.max = max; tostring(), equals(), hashcode() If a class overrides tostring() method, this method goes last. If a class overrides equals() and hashcode() methods, they should go before tostring(), if it is present, or last. Getters and setters Getters and setters should be implemented without get/set prefixes in internal APIs. TODOs Use next format for TODOs. // TODO: IGNITE-xxx, <description of what should be done>. It's mandatory to use related JIRA ticket number.
12 Commented out code We try not using commented out code. If there is no another option and code have to be commented then TODOs (with related JIRA ticket) have to be added before commented out code. Appendices: A. Configure IntelliJ IDEA code style In order to configure IntelliJ IDEA for Ignite code style follow these steps: copy ignite\idea\ignite_codestyle.xml to <user_home>\.ideaic14\config\codestyles (or to ~/Library /Preferences/IntelliJIdea14/codestyles on Mac) select ignite in IDE Settings -> Code Style Configure IDEA to stripe trailing spaces and add blank line to the end of file. B. Broken tests We try to not use commented code. So, in case if test(s) is broken the test should be muted on TeamCity with a related to JIRA ticket comment which describe a reason of fail.
13 If test hangs or works too long then fail(" method should be added as first line of the test. To disable all tests in *Test class use protected void beforetest() throws Exception { fail("
QueueBlock, ReversalADT, LinkedList,CustomerAccount, not MaintainCustomerData
Naming Conventions Rules Classes Use nouns Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML) Begin with upper case
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationCSE 11 Style Guidelines
CSE 11 Style Guidelines These style guidelines are based off of Google s Java Style Guide and Oracle s Javadoc Guide. Overview: Your style will be graded on the following items: File Headers Class Headers
More informationIndex. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107
A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationMakefiles Makefiles should begin with a comment section of the following form and with the following information filled in:
CS 215 Fundamentals of Programming II C++ Programming Style Guideline Most of a programmer's efforts are aimed at the development of correct and efficient programs. But the readability of programs is also
More informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationDocumentation Requirements Computer Science 2334 Spring 2016
Overview: Documentation Requirements Computer Science 2334 Spring 2016 These requirements are based on official Java coding conventions but have been adapted to be more appropriate to an academic environment.
More informationClasses, interfaces, & documentation. Review of basic building blocks
Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform
More informationWhat does this program print?
What does this program print? Attempt 1 public class Rec { private static int f(int x){ if(x
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationAppendix G C/C++ Notes. C/C++ Coding Style Guidelines Ray Mitchell 475
C/C++ Notes C/C++ Coding Style Guidelines -0 Ray Mitchell C/C++ Notes 0 0 0 0 NOTE G. C/C++ Coding Style Guidelines. Introduction The C and C++ languages are free form, placing no significance on the column
More informationGenerating/Updating code from whole project
Round-trip engineering is the ability to generate model from source code and generate source code from UML model, and keep them synchronized. You can make use of round-trip engineering to keep your implementation
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationLESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:
LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words
More informationJava Style Guide. 1.0 General. 2.0 Visual Layout. Dr Caffeine
September 25, 2002 Java Style Guide Dr Caffeine This document defines the style convention the students must follow in submitting their programs. This document is a modified version of the document originally
More informationThe MaSH Programming Language At the Statements Level
The MaSH Programming Language At the Statements Level Andrew Rock School of Information and Communication Technology Griffith University Nathan, Queensland, 4111, Australia a.rock@griffith.edu.au June
More information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More informationCSCI 2101 Java Style Guide
CSCI 2101 Java Style Guide Fall 2017 This document describes the required style guidelines for writing Java code in CSCI 2101. Guidelines are provided for four areas of style: identifiers, indentation,
More informationDecaf Language Reference Manual
Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented
More informationC Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a
More informationChapter 2 Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion
More informationIT Web and Software Developer Software Development Standards
IT Web and Software Developer Software Development Standards Definition of terms Identifier An identifier is the name you give variables, methods, classes, packages, interfaces and named constants. Pascal
More informationAPI Knowledge Coding Guide Version 7.2
API Knowledge Coding Guide Version 7.2 You will be presented with documentation blocks extracted from API reference documentation (Javadocs and the like). For each block, you will be also presented with
More informationKey Differences Between Python and Java
Python Python supports many (but not all) aspects of object-oriented programming; but it is possible to write a Python program without making any use of OO concepts. Python is designed to be used interpretively.
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationIPCoreL. Phillip Duane Douglas, Jr. 11/3/2010
IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationJavadoc. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 7
Javadoc Computer Science and Engineering College of Engineering The Ohio State University Lecture 7 Motivation Over the lifetime of a project, it is easy for documentation and implementation to diverge
More informationCS260 Intro to Java & Android 03.Java Language Basics
03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance
More informationUser Interface Programming OOP/Java Primer. Step 3 - documentation
User Interface Programming OOP/Java Primer Step 3 - documentation Department of Information Technology Uppsala University What is the documentation? Documentation about program in the program Clearly written
More informationAPPENDIX A : Example Standard <--Prev page Next page -->
APPENDIX A : Example Standard If you have no time to define your own standards, then this appendix offers you a pre-cooked set. They are deliberately brief, firstly because standards
More informationRule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.
Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public
More informationJava: advanced object-oriented features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: advanced object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Packages
More informationTypescript on LLVM Language Reference Manual
Typescript on LLVM Language Reference Manual Ratheet Pandya UNI: rp2707 COMS 4115 H01 (CVN) 1. Introduction 2. Lexical Conventions 2.1 Tokens 2.2 Comments 2.3 Identifiers 2.4 Reserved Keywords 2.5 String
More informationCS 351 Design of Large Programs Coding Standards
CS 351 Design of Large Programs Coding Standards Brooke Chenoweth University of New Mexico Spring 2018 CS-351 Coding Standards All projects and labs must follow the great and hallowed CS-351 coding standards.
More informationAppendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.
A Appendix Grammar There is no worse danger for a teacher than to teach words instead of things. Marc Block Introduction keywords lexical conventions programs expressions statements declarations declarators
More informationIntroduce C# as Object Oriented programming language. Explain, tokens,
Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation
More informationJava Programming Style Guide
Java Programming Style Guide Computer Science Program Cedarville University Goal: Our goal is to produce well-written code that can be easily understood and will facilitate life-cycle maintenance. These
More informationPoints To Remember for SCJP
Points To Remember for SCJP www.techfaq360.com The datatype in a switch statement must be convertible to int, i.e., only byte, short, char and int can be used in a switch statement, and the range of the
More informationAll code must follow best practices. Part (but not all) of this is adhering to the following guidelines:
Java Coding Guidelines Version 1.3.2 All code must follow best practices. Part (but not all) of this is adhering to the following guidelines: Development For code development, I recommend the following
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationDocumenting Java Code. Javadoc: The Tool and the Legend
Documenting Java Code Javadoc: The Tool and the Legend Comments in Java Regular Java comments: /* */ for programmers who must read or modify your code. One Liners : // for programmers who must read or
More informationTokens, Expressions and Control Structures
3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type
More informationCS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)
CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationMaintainability and Readability. What makes code readable? Understandable code. General Routine Structure. General Module Structure
Maintainability and Readability elements of maintainability program readability module structure commenting coding standards code ownership 11/23/2012 Maintainability, Readability, Style & Standards 2
More informationWA1278 Introduction to Java Using Eclipse
Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA1278 Introduction to Java Using Eclipse This course introduces the Java
More informationPython I. Some material adapted from Upenn cmpe391 slides and other sources
Python I Some material adapted from Upenn cmpe391 slides and other sources Overview Names & Assignment Data types Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More information11 Coding Standards CERTIFICATION OBJECTIVES. Use Sun Java Coding Standards
11 Coding Standards CERTIFICATION OBJECTIVES Use Sun Java Coding Standards 2 Chapter 11: Coding Standards CERTIFICATION OBJECTIVE Use Sun Java Coding Standards Spacing Standards The Developer exam is challenging.
More informationPHP-FIG Home Blog PSRs Personnel Bylaws FAQs Get Involved PSR-2: Coding Style Guide
PHP-FIG Home Blog PSRs Personnel Bylaws FAQs Get Involved PSR-2: Coding Style Guide This guide extends and expands on PSR-1, the basic coding standard. The intent of this guide is to reduce cognitive friction
More informationObjectives for this class meeting. 1. Conduct review of core concepts concerning contracts and pre/post conditions
CSE1720 Click to edit Master Week text 01, styles Lecture 02 Second level Third level Fourth level Fifth level Winter 2015! Thursday, Jan 8, 2015 1 Objectives for this class meeting 1. Conduct review of
More informationJava+- Language Reference Manual
Fall 2016 COMS4115 Programming Languages & Translators Java+- Language Reference Manual Authors Ashley Daguanno (ad3079) - Manager Anna Wen (aw2802) - Tester Tin Nilar Hlaing (th2520) - Systems Architect
More informationMarcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science
Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science mluckner@mini.pw.edu.pl http://www.mini.pw.edu.pl/~lucknerm } Annotations do not directly affect program semantics.
More informationJava Programming Tutorial 1
Java Programming Tutorial 1 Every programming language has two defining characteristics: Syntax Semantics Programming Writing code with good style also provides the following benefits: It improves the
More informationJOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide
Module 3 Identifiers, Keywords, and Types Objectives Upon completion of this module, you should be able to: Use comments in a source program Distinguish between valid and invalid identifiers Recognize
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationAdvanced Object Oriented Programming EECS2030Z
Advanced Object Oriented Programming EECS2030Z 1 Academic Support Programs: Bethune having trouble with your FSC and LSE courses? consider using the Academic Support Programs at Bethune College PASS free,
More informationd-file Language Reference Manual
Erwin Polio Amrita Rajagopal Anton Ushakov Howie Vegter d-file Language Reference Manual COMS 4115.001 Thursday, October 20, 2005 Fall 2005 Columbia University New York, New York Note: Much of the content
More informationProgram Fundamentals
Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java
More informationRTL Reference 1. JVM. 2. Lexical Conventions
RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's
More informationApplication Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started
Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features
More informationAssignment 5. Introduction
Assignment 5 Introduction The objectives of this assignment are to exercise a few advanced object oriented programming and basic data structures concepts. The first mini-goal is to understand that objects
More informationBrief Summary of Java
Brief Summary of Java Java programs are compiled into an intermediate format, known as bytecode, and then run through an interpreter that executes in a Java Virtual Machine (JVM). The basic syntax of Java
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationProgramming Syntax and Style. David Greenstein Monta Vista High School
Programming Syntax and Style David Greenstein Monta Vista High School Programming Language Syntax All have: Comments Programmer-defined Names Reserved Words Structure Assembly Code (Amiga 68K) 1950 1960
More informationUMBC CMSC 331 Final Exam
UMBC CMSC 331 Final Exam Name: UMBC Username: You have two hours to complete this closed book exam. We reserve the right to assign partial credit, and to deduct points for answers that are needlessly wordy
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Copyright 1992-2015 by Pearson Education, Inc. All Rights Reserved. Data structures Collections of related data items. Discussed in depth in Chapters 16 21. Array objects Data
More informationChapter 9: Dealing with Errors
Chapter 9: Dealing with Errors What we will learn: How to identify errors Categorising different types of error How to fix different errors Example of errors What you need to know before: Writing simple
More informationLanguage Fundamentals Summary
Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationOperators and Expressions
Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions
More informationCoding Standards for Java
Why have coding standards? Coding Standards for Java Version 1.3 It is a known fact that 80% of the lifetime cost of a piece of software goes to maintenance; therefore, it makes sense for all programs
More informationDaMPL. Language Reference Manual. Henrique Grando
DaMPL Language Reference Manual Bernardo Abreu Felipe Rocha Henrique Grando Hugo Sousa bd2440 flt2107 hp2409 ha2398 Contents 1. Getting Started... 4 2. Syntax Notations... 4 3. Lexical Conventions... 4
More informationx = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0
6 Statements 43 6 Statements The statements of C# do not differ very much from those of other programming languages. In addition to assignments and method calls there are various sorts of selections and
More informationJAVA PROGRAMMING LAB. ABSTRACT EXTRA LAB, In this Lab you will learn working with recursion, JRX, Java documentations
Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Computer Programming Lab (ECOM 2114) ABSTRACT EXTRA LAB, In this Lab you will learn working with recursion, JRX, Java documentations
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and
More informationC Formatting Guidelines
UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO C PROGRAMMING SPRING 2012 C Formatting Guidelines Lines & Spacing 1. 100 character lines (tabs count
More informationJava Notes. 10th ICSE. Saravanan Ganesh
Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses
More informationProgramming Language Basics
Programming Language Basics Lecture Outline & Notes Overview 1. History & Background 2. Basic Program structure a. How an operating system runs a program i. Machine code ii. OS- specific commands to setup
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions
More informationCSCI 1060U Programming Workshop
CSCI 1060U Programming Workshop Professor: Dr. Jeremy S. Bradbury Phone: 905-721- 8668 ext. 3685 E- mail: jeremy.bradbury@uoit.ca Office hour: To be announced (UA4016), otherwise by appointment Teaching
More informationMatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017
MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017 Language Guru: Kimberly Hou - kjh2146 Systems Architect: Rebecca Mahany - rlm2175 Manager: Jordi Orbay - jao2154
More informationPROGRAMMING III OOP. JAVA LANGUAGE COURSE
COURSE 3 PROGRAMMING III OOP. JAVA LANGUAGE PREVIOUS COURSE CONTENT Classes Objects Object class Acess control specifier fields methods classes COUSE CONTENT Inheritance Abstract classes Interfaces instanceof
More informationUEE1302 (1102) F10: Introduction to Computers and Programming
Computational Intelligence on Automation Lab @ NCTU Learning Objectives UEE1302 (1102) F10: Introduction to Computers and Programming Programming Lecture 00 Programming by Example Introduction to C++ Origins,
More informationJava Coding style guide 1. Java. Coding Style Guide. (July 2015)
Java Coding style guide 1 Java Coding Style Guide (July 2015) This coding style guide provides advices how to design and document your software so that your source code is easier to read, to debug, to
More informationC++ Programming Style Guide
C++ Programming Style Guide Computer Science Program Cedarville University Goal: Our goal is to produce well-written code that can be easily understood and will facilitate life-cycle maintenance. These
More information