asdasd

Ace your homework & exams now with Quizwiz!

Deep Copy

Called defensive copying because instead of making a reference you make a new object but with the same values, this way it's protected no matter what. A clone.

Idempotent

Calling it once is the same as calling it a million times.

Enum

enumeration type. Make small type safe values. No subclassing. Add's abstraction

Static array

size is set at compile time, its memory is permanetly bound, and its size is fixed.

Loop invariant

something which must be true before and after each iteration of a loop is run.

Class invariant

the loosest definition of a data structure that must always be true for the object to be legal.

binding time

the time at which a decision is made

Delegation

used in composition, when calling for the other classes, nesting a class in a class

Parameter passing

when the actual value is used in a method b/c it was called for.

Dynamic array

can be given at runtime if necessary.

UML

dashed = interface. Open Arrow=Compositon Closed =extends/implements aka dependency. If this class changes, it affects the other.

Immutable class

objects of the class cannot be changed.

open closed principle

open for extension, closed for modification

early binding time

(C++) simpler, quicker, not as flexible

****ing design patterns

Adapter, Iterator, template, Observer, Factory, Proxy

encapsulation

Also known as information hiding. Hides the implementation details in the Java class, so that the user must use the API to access the object.

behavioral subtyping

Any method that expects an object of type superclass must be able to use in its place an object of type subclass

Recursion

Base Case. Recursive Case. A recursive function calls itself in the body of the function, and works on a smaller set of data with each call of the function. Creates a new instance in the activation record with each call while an iterative function uses looping and works through the method only once.

Whitebox/Blackbox

Blackbox- does it do what it's supposed to do? Whitebox- Ensures that everything is excersized correctly.

Immutable class

Cannot be changed once instantiated. It really means that objects of that class cannot be changed, such as a string, u cant change that string now. Advantages- thread safe, simplicity. Disadvantages- bc if u want to change the object, youll have to make a copy. i.e. phonebooksTo create: Getters no setters, accessors no mutators.

Façade

Changes interface, but by denying access to certain. SQL. Wrapper. Hides a class in a class, restricts ****.

Adapter

Changes interface. 2->3 prong. Adapts it to be compatible with another program

Type Specific Code

Code written for different and specific data types. Overcome by writing generic mehods.

Iterator

Cohesive because to get data you don't know how the data is formatted etc. The iterator class will do that for you, thus dependency inversion principle. Has next() and hasNext() 'access elements of an object sequentially without exposing its underlying representation'

Shallow Copy

Create an alias, but if the original copy gets changed so does the new one, so usually not ideal.

dependency inversion principle

Depends upon abstraction, does not depend upon implementations

single responsibility principle

Each class should do one thing, and do it well

Extends vs. implements

Extends inherits the whole class. Implements is anlagous applies only to an interface. A class may extend a concrete or abstract class, but it implements an interface.

Inheritance vs Composition

Inheritance extends another class which means it implements, while composion allows classes to be made from other classes, ie a car (class) has an engine (class) and transmission (class). Composition: Class Fruit{}Class Apple{Private Fruit fruit = new Fruit():}

Selection vs Insertion sort

Insertion- picks element @ bottom of unsorted list and puts it's where specified. Slection sort picks the largest value and puts it at the beginning.

Factory

Is for creating objects. It's different from a constructor because it's more flexible. Decouple (cohesion) client from knowing implemention 2. Can return subtypes 3. Returns implementation unknown to client

Factoring

N!

abstract data type

Separates * What from How * Interface from Implementation * public from private by encapsulating implementation details. Information hiding is another term for encapsulation.

Observer

Separates User Interface (Observer from observable). (Type safe becaue something can't change a value while others are calling a value) Eliminate the main class from having to update of instances changing, decopling. Observable iterates throught obslist and calls update

Map

Stores a pair of values, a key and a value. Represented by <key,value>, sorted by key

Type Parameter

Used in generics to specify the data type used in the generic class.

Template

Used to set up the outline of an algoriyhem, but leaving the specific details in another class. Like having TemplateMethod, which doesn't change, and then having Sort(), which we can change later if we need to. Late binding

3 Level Architecture

User Interface, Model, Data. Level below doesn't know about level above

Pre/Post Condition

What must be true before/after

Polymorphism

a single variable used with several objects of related classes (at different times)

Interface

an abstraction, with no implementations, that describes what a client can do with an object of a given type

late binding time(Java)

flexible, slower, harder to debug, more complex (b/c it doesn't have to figure out what variables its using until its running the program)

Formal vs actual parameter

formal is a plceholder, actual is the actual value.


Related study sets

Oligopoly and Monopolistic Competition 14.1,14.2,14.3,14.5

View Set

Exam 2 Evolve Questions Some on Kap

View Set

EMT Ch 33 Obstetrics and Neonatal Care

View Set

Chapter 38: Agents to Control Blood Glucose Levels (Combined)

View Set

H&W - EXAM 1 (compilation of Weeks 1-3)

View Set