1/99
Tawfik's first vocab set for HP1
Rule
Required items for a program to compile/run
Convention
Items not required to compile, but generally accepted programming practices
Naming convention
Consistent, structured plan for naming things
Camel Case
The naming convention where the first letter of each additional word is capitalized with no spaces between words (Ex: camelCase)
Upper Camel Case
The naming convention where the first letter of each word is capitalized with no spaces between words (Ex: CamelCase)
Editor
Used to write and manipulate source code
Compiler
Transforms source code written in a programming language into another computer language
Integrated Development Environment (IDE)
Software application that provides comprehensive development tools to programmers
Object
Code that represents real and imaginary things in a program
*Objects can have states/attributes and dbehaviors (actions) and are defined by a class (EX: DOG object: States - moving, asleep, sick; Attributes: name, breed, color, weight, height; Behaviors - bark, eat, sleep, run, poop)
Class
A java file and the blueprint/template for creating objects (describes the states and behaviors)
Method
Behaviors (actions) of an object
Field
Stores the states/attributes of an object
Public
Used in the declaration of a class, method, or field that can be accessed by the members of any class
Void
Method modifier that returns nothing
Argument
Input by users or other methods
Escape Sequence
A combination of characters starting with a backslash (\) and placed within quotes with meaning beyond the literal characters, they are primarily used to put non-printable characters in string literals.
Ex:
\n – newline
\r – carriage return
\t – tab
\f – form feed
\’ – single quote
\” – double quote
\\ – backslash
Arithmetic Operators
Used in mathematical expression in the same way that they are used in algebra ( +, -, *, /, %, ++, -- )
Relational Operators
Return true or false ( >, <, >=, <=, !=, == )
Numerical Literal
A sequence characters made of digits and up to one decimal point that may be preceded by a plus or minus sign
String Literal
A sequence of characters enclosed in quotation marks
String Concatenation
The operation of joinng character strings end-to-end
Comment
Explanation or annotation in the soure code of a program ignored by the computer.
Modulus
Like dividing, but only returns the remainder; remainder of the division of one number by another
Modulo
Arithmetic operator (%) that returns the reaminder of integer divison.
13 % 6 = 1
4 % 2 = 0
5 % 10 = 5
^
If the number, the second number(divisor) is bigger than the first(dividend), and the answer would be a decimal, then the answer would just be the first original number(divisor).
Divison
In basic programming division for many languages, when dividing without using a decimal in programming then it returns only the whole number, not the remainder.
Ex:
13 / 2 = 6
^
Only returns the whole number, not the remainder
Variable
Memory location paired with a symbolic name that can hold a value used in a program
The “final” keyword is the only difference between making a varible and a constant; If you use the word “final”, it is a constant.
Constant
Variable that cannot be altered once initialized
The “final” keyword is the only difference between making a varible and a constant; If you use the word “final”, it is a constant.
Identifier
User-defined named of a program element (varibale name, method name, etc.)
Declaration
Identifying the name of an item you plan to use later in the program
Initialization
Assigning the original value to a variable, constant, or array
Final
Modifier to define an entity that cannot be changed nor defived from once initialized
The “final” keyword is the only difference between making a varible and a constant; If you use the word “final”, it is a constant.
Assignment Operator
Assigns the value on its right to a varibale or element on its left (=)
Primitive Data Type
Type with predetermined memory size to hold the value of variables
Byte
Integers from -128 to 127 (Size 8 bit)
Short
Integers from -32,768 to 32,767 (Size 16 bit)
Int
Integers from -2,147,483,648 to 2,147,483,647 (Size 32 bit)
Long
Integers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (Size 64 bit)
Float
Real numbers from 3 .4e–038 to 3.4e+038 (Size 32 bit) roughly 6-7 decimal digits
Double
Real numbers from 1 .7e–308 to 1.7e+308 (Size 64 bit) roughly 15-16 decimal digits
Boolean
True/false, (Size 1 bit)
Char(Character)
Single Unicode character (Size 16 bit)
Variables Rules/ Naming Conventions
Start with a letter, but can have numbers after (Rule)
Has no spaces or symbols (Rule)
Starts with a lowercase letter (Convention)
camelCase if multiple words (Convention)
Constants Rules/Naming Conventions
Start with a letter, but can have numbers after (Rule)
Has no spaces or symbols (Rule)
Letters are ALL CAPS with underscores (_) between words (Convention)
Reference Data Type
Does not hold hte value of a variable, but just a reference to a different memory location with the value.
String
Reference Data Type… a String variable does no thold hte actual “string” of letters. It holds a reference (remote) to a different location in memory that holds the letters.
Documentation
Written text that accompanies software that explains how it works or how ot use it
Ex: Instruction manuals, Coding Comments,
Pseudocode
Informal description of the operating principle of a computer program inteded for human reading rather than machine reading
Package
Groups for organization within Java progamming
Import
Used at the beginning of a source file to specify classes or entire Java packages to be referred to later.
Double
Can hold a very big number or a very precise decimal number; for holding decimal integers
Float term
For holding decimal integers, ½ as small as a double
If
Used to create a statement which tests a boolean expression
Else
Used in conjunction(alongside) with if to create statement which tests a boolean expression
equals()
Compares the target values that are referenced in the variable’s memory
Readability
It is much easier to understand code that has a clearly named constant than just a number like “1.027”
Memorable
Numbers with several digits may be difficult to remember when writing code and you can waste time by needing to look it up frequently. Memorable code utilizes constants or variables with meaningful names, making it easier for programmers to recall and understand.
Upgradeable
It is much easier to change/update a program that uses constants if in fact the constant needs to be changed at a later time (ex. scientists discover the gravity for Venus is actually .82 instead of .78 and you used a .78 in over 80 different places in your code).
Safety
It is possible to forget that a variable needs to stay the same later while coding. If using a variable and not a constant for a value that should not change, you may mistake it later and change it. Even more likely, if working with otehr programmers, it will not be clear that the value should not change. A constant prevents you from accidentally changing a needed value while also protecting it from other programmers.
Algorithm
A procedure or formula (to solve a problem)
truth table
mathematical table used in logic in connection with boolean functions which sets out the functional values of logical expressions on each of their functional arguments
Truth Tables (in code):
// AND
System.out.println(true && true); // true
System.out.println(true && false); // false
System.out.println(false && true); // false
System.out.println(false && false); // false
// OR
System.out.println(true || true); // true
System.out.println(true || false); // true
System.out.println(false || true); // true
System.out.println(false || false); // false
// Not (!)
System.out.println(!true); // false
System.out.println(!false); // true
System.out.println(!(true && true)); // false
System.out.println(!(true || false)); // false
System.out.println(!(false || false)); // true
System.out.println(!(!false || false) && (!true || true));
System.out.println(false && true); // false
logical operators
checks two boolean values to determine if an expression is true or false (&&, ||)
Compound If Statements
&& and || - Only work with boolean data type and they “short ciruit”
Flowchart
diagram of the sequence of operations in a computer program
pill (rounded rectangle) - start/end of program
rectangle - task or action
diamond - decision (yes or no / true or false)
parallelogram - input or output
syntax error
one or more characters incorrectly placed in a command that causes a failure in execution
compile-time error
error that occurs when code is compiled and is typically a result of a syntax error
runtime error
problem that occurs while program is running and not caught by compiler
logic error
mistake in source code that results in unexpected behavior
compareTo()
compares to strings lexicographically iwth the value based on the Unicode value of each character in the string.
lexicographical
dictionary or “alphabetical” order
length()
returns an int representing the total number of characters in the String (including punctuation adn whitespace).
ex: if the variable str contains the String “hello”, then str.length() will return 5 and a String with “ hello “ would return 7.
charAt(int in)
returns the nth character (char) in the String. The character positions are zero=based. so if the variable str contains the String “bulldog”,then str.charAt(0) will return ‘b’, and str.charAt(4) will return ‘d’.
keyword
one of 50 reserved terms that have a special function and a set definition in the java programming language. The fact that the terms are reserved means that they cannot be used as identifiers for any other program elements, including classes, subclasses, variables, and methods.
scope
the region of a computer program where the name binding of a variable is valid
base 16 numeral system
represents numeric values using 16 different symbols = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F
base 8 numeral system
represents numberic values using 8 different symbols 0,1 2, 3, 4, 5, 6, and 7
octal
(base 8) a positional numeral system with a base of 8
base 1 numeral system
represents numeric values using one symbol (just like making tally marks)
nibble
unit of information consisting of four bits (half byte)
byte (Java)
integers from -128 to 127 (size 8 bit)
byte
unit of information consisting of 8 bits
short
unit of info size 16 bit
int
unit of info size 32 bit
long
unit of info size 64 bit
float
unit of info size 32 bit
double
unit of info size 64 bit
boolean
unit of info size 1 bit
char
unit of info size 16 bit
Reference Data Type
Size 64 bit
iterational
statements are executed repeatedly
selectional
based on conditions, different statements are executeds
sequential
executed in the order written
control structures
way to specify the order of executing the statements
structured programming
all programs are composed of 3 control structures
exeption
event that disrupts the normal flow of a program’s instructions
thread
independent path of execution within a program
for
used to create a loop which specifies a variable initialization, a boolean expression, and an incrementation
break
used to terminate program executino in the current loop body
continue
resume program execution at the end of the current loop body
return
used to finish teh execution of a method and can be followed by a value required by the method definition
parameter
variable declared in method definition required for method call