DOC PREVIEW
UNF COP 2551 - Java Software Solutions

This preview shows page 1-2-3-25-26-27 out of 27 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Java Software SolutionsExternal Documentation javadocGood Programming PracticesIdentifiers and Reserved WordsExamples: The Reserved WordsReserved WordsRules for Naming IdentifiersConventions for Naming IdentifiersChoosing Identifier NamesWhite SpaceProgramming LanguagesFrom Machine Language to Assembly LanguageFrom Low-level Languages to High-level LanguagesFourth-Generation LanguagesCompilers and Interpreters (general)Editing and Running Your ProgramTranslation of Source CodeA CompilerAn InterpreterJava Uses Both a Compiler and InterpreterThe Advantage of Java BytecodeIntegrated Development Environments (IDEs)More on: Syntax and SemanticsSemantics (meaning)ErrorsCompile-time and Run-time ErrorsLogical Errors1/73Java Software SolutionsChapter 1.3Computer Systems(continued)2/73External DocumentationjavadocThe Java SDK (Software Development Kit) includes a means of creating external documentation using a software tool called javadoc . Here is how it works:If you place a second asterisk following the /* at the beginning of a comment, the content of the comment can be used to automatically generate external documentation about your program using a tool called javadoc .Example: /** javadoc will print this comment for use as external documentation. */ (Much more later).3/73Good Programming PracticesAppendix G of our text presents guidelines for good programming practices and includes specific techniques for documenting programs.You can assume the reader is computer literate and familiar with Java.You will be expected to apply the coding guidelines in as presented on my web page and in an appendix in the rear of this textbook as you write your programs.4/73Identifiers and Reserved WordsWords used when writing programs: identifiers. (algebraic ‘variables?’)Three categories of identifiers:1. Words that we make up (Lincoln and args in program 1.1)2. Words that another programmer chose (String, System, out, println, and main).Often these are words that were chosen by a programmer for code that became part of a Java library; Now available for use by all Java programmers.3. Words that are reserved for special purposes in the language (class, public, static, and void).The designers of the Java language chose these words.5/73Examples: The Reserved WordsReserved words are identifiers that have special meaning in a programming language.In the Lincoln program, they are class, public, static, and void.//********************************************************************// Lincoln.java Author: Lewis/Loftus//// Demonstrates the basic structure of a Java application.//********************************************************************public class Lincoln{//-----------------------------------------------------------------// Prints a presidential quote. //-----------------------------------------------------------------public static void main (String[] args) { System.out.println ("A quote by Abraham Lincoln:"); System.out.println ("Whatever you are, be a good one."); }// end main()} // end class Lincoln6/73Reserved WordsThe Java reserved words – these words cannot be used for any other purpose, such as naming a class or method.abstractbooleanbreakbytecasecatchcharclassconstcontinuedefaultdodoubleelseextendsfalsefinalfinallyfloatforgotoifimplementsimportinstanceofintinterfacelongnativenewnullpackageprivateprotectedpublicreturnshortstaticstrictfpsuperswitchsynchronizedthisthrowthrowstransienttruetryvoidvolatilewhile7/73Rules for Naming IdentifiersAn identifier (created by us) can be composed letters, digits, the underscore character ( _ ), and the dollar sign ($), but it cannot begin with a digit.Identifier = variable = property = data name, etc.Java is case sensitive, which means that two identifier names that differ only in the case of their letters are considered to be different identifiers.Total, Total, ToTaL, and TOTAL are all different identifiers.e.g. Total = 4; e.g. ToTAL = 6; // entirely different data names!8/73Conventions for Naming IdentifiersUse a consistent case format: Title case (uppercase for the first letter of each word) is conventional for class names.Example: class GraduateStudent (no space)Lowercase is used for the first letter of method names and variable (identifier) names. However, the first letter of each additional word that is part of the identifier is capitalized.Example: payRate and computeSalary()…Appendix G presents guidelines for naming identifiers.Your programs must follow those guidelines9/73Choosing Identifier NamesIdentifier names should be descriptive Avoid meaningless names as a or x.Unless the name is actually descriptive, such as using x and y to represent (x, y) coordinates.Avoid using unnecessarily long names.10/73White SpaceWhite space: blanks, tabs, and newline characters.White space is used to separate words and symbolsA programmer can use white space to emphasize parts of the program and to make the program easier to read.Except when it’s used to separate words, the computer ignores white space.Allows programmers flexibility in formatting a program.11/73Programming LanguagesProgramming languages are often categorized into the following four classifications:1. Machine Languages2. Assembly Languages3. High-Level Languages4. Fourth-Generation LanguagesIn order for a program to run on a computer, it must ultimately be expressed in that computer’s machine language.12/73From Machine Languageto Assembly LanguageEach machine language instruction can accomplish only one simple task.For example, copy a value into a register or compare two values or add two numbers together….Machine language code is expressed as a series of binary digits and is extremely difficult for humans to read and write.Enter: Assembly LanguageThese are symbolic versions of machine language statements using mnemonics, short English-like words that represent commands or data.E.g. Instead of:01011010100000000101000000000100 (32 bits)5A805004 in hex may be rewritten in Assembler language as A 8,4(5,0) or, A 8,X Add what’s ‘at’ X to register 8 LR 4,5 (load register 4 from register 5)13/73From Low-level Languages to High-level LanguagesBoth assembly language and machine language are considered low-level languages.Generally, each assembly


View Full Document

UNF COP 2551 - Java Software Solutions

Download Java Software Solutions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Java Software Solutions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Java Software Solutions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?