Taxi Service Coding Policy. Version 1.2



Similar documents
Code convention document Argus-viewer

CSE 308. Coding Conventions. Reference

Taxi Service Design Description

C Coding Style Guide. Technotes, HowTo Series. 1 About the C# Coding Style Guide. 2 File Organization. Version 0.3. Contents

Some Scanner Class Methods

Java Classes. GEEN163 Introduction to Computer Programming

ECE 341 Coding Standard

Taxi Service Project Plan. Version 1.2

Dinopolis Java Coding Convention

Active Directory User Management System (ADUMS)

Software Development (CS2500)

Java: Learning to Program with Robots. Chapter 11: Building Quality Software

The Ultimate Guide to Magento SEO Part 1: Basic website setup

Java Program Coding Standards Programming for Information Technology

HP AppPulse Mobile. Adding HP AppPulse Mobile to Your Android App

CS 241 Data Organization Coding Standards

Lecture 5: Java Fundamentals III

Configuring Cisco CallManager IP Phones to Work With IP Phone Agent

Moving from CS 61A Scheme to CS 61B Java

Computer Programming I & II*

HC SHAREPOINT SERVICES MODULE SERVER CONFIGURATION. User Manual. Hosting Controller All Rights Reserved.

Oracle Policy Automation A Modern Enterprise Policy Automation Solution

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

Introduction This document s purpose is to define Microsoft SQL server database design standards.

Web Development Naming Conventions

VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR

Coding conventions and C++-style

Building a Multi-Threaded Web Server

Virtual Code Authentication User Guide for Administrators

Website Standards Association. Business Website Search Engine Optimization

Official Android Coding Style Conventions

Python Loops and String Manipulation

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

Java Application Developer Certificate Program Competencies

FTP client Selection and Programming

Java Code Conventions. September 12, 1997

VMware vcenter Log Insight User's Guide

Novell Identity Manager

46% 46% 34 Good Signals. 24 Issues Found. Keyword. Landing Page Audit. financial advisor.

T320 E-business technologies: foundations and practice

Computer Programming I

DESIGN REPORT FOR THE PROJECT INVENTORY CONTROL SYSTEM FOR CALCULATION AND ORDERING OF AVAILABLE AND PROCESSED RESOURCES

Java CPD (I) Frans Coenen Department of Computer Science

Hypercosm. Studio.

Oracle Enterprise Data Quality for Product Data

HIRSCH Velocity Web Console Guide

VMware vcenter Log Insight User's Guide

Carnegie Mellon University Master of Science in Information Technology Software Engineering (MSIT-SE) MSIT Project (17-677) Approval Form

Logging In You must log in to the system before you can begin exchanging files with UMB. To log in to the system, follow the steps below.

AppendixA1A1. Java Language Coding Guidelines. A1.1 Introduction

App Building Guidelines

ECAT SWE Exchange Customer Administration Tool Web Interface User Guide Version 6.7

NeoMail Guide. Neotel (Pty) Ltd

NYSP Web Service FAQ

Introduction to Java. CS 3: Computer Programming in Java

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Security+ Guide to Network Security Fundamentals, Fourth Edition. Chapter 10 Authentication and Account Management

Tableau Server Trusted Authentication

Developing Web Views for VMware vcenter Orchestrator

EMC Documentum Composer

Java Coding Style Guide

sqlite driver manual

Lab 0 (Setting up your Development Environment) Week 1

In this Lecture you will Learn: Implementation. Software Implementation Tools. Software Implementation Tools

Software Design Specification

PORTLANDDIOCESE.ORG - How to Connect Table of Contents

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

Fig (1) (a) Server-side scripting with PHP. (b) Client-side scripting with JavaScript.

Using AD fields in Policy Patrol

NetSupport DNA Configuration of Microsoft SQL Server Express

Software documentation systems

KB_SQL SQL Reference Guide Version 4

opencrx Language Localization Guide

