Skip to main content

Coding Standards



 

Coding Standards

Java coding standards:
Sun recommended the following for the naming conventions.

1.In case of classes:
The first letter should be capitalized and if the several words are linked together to form the name ,the first letter of the inner words should be upper case.
For the classes the names should be nouns.
Ex: Student, Customer ,Employee etc.

2.In case of Interfaces:
For the interfaces the names should be adjective and follows camel case.
Ex:
Runnable .Serializable, cloneable, Comparable, Movable etc

3.In case of Methods:
The first letter should be lower case and then normal camel case rules should be used.
The names should be verb –noun pairs
Ex: getBalance(); doCalculation(0;
setCustomerName();

4.In case of variables:
Like methods the camel case format should be used stating with a lower case letter.
Ex: buttonwidth;
accountBalance
mystring

5.Constants:
java constants are created by marking variables as and final.
They should be named using upper case letter with underscore (_) is the separator.
Ex: MIN_HIGHT,MAX_HIGHT

Java Beans Naming Conventions:
Java Beans are java classes that have properties. All the properties must be declared as the private (to get security). For every property there should be getter and setter methods.The methods that change a property's value are called setter methods, and the methods that retrieve a property's value are called getter methods

Getter Methods: For every non – Boolean property ,the getter method prefix is get and for Boolean it can be get or is.

Getter method must be public and take no arguments and return the argument type of the setter method for that property.

Example –non Boolean: getXXX(); Example–Boolean: getXXX() or isXXX();

SetterMethods:The settermethod prefix is set.example setXXX();

Setter method signatures must be marked public, with a void return type
and an argument that represents the property type.

Comments

Popular posts from this blog

Yahoo! Calendar "Add Event" Seed URL Parameters

I can't seem to find any official documentation on this, so here are my notes. Some information gathered from  http://richmarr.wordpress.com/tag/calendar/ Other information gathered through trial and error, and close examination of the "Add Event" form on Yahoo!'s site. Yahoo! Calendar URL Parameters Parameter Required Example Value Notes v Required 60 Must be  60 . Possibly a version number? TITLE Required Event title Line feeds will appear in the confirmation screen, but will not be saved. May not contain HTML. ST Required 20090514T180000Z Event start time in UTC. Will be converted to the user's time zone. 20090514T180000 Event start time in user's local time 20090514 Event start time for an all day event. DUR value is ignored if this form is used. DUR 0200 Duration of the event. Format is HHMM, zero-padded. MM may range up to 99, and is converted into hours appropriately. HH values over 24 hours appear to be modulated by 24. Durations t...

Java Identifiers

Language Fundamentals Java Identifiers: A name in a java Program is called an Identifier, Which can be used for representing classes, methods, variables and labels. Rules: 1. Java Identifier is composed of a sequence of characters, where each character may be a   ASCII Latin letters A–Z(\u0041–\u005a), and a–z (\u0061–\u007a) and for historical reasons , the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024) and ASCII digits 0-9 (\u0030–\u0039). i.e A-Z,a-z,_,$,0-9 The $ character should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems. If we use other character we will get compiled time error saying illegal character. 2. No identifier starts with the digit. 3. There is no length limit for java identifier, but SUN highly recommended up to 15 characters. 4. Identifiers in java are case sensitive. 5. We are not allowed to use reserved words (java keywords) as identifier. 6 . All predefin...

HTML5 30-Day Course Outline

  🗓️ Week 1: HTML5 Fundamentals and Structure 🎯 Goal: Understand the structure of HTML5 and core elements. Day 1: Introduction to HTML5 ✅ Concepts What is HTML5 and its role in web development <!DOCTYPE html> declaration Basic HTML structure ( <html> , <head> , <body> ) Character encoding ( UTF-8 ) ✅ Example Code html <!DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < title >My First HTML5 Page </ title > </ head > < body > < h1 >Hello World! </ h1 > </ body > </ html > ✅ Task: 👉 Create a basic HTML page with a title and h1 element. Day 2: HTML Elements and Semantics ✅ Concepts Block vs Inline Elements <div> , <span> , <article> , <section> , <aside> , <main> , <footer> Importance of semantic HTML for SEO ✅ Example Code html < article > < header > ...