Skip to content

Development Guidelines

vaibhavglokhande edited this page Feb 10, 2019 · 4 revisions

Development Guidelines

Please follow the guidelines explained below.

Programming Guidelines

  • Use fully qualified names for classes, methods, fields and variables.

Example:

public class ClassName{
    String firstVariable;
    String secondVariable;
    int firstInteger;

    public String getFirstVariable(){
        return this.firstVariable;
    }
}
  • Do not use any single letter variables, but common variables like i, j for iteration and accessing indexes is allowed.

Example:

for(int i=0;i<100;i++){
    System.out.println("Number: " + i);
}
  • Use variable names which will define its meaning, for example list of customer objects can have variable like customerList or customers whereas a single object will be customer.

Example:

List<CustomerInfo> customerList,customers;
CustomerInfo customer;
  • Always use camelCase. For class definitions use UpperCamelCase and for methods, fields and variables user lowerCamelCase.

Example:

UpperCamelCase - CustomerInfo // Starts with upper case.
lowerCamelCase - customerInfo // Starts with lower case.
  • Follow DRY or Do Not Repeat Yourself principle.

  • For Constants, use allcapital SNAKE CASE

Example:

public static final String CONSTANT_STRING="Some String Value";

Web Service Respone Template

{
    responseCode:"Code",
    responseMessage:"Message",
    response:Object,
    [timestamp]:"dd:mm:yyyy,HH:MM:SS"  //Optional
}

All the webservices should follow the above mentioned response message format. Description

  1. responseCode This code gives the exact status of the respone of the service request. The detailed description of these response codes along with their meaning can be found [To be Linked].

  2. responseMessage This describes the responseCode. It can contain success messages or error descriptions. This will completely describe the nature of response to the UI/UX developer.

  3. response This is the actual response data. The response object will be JSON object from the service.

  4. timestamp This is optional argument, can be used to keep log of request timestamp.

Example This is a demo and not actual service response.

Request URL: https://server/api/login

Request Method: POST

Request Parameters: username = "username"&password="pass"

SUCCESS

Http Status: 200 OK

Response:

{
    responseCode:"1",
    responseMessage:"User successfully authenticated and access token has been generated.",
    response:{
        accessToken:"abc@ewi39@#9324",
        refereshToken:"asjnha*#@93e",
        expiry:"3600",
        uid:"123asd123"
    }
    timestamp:"31/12/2019,15:30:33"
}

FAILURE

Http Status: 403 Forbidden

Response:

{
    responseCode:"2",
    responseMessage:"Unable to authenticate user. Username or password incorrect.",
    response:{
    }
    timestamp:"31/12/2019,15:30:33"
}

Clone this wiki locally