Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Java Etiquette - Introduduction to Jave Programming - Lecture Slides, Slides of Java Programming

In the course of the Introduction to Jave Programming, we study the basic syntax and the basic program in java. In these lecture slides the key points are: Java Etiquette, Survey Results, Less Side Tracking, Toolbox, String, Double, Operations, Java Naming, Class Size, Variable

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarmistha
sarmistha 🇮🇳

3.8

(22)

113 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Java etiquette
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Java Etiquette - Introduduction to Jave Programming - Lecture Slides and more Slides Java Programming in PDF only on Docsity!

Java etiquette

Survey results

Less side tracking (questions that are not on topic) See website for all info! You may need to practice code outside class!

Monday's lab

Monday's lab

(See:MySwap.java)

Java naming

Conventions for identifiers: Class - Start with uppercase (e.g. StringBuffer) Object - Start with lowercase (noun) (e.g. homeworkOneGrade) Method - Start with lowercase (verb) (e.g. isEmpty() )

Java constants

Java constants should be in all caps and an underscore (_) go between words Example: public static final int ROOM_CAPACITY = 246; Should declare these above main method (see JavaConstants.java)

Java etiquette

Commenting

Types of comments: // ... - One line of comment (Ctrl + /) /* ... / - Everything between is commented (even multiple lines) /* ... */ - javadoc commentation

Indenting

Indent more when branching (braces) (NetBeans and many others do this automatically) Also indent when a single command takes up more than one line of code

Indenting

COMPUTER SCIENTISTS hunt elephants by exercising Algorithm A:

  1. Go to Africa.
  2. Start at the Cape of Good Hope.
  3. Work northward in an orderly manner, traversing the continent alternately east and west.
  4. During each traverse pass,
    1. Catch each animal seen.
    2. Compare each animal caught to a known elephant.
    3. Stop when a match is detected.

EXPERIENCED COMPUTER PROGRAMMERS modify Algorithm A by placing a

known elephant in Cairo to ensure that the algorithm will terminate.

ASSEMBLY LANGUAGE PROGRAMMERS prefer to execute Algorithm A on their

hands and knees. How to catch an Elephant in the Africa

Why proper coding?

Things to remember

If you find yourself going through the code and replacing numbers/variables/methods, then you should make a constant (or method) If you don't think carefully about variable names, you will have to go back and rename it (or have code with illogical names)