CS139 - Abstract Concepts
Value
- Note difference between the value and how a value is communicated
- A value is an abstraction
- Examples of simple values: one, 52, XII, red, truth, the character 'p'
- Example of complex value: a checking account entry (date, check#, amount, recipient, etc)
- For complex values, maybe "state" is a better word
Data Type
- A set of values
- Examples: integers, rational numbers, colors, boolean, characters
Primitives and Objects
- For now, we will think of them as the same thing
- A "container" for a value
- Store a single value of a particular data type
(but that value may be "complex")
- Has a "name"
- Creating a "container" is called "instantiation" or declaration.
Variables, contants, literals
- Different kinds of "containers":
- Literals: store explicit values: 1, 'a', true
- Constants: store unchanging values that represent some concept: MAX_SAT_SCORE, GPA_FOR_A, INCHES_PER_FOOT
- Variables: store values that can change
Identifiers/Names
- Naming conventions:
- titlecase: ThisIsTitleCase
- mixedcase: thisIsMixedCase
- uppercase: THIS_IS_UPPERCASE
- lowercase: thisislowercase
- lowercase hyphenated: this-is-lowercase-hypenated
Operations/Functions and Methods
- Examples: addition, !=, >, &&
- Function concept in math
- Range and domain
- Zero or more "operands"
- Operands and result may not all be the same data type
- Side effects
- Assignment
Abstract Data Type
- A data type and the operations for that data type
Type Conversion
- Implicit or explicit
- Example: 2 / 1.4
Input/Output
- Queues (sequential), also known as "streams"
- No knowledge of prior or future input
- Interface with world outside the program
out
, in
, err
- Mapped to file or device by operating system
Date: 09/04/2005