Link Analysis Tool Design Description Final Version

VMware vrealize Log Insight User's Guide

Cal Poly Pomona Cascade Server Beginning Web Author Training

ScoMIS Encryption Service

Fairsail. Implementer. Fairsail to Active Directory Synchronization. Version 1.0 FS-PS-FSAD-IG R001.00

Sophos Mobile Control Web service guide

SOA REFERENCE ARCHITECTURE: WEB TIER

Listeners. Formats. Free Form. Formatted

Part II. Managing Issues

Configuring Load Balancing. Oracle Applications Release 10.7 NCA Windows NT Edition. Gary Burch. April 15, 1998

Microsoft SQL Server Connector for Apache Hadoop Version 1.0. User Guide

SCCM Plug-in User Guide. Version 3.41

Computer Networks Practicum 2015

Iowa Immunization Registry Information System (IRIS) Web Services Data Exchange Setup. Version 1.1 Last Updated: April 14, 2014

An Overview of Java. overview-1

My IC Customizer: Descriptors of Skins and Webapps for third party User Guide

ATTACHMENT 6 SQL Server 2012 Programming Standards

HELP DOCUMENTATION UMRA REFERENCE GUIDE

Transcription:

Taxi Service Coding Policy Version 1.2

Revision History Date Version Description Author 2012-10-31 1.0 Initial version Karlo Zanki 2012-11-18 1.1 Added a section relative to Java/Android Fabio Kruger 2013-01-02 1.2 Final version Fabio Kruger Page 2

TABLE OF CONTENTS 1. INTRODUCTION... 4 1.1 PURPOSE OF THIS DOCUMENT... 4 1.2 DOCUMENT ORGANIZATION... 4 1.3 INTENDED AUDIENCE... 4 1.4 SCOPE... 4 1.5 REFERENCES... 4 2. PROGRAMMING GOOD PRACTICES... 5 2.1 SELF-EXPLAINABLE CODE... 5 2.2 SEPARATION OF FUNCTIONS... 5 2.3 PROGRAMMING TO INTERFACE... 5 2.4 DEFENSIVE PROGRAMMING... 5 2.5 HARD-CODED VALUES... 5 2.6 REFACTORING... 5 2.7 DUPLICATING THE CODE... 5 3. CODING CONVENTIONS... 6 3.1 JAVA / ANDROID... 6 3.1.1 File suffixes:... 6 3.1.2 Source file format:... 6 3.1.3 Naming conventions:... 6 3.2.NET... 7 3.2.1 Naming conventions... 7 3.2.2 Public classes, methods, fields and properties... 7 3.2.3 Private, protected classes, methods, fields and properties... 7 3.2.4 Interfaces... 7 3.2.5 Boolean variables and methods... 7 3.2.6 Constants... 7 3.2.7 Language... 7 3.2.8 Database tables... 7 3.2.9 Comments... 7 3.2.10 Comments language... 7 3.2.11 XML comments... 7 Page 3

1. Introduction 1.1 Purpose of this document The goal of this document is to provide a coding convention for all developers working on the project. The team working on this project consists of 8 students, each used to develop the code in his own way, name objects in different style and arrange lines as it suits him. To avoid the code to become messy and hard to understand for different members of the team, we need to define some conventions we all are going to respect. This will reduce the risk of misunderstanding and speed up the development process. 1.2 Document organization The document is organized as follows: Section 1: Introduction, general description of the contents and main purpose of this document. Section 2: Programming good practices, useful advices for good programming. Section 3: Coding conventions, coding conventions that are going to be used on this project. 1.3 Intended Audience The intended audience is: Members of the taxi service team. DSD course supervisors 1.4 Scope This document will be used during the work on the Taxi Service project but it can also serve as a reference to some future projects. 1.5 References [1] Best practices in programming: http://net.tutsplus.com/tutorials/html-css-techniques/top-15-best-practicesfor-writing-super-readable-code/ [2] XML Documentation: http://msdn.microsoft.com/en-us/magazine/cc302121.aspx [3] C# coding conventions: http://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx Page 4

