Flashcards
CS 2110 Test 1
Cards in this deck (51)
- 1objectan INSTANCE of a class with state/attribute and behavior
- 2classa TEMPLATE/BLUE PRINT that describes the behaviors/states that object of its type support
- 3methodbasically a behavior where logic and activities are carried out, data is manipulated, and all the actions are executed
typically each method is associated with one distinct behavior - 4instance variablesnon-static fields; unique values that describe an object's state
- 5variablea name associated with a reserved area allocated in memory
- 6local variablewhere a method stores its temporary state
identified from its location (between { and } in a method
only visible to the methods in which they are declared; not accessible from the rest of the class - 7instance variables (non-static fields)values unique to each instance of the class
declared inside the class but outside any other method - 8class variables (static fields)any field declared with the static modifier; only one copy of this variable no matter how many times the class has been instantiated
- 9statically typedall variables must first be declared with type & name beore they can be used
- 10primitive type (8)int
byte
short
long
double
float
char
boolean - 11primitive typea data type predefined by the language and named by a reserved keyword
- 12byte8-bit signed two's complement integer
min: -128
max: 127
default value: 0
4 times smaller than an int - 13short16-bit signed two's complement integer
min: -32,768
max: 32,767
default value: 0
2 times smaller than an int - 14int32-bit signed two's complement integer
min: -2,147,483,648
max: 2,147,483,647
default value: 0
GENERALLY USED AS DEFAULT DATA TYPE unless there is a memory concern - 15long64-bit signed two's complement integer
min: -9,223,372,036,854,775,808
max: 9,223,372,036,854,775,807
default value: 0L
used when a wider range than an int is needed - 16floatmainly used to save memory in large arrays of floating point numbers
never used for precise values such as currency
default value: 0.0f - 17doubleDEFAULT data type for decimal values
should never be used for precise values
default value: 0.0d - 18booleanrepresents one bit of information
true or false
default value = false; - 19charused to store any character
must use single quotes - 20immutableonce created, the value cannot be changed
- 21reference variablescreated using defined constructors of classes
used to access objects
default value: null - 22literalsource code representation of a fixed value
represented directly in the code without any computation
e.g.
char x = '\u0001';
byte = 68; - 23primitive data type ranking(highest)
double
float
long
int
short
byte
(lowest)
java will automatically convert lower ranked value to higher ranked values - 24castinggoing from a higher ranked data type to lower ranked type
double d1 = 123.7;
int x;
x = (int) d1; - 25integer divisiondiscards the remainder
occurs when both values are integers
can be solved by casting
int x = 10, y = 4;
double d1;
d1 = (double) x / y - 26non-referenctae types (primitive typese)int x = 4;
int y = x;
two COPIES of the data are made - 27What happens when a field is declared but not initialized?fields that are declared but not initialized will be set to the default value by the compiler
- 28verificationshowing that the code meets the requirement specification
- 29validationshowing that the code meets the real requirements
- 30qualitysuggests that validation falls on a scale
- 31specificationa precise and detailed statement about the properties something must have
Design specification: exact instructions for how to build something
Requirements specification: exact statements about what should be built - 32unit testingwrite code that tests the smallest possible units of the spec
must attempt to test every flow path - 33integration testingtest that units work together
- 34acceptance testing (beta testing)give product to real users to try it out
- 35flow patha unique execution sequence through a program unit
- 36clear box testing glass-box / white-box testingexamine the code to decide what test cases are needed
test based on the logic of the code - 37black-box testingtest only based on inputs, outputs (i.e. the specification) w/o looking at the code
- 38Goals of unit testing- ensure quality
- improve developers' lives (coping, confidence)
- support design flexibility and change
- allow iterative development with working with code early - 39unit testing benefits- developers can work in a predictable way of developing code
- programmers write their own unit tests
- get rapid response for testing small changes
- encourages programmers to build many HIGHLY-COHESIVE, LOOSELY-COUPLED modules to make unit testing easier - 40Your jUnit test code must:- set up what's needed for testing
- create objects, allocate resources, create relationships, etc.
- call the method to be tested
- verify that the method did what you expected
- clean up - 41coverage% of lines covered
% of flow paths covered
% of input sequences covered - 42Steps in test-first, test-driven deign- Write a "stub" (just the signature & dummy return value).
- Write many test cases.
- Implement the method until the test cases pass. - 43Benefits of TDD1. Less temptation to skip on testing, forces you to be meticulous
2. More likely to think about every part of spec in coding
3. Less likely to test only what works - 44input domaininput space, output space, and internal space
- 45inputthe set of possible arguments, input streams, and events
- 46outputthe set of possible returns, output streams, and side effects
- 47internalthe input/output spaces of the operation used inside the method
- 48software engineeringthe technological and managerial discipline concerned with systematic production and maintenance of software products that are developed and modified on time and within cost estimates
- 49software lifecycle phases1. requirements ("specification")
2. design
3. implementation ("coding")
4. integration phase
5. release
6. maintenance - 50requirements- statements of what the system should do (or what qualities it should have)
- from the customer or client point of view
- not expressed in terms of a solution
Should be:
- clear, unambiguous
- consistent, complete, feasible, testable - 51designa description of how a solution will be implemented
Information
- Description
- Flashcards on CS 2110 Test 1, created by V L on 20/09/2016.
- Created by
- V L
- Views
- 1
- Rating