2. Programming good practices 2.1 Self-explainable code Try to write the code so it is understandable by itself. You can achieve this with smart naming of the methods and variables. In places where code is not understandable by itself write comments to describe it better. 2.2 Separation of functions Each element of the code (variable, method, class) should be responsible for only one thing. Don't complex methods. Simple methods are easier to understand and change if needed. This way you reduce coupling and increase cohesion. 2.3 Programming to interface -Whenever you have interaction between two classes that is not trivial to understand, and is probably going to be changed during time, it is good to extract interfaces. Extracting interfaces looses the coupling and enables you to change one without affecting the other and also to test one class without other one being even implemented. 2.4 Defensive programming During the development you need to expect that anything that can go wrong will go wrong. You need to predict all possible inputs into your program and make sure they don't cause failures in your system. User will always give wrong inputs, make your code robust. 2.5 Hard-coded values No hard-coded values except 0 and 1 are allowed in the program. It is better to create and use constants, so that the changes are centralized. 2.6 Refactoring Whenever you make important changes in your code refactor it. This way you make your code easy to maintain and avoid spaghetti code which is fragile and immovable. 2.7 Duplicating the code DON'T duplicate the code. Extract it to a method and call the method instead. Page 5

3. Coding conventions In this project we use mainly two programming languages: Java and.net. Java will be used in the client applications, both for the customer and the taxi driver. The applications are written for Android devices, therefore the conventions will be extended to take in account also the best practice for Android devices. The server component is written in.net. 3.1 Java / Android 3.1.1 File suffixes: Java utilizes the following suffixes: -.java: for source code files -.class: for Java byte code files. In addition, Android stores a great amount of configuration values, properties and application specifications are defined in XML files. 3.1.2 Source file format: Each Java source file contains a single public class or interface. When private classes and interfaces are associated with a public class, you can put them in the same source file as the public class. The public class should be the first class or interface in the file. Java source files have the following ordering: - Beginning comments: All source files should begin with a c-style comment that lists the class name, version information, date, and copyright notice. - Package and Import statements: - Class and interface declarations: they are composed of the following elements in sequence: o Class/interface documentation comment o Class/interface statement o Class/interface implementation comment o Class static variables o Instance variables o Constructors o Methods 3.1.3 Naming conventions: Package: The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names. Subsequent components of the package name vary according to an organization's own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names. Classes: Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML). Interfaces: Interface names should be capitalized like class names. Methods: Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. Variables: Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. Constants: The names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores ("_"). (ANSI constants should be avoided, for ease of debugging). Page 6

3.2.Net 3.2.1 Naming conventions Each name in the program (variable, class, method) should be simple and understandable to any person, not just to programmers. None of the names should contain more than 30 characters and should be written in PascalCase. 3.2.2 Public classes, methods, fields and properties Names of the public classes, methods, fields and properties Names should start with upper case. public class TaxiDriver { } 3.2.3 Private, protected classes, methods, fields and properties Names of the public classes, methods, fields and properties Names should start with lower case. private class cityzone { } 3.2.4 Interfaces Names of the interfaces should start with capital I. interface ITaxiDrive { } 3.2.5 Boolean variables and methods Boolean variables and methods should start with prefix is/has taxi.isassignedtoadrive(); 3.2.6 Constants words. The name of constants should be formed of uppercase letters. Underscores can be used to separate public const int SERVER_PORT = 1200; 3.2.7 Language English will be used for names of the program elements. 3.2.8 Database tables Database tables names should be in singular with upper case and shouldn't contain any prefix or sufix. 3.2.9 Comments 3.2.10 Comments language All comments should be in English. 3.2.11 XML comments Use comment documentation because it will make other developers easier to understand what your methods do and how should they be used. It also allows you to automatically create XML documentation. Page 7