TEST 1 Flashcards

(182 cards)

1
Q

What are the parts of software development?

A

Requirements, Design, Implementation, Testing and Debugging, Maintenance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What two things shape what design needs to meet

A

functional requirements and software quality metrics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are design choices

A

ALGORITHM- what sequence operations is preformed DATA STRUCTURE- how information is represented COMPONENT DESIGN - how software is designed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Application Software

A

Software designed to solve specific tasks for users, typically written in a high level language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

system software

A

software that interfaces between the application software and hardware (or lower layers of system software) ie runtime, operating, virtualization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

hardware

A

physical resources such as memory (RAM), processing power (CPU), storage (disk), and I/O devices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the key components of programming languages

A

grammar, semantics, libraries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

interpreter

A

a program that executes programs written in a language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

complier

A

program that translates program language into another language (typically a binary)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are the primary programming paradigms

A

Imperative, object- oriented, functional, declarative

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

imperative

A

series of statements that mutate programs state, these statements detail how to preform each operation – outputs can depend on combo of inputs and external states, side effects are allowed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

functional

A

immutability, all functions are pure (no side effects, output soley depends on inputs)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

cons of imperative

A

Behavior can be harder to understand
● Debugging can be more challenging
● Order is more crucial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pros of imperative:

A

Efficient
● Familiar
● Parallels how computers actually work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Pros of functional

A

Proofs and analysis are easier
● Can be easier to test and debug
● Order of execution is less important
(easier to parallelize)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Cons of functional

A

Can sometimes be less efficient
Can’t use familiar constructs such as
loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

declarative

A

express logic of what without detailing its control flow how

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Pros of more declarative:

A

Abstracts away the low-level details
● Equivalent code is typically shorter
● Self-documenting (goal is explicit)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Cons of more declarative:

A

Can sometimes be less efficient
● Gives the programmer less control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Is OOP imperative or functional, in terms of mutation

A

Can be either! Imperative is more common

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Is OOP imperative or declarative, in terms of abstraction

A

Some argue declarative: once objects are defined, you can use
them abstractly without knowing how they work under the hood
I disagree; someone still has to define how they operate before
using them!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

pros of OOP

A

High level of abstraction & encapsulation
● High level of modularity
● High level of extensibility & reusability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Static type system

A

type-checking happens at compile-time
○ Variables have types; type system checks that assigned values
match declared variable types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Dynamic type system

A

type-checking happens at runtime
○ Values have types; variable types are inferred from their values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Pros of static
Guarantees that type errors will not occur at runtime; effectively free, automatic testing by the compiler
26
Cons of static
Code is a bit bulkier can feel slow and onerous to write code that will pass static type checks
27
Cons of dynamic
May encounter runtime type errors (potentially after code has been running for a long time)
28
Pros of dynamic
● Code is sleeker ● Writing code is faster
29
strong typed
Variables have a shallow fixed type Variables have a deep fixed type
30
weak typed
No notion of types (e.g. assembly code, machine code) Values have a fixed type stronger typing leads to greater type safety(the extent to which type errors are disallowed)
31
type safe
can be used to describe languages or programs If a language is type safe, programs written in it are type safe
32
examples of type safe languages
Java is a type-safe language while JavaScript and C++ is not a type-safe language
33
evolution of programming languages
machine-independent, higher-level abstractions (functions), support for OOP, programming languages created , built in libraries
34
Java Compilation & Execution
source code, complier, bytecode, class loader, execution engine, result
35
type system of java
strong and statically typed- means you must declare things explicitly ot implicitly
36
primitive types
numeric types, boolean, char
37
strings
object type but behavior like primitive- cant be mutated and can be created without constructor- surrounded by double quotes
38
literal
a symbolic representation of a value ie x = 5 assignment of literal 5 to variable x
39
variable
a name associated with memory location ie int x a declaration that variable x is of type int
40
Declaration
a statement associating a variable with a type
41
Assignment or definition
a statement that places a value in the memory location associated with a variable
42
Rules of Assignment
The defined value of a variable must match the declared type The defined value of a variable must match the declared type
43
Primitive Type numeric definitions
long literals can optionally include a trailing “L” float literals must include a trailing “F”; without it java assumes its a double double literals can optionally include a trailing “D”
44
Primitive Type boolean definitions
boolean literals must be lowercase
45
Primitive type char definitions
char literals must be designated with single quotes; String literals must be designated with double quotes
46
initial values
For numeric types: 0 (or 0.0, or 0.0F) For booleans: false For chars: the null character ('\u0000') For Strings, arrays, and objects: null
47
final keyword
final keyword tells the compiler that a variable will never be re-defined ie final int x = 5
48
operator
a symbol that is built into a programming language and has a specific, well-defined behavior, takes arguments (amount of arguments it takes it fixed)
49
Arithmetic operators:
take numeric expressions yield 1 numeric values addition (can preform a cantaonation between string and int) plus operaters automatically takes care of any conversions subtraction multiplication divison (overloaded 3/2 = 1 but 3/2.0 = 1.5) modulus
50
logical
yeild a boolean value
51
relational operators
used for comparison used for any types
52
ternary
? : --> if is true, yield ; otherwise, yield String a = (b > c) ? “b is greater” : “c is greater or eq”
53
augmented assignment operations
with exceptions of += a and b need to be numeric a = b a += b a = a + b a -= b a = a - b a *= b a = a * b a /= b a = a / b a %= b a = a % b
54
Control flow
the sequence of statements executed in a program
55
“straight-line”
sequences of statements excuted one after the next
56
“branches” to the control flow
conditionals and loops, multiple paths, ○ Which path is taken depends on the current program state
57
Blocks
group together a series of statements to be executed In Java, blocks are generally denoted using curly braces { }
58
Scope
the set of blocks in which a variable is valid/usable-- , a variable’s scope is the block in which it was declared + any blocks nested inside that block
59
two rules of scope
Can’t reference a variable outside of its scope Can’t re-declare a variable within its scope
60
Conditionals
Control flow depends on the value of a boolean expression if () { // do something ... } else if () { // do something else ... } else { // do something different entirely } Exactly one if block per conditional, followed by zero or more else if blocks only first if block whos condition is true gets executed even if others are true At most one else block per conditional - only executed if everything else was false
61
Switch Statements
Control flow depends on the value of a single variable switch () { case : // do thing 1 break; case : // do thing 2 break; default: // do thing 3 } these values must be constant, cannot be arrtibuary involving variables
62
default case
executes everything from the match case to the default statement if there is no break statement or if it does not meet any of the cases
63
pure function in java
“procedure” or “subroutine” = a sequence of statements packaged together into a callable unit
64
parameters
variables that are defined in the function header and can be referenced within the function
65
function header
public void addTwoInts(int num1, int num2) structure is privacy, return type (void if nothing is returned), name of function in camel case, the parameter list a list of pairs
66
arguments
the specific values that get “bound” (assigned) to the parameters (variables) when the function is called
67
local variables
Their scope is the function in which they’re declared
68
If you want your compiled program to be a standalone executable, you must define a function with this exact header to serve as the “entry point
public class Main { public static void main (String[] args) { System.out.println(“hello world!”); } }
69
What are array limitation?
An array is declared with a type; all elements must be of that type An array is defined with a size and cannot exceed that size
70
Why cant array sizes change?
ordered sequence of fixed-size storage locations ○ Each slot typically fits one byte (8 bits) ○ At runtime, all of the data that your program creates is stored in memory If we fix an array’s size, we can place it in a contiguous chunk of memory, making it easy to find the ith element
71
how to declare an array in java?
int[] myArray; int myArray[];
72
primitive types
values associated with variables stored directly in the chunk of memory associated with variable name (no arrows or pointers)
73
what does new keyword do
demonstrates a constructor for arrays and objects because java doesn't allocate memory till after construction
74
null
java reverses a special value, one that isn't a valid memory address for data to represent null X doesnt point to null it is null
75
accessing arrays
don't reference each individual object elements directly embed within an array
76
how to populate arrays
Use curly braces { } to explicitly define the elements; this must be done at the same time as construction int[] myArray = new int[]{7, 5, 8}; Use square brackets [ ] to set individual values in the array; int[] myArray = new int[3]; myArray[2] = 8; myArray[1] = 5; myArray[0] = 7;
77
how to print contents of string
int[] myArray = new int[]{1, 2, 3}; System.out.println(Arrays.toString(myArray));
78
Fields
characteristics of an object (“has” relationship) object has class variables, scope is entire class ie Student object fields: college(string), gpa (int), hobbies (array
79
Methods
actions that an object can perform (“can” relationship) can be invoked on objects of those class types ie Student object methods: eat(), sleep(), test()
80
A class
a template for a specific type of object
81
how to define a class
public class { // field declarations ... // method declarations }
82
this
Method calls & field accesses within the class should be prefaced by this
83
public
accessible outside of the class in which it was defined
84
protected
only accessible in the class + any sub-classes
85
private
only accessible in the class in which it was defined
86
package-protected
only accessible in the package in which the class is defined
87
Constructor
a special method used to create new objects Defined as a method with the same name as the class no return type; returns an instance of the Bunny class constructors often set up initial values for the fields public Bunny(String color, float weight) { this.color = color; this.weight = weight; }
88
objects constructed
use new keyword = new (); ie Bunny fluffy = new Bunny(“black”, 7.1F); instance of the Bunny class
89
Define Method
public void eatCarrots(int numCarrots) { this.numCarrotsEatten += numCarrots; }
90
primative types
A variable of primitive type directly stores its value
91
reference type
Objects are reference types, which means that a variable of “object type” actually contains a memory address
92
within a class method how do you refer to object operated on
you refer to object being operated on as this When you invoke a method on an object, within the context of that method call this becomes another reference to that object
93
why do we use static
every function must be defined inside of a class static fields & methods can be accessed without an instance, e.g. Math.E, Math.PI, Math.pow(double a, double b)
94
when can static fields be accessed
can be accessed without an instance static methods cannot access non-static fields & methods static fields & methods can be accessed by both static & non-static methods static fields' values are shared by all instances of the class static methods are invoked using . rather than .
95
“wrapper”
this allows primitives to be treated as objects These typically have the exact same names, but capitalized ○ e.g. long → Long, float → Float, ○ Two exceptions: int → Integer, char → Character allow creators of java to define key methods for primitive types which otherwise wouldn't be possible since primitive types cant have methods
96
Value of
while you can construct a new Integer in the “normal” way (new Integer(5)), the recommended approach is to use the static valueOf() method, like so: Integer x = Integer.valueOf(5); public class Integer { private int value; public static Integer valueOf(int value) { // Create a new Integer object wrapped // around the given int value }
97
implicit type conversions
happen between primitive types and their corresponding wrapper classes
98
Autoboxing & unboxing
automatic conversion from primitive types to corresponding wrapper classes and vice versa int a = 5; Integer b = a; Although a is technically the wrong type (int vs. Integer), the compiler autoboxes a’s value
99
explicit type conversations
Casting = a “true” conversion for primitive types; a reassurance to the compiler for object types double a = 5.0; int b = (int) a;
100
type conversions
Java will automatically perform a widening cast You must explicitly cast to convert to a “narrower” type
101
casting between real numbers to integer types
java rounds down when casting real number type to integer type
102
object type casting
wont perform conversion bc it doesnt know how Object o = ...; Bunny b = (Bunny) o; not safe only checked at run time
103
Conversion Functions
functions that are designed to convert between types ○ Generally the preferred approach; checked at compile-time ○ You can define conversion functions for your classes if need be ○ The wrapper classes provide some conversion functions  String to numeric: Integer.parseInt(“5”), Double.parseDouble(“5.0”) Numeric to numeric: Number.intValue(5.0), Number.doubleValue(5), etc
104
continue
skip the remainder of the current iteration of the (innermost) loop and proceeds to the next iteration
105
for loops
for (; ; ) { // do something } for (int i = 0; i < 10; i++) { System.out.println(i); } Typically all three statements (, , ) are included, but they’re actually all optional but if you skip a statement a semi colon must take its place for (; i < 10; i++) good to use when number of iterations is known or iterating with indices
106
for each loop
for ( : ) { // do something } declaration of a variable that will be used to refer to each successive element in int[] numbers = new int[]{0, 1, 2} for (int num : numbers) { System.out.println(num); good when iterating over an iterable and only the values of elements are desired
107
while loop
while ( int i = 0; while (i < 10) { System.out.println(i); i++; } good when number of iterations is unknown want to iterate while/until a condition is true
108
when is a while loop better
event driven programming
109
Do-While Loops
do { // something } while (); first iteration happens regardless of wheter or not that condition is true Sometimes needs to check a variable that you want to define in the body; a while loop might require duplicate code String line = reader.readline(); while (line != null) { line = reader.readline(); } String line; do { line = reader.readline(); } while (line != null); goof when want first iterations to occur regardless of condition
110
time efficiency
performance = how quick software runs = algo high, data , str low
111
space efficiency
memory uti/complexity = how much space = data strc
112
scalability
how software responds to increased work (impacted by all)
113
extensibility
how easy it is to add a functionality = components
114
reusability
software used for diff purposes = component
115
modularity
how distinct software components are separated increases both above
116
algorithm design
what sequence of operation is performed
117
data structure
how information is represented
118
component design
how software is structured
119
out sub-directories
files that the compiler generates (.class files)
120
namespace
All classes in the same package live in the same namespace ○ Classes defined in the same namespace can refer to each other without requiring imports
121
imports
import . = import the single specified class ○ import .* = import the entire package (all classes defined within it) ○ import .. = import the single specified static method import main.rice.subpackage1.*; import main.rice.subpackage1.ClassA;
122
Testing
the process of executing your software with sample inputs in order to discover bugs
123
Debugging
the process of scrutinizing your software (and its behavior) in order to fix bugs found during testing
124
Testing serves two purposes
1. Discover bugs: are there situations in which the software does not behave as expected? 2. Clarify the specification: are there situations in which we’re not actually sure what we expect the software to do?
125
test case
(-2, 8) → -16, you should include inputs and expected outputs! A good test suite should include tests that cover: ○ Typical cases ○ Edge cases or boundary cases = inputs that are on the edge of where the program’s control flow or behavior changes ○ (sometimes) Invalid inputs ○ (sometimes) Checks for unexpected side effects
126
White-box testing
implementation is known
127
Black-box testing
implementation is unknown
128
Pros of white-box
● Can achieve “coverage” of every code path
129
Cons of white-box
May miss classes of inputs that the implementation does not account for
130
Cons of black-box
May miss code paths if implementation has unanticipated special cases
131
Pros of black-box
Forces you to systematically brainstorm “classes” of like inputs
132
test junit
@Test void testMiniumNegative () { int [] input = new int [] {3,4,5,2,1} int expcted = 1; int actual = SampleClass.minimum(input); assertEquals(expected,actual); } }
133
Code coverage
lines of code exercised by test suite / lines of code in the program
134
Pros of OOP
High level of abstraction & encapsulation High level of modularity High level of extensibility & reusability
135
Cons of OOP
Not always a good fit Can add a slight time overhead
136
Principles of OOP (Abstraction via Encapsulation + Privacy)
never make fields public ○ Methods should only be public when necessary
137
Principles of OOP (Single Responsibility + Delegation)
each class should have a purposes that is clear, bounded, and fully contained within that class Break the problem you’re solving into logical sub-problems ○ Encapsulate the logic for each sub-problem into its own class ○ Have the main class delegate tasks to the other classes
138
Principles of OOP (Loose coupling + Decoupling)
Goal: keep the dependencies between classes low ● In practice: ○ Within your program, aim for loose coupling: classes interact through interfaces (collections of public methods) that make minimal assumptions about the underlying implementation ○ When interacting with other programs, aim for decoupling: use common protocols & formats such as HTTP, JSON, URL
139
loose coupling
when classes interact with each other through interfaces within your own program
140
decoupling
interacting with other programs using common protocols and formats such as HTTP, JSON, and URL
141
Principles of OOP Avoid Duplication
● Goal: don’t duplicate logic or functionality In practice: ○ Use composition to define an object of one class as being a composite of other objects ○ Use inheritance to define one class as being a more specific version of another class
142
Inheritance
declaring that one class “inherits” features (fields) and/or functionalities (methods) from another class
143
class hierarchy
A class can only directly extend one other class ○ However, there can be arbitrarily many “levels” in the hierarchy A subclass can only have one direct superclass ○ A superclass can have multiple direct subclasses; this is called hierarchical inheritance
144
What is inherited
protected and public fields and methods ○ Package-protected fields and methods, if the subclass is defined in the same package as the superclass What is not inherited? ○ private fields and methods ○ Constructors*
145
shadow
Define a new field with the same name but a different type (does not have to be a subclass of the original) Access the new version with this. ○ Access the original version with super.
146
override
Define a new implementation, optionally with a more specific return type (must be a subclass of the original type) Access the new version with this. ○ Access the original version with super.
147
concrete class
Fields: can be declared and defined ○ Methods: must not only be declared, but implemented ○ Constructors: can define a constructor and be instantiated Concrete classes can inherit from other concrete classes, but will often instead inherit from an abstract class
148
Abstract Classes
○ Fields: can be declared and defined ○ Methods: can be declared and implemented or just declared ○ Constructors: can define a constructor; cannot be instantiated
149
declare abstract
an abstract method cannot be private abstract keyword can be used on classes & methods, like so: ○ public abstract { ... } ○ public abstract (); end with semi color bc no definition
150
When should the superclass be abstract?
Pretty much any time that you don’t want to instantiate it! ○ It’s bad form to implement a method in the superclass if that implementation won’t be shared by 2+ (ideally most) subclasses when the super class will never be used on its own ie a farm represented using Aanimal would care about the specific animals If a method’s implementation will vary, you can leave it abstract ○ But if a method’s implementation will be shared by most/all subclasses, you can still implement it in the abstract class!
151
abstract class style guide
the COMP 215 style guide requires that you begin the name of an abstract class with an A for improved clarity
152
Polymorphism
the ability for one method to take on different forms
153
covariance
the ability to use a more specific type than declared
154
difference between abstract and interfaces
Fields: non-static fields cannot be declared or defined ○ Constructors: cannot define a constructor or be instantiated
155
methods in interfaces classes
● All methods must be public ● public and abstract designators are optional (assumed if not present); methods can be declared like so: (); no non-static fields or constructors concrete classes that implement an interface must define all unimplemented methods
156
class using an interface methods
public class Bunny implements ICanEat { (implements not extends)
157
When should you use an abstract vs. an interface class?
You want to define fields (and/or implement methods that need to access fields) You want to override any methods of the Object class
158
why cant you use interfaces if u want to override any methods of the Object class
For any method, the version that’s inherited from the superclass hierarchy (including from Object itself) will always take precedence
159
Interface Inheritance
An interface can also extend another interface ○ In this case, we use the keyword extends rather than implements ● An interface cannot extend a class!
160
do two equivalent objects have the same hashcode?
they must have the same hash code
161
do two inequivalent objects have same hashcode
likey have different ones but noy guaranteed
162
object class
automatically top class hierachy-- all methods defined in object class can be overriden or invoked on all objects
163
checking equality
The == operator: ● For primitive types, compares by value ● For arrays and objects, compares by reference → will evaluate to false on two distinct objects with identical values The equals(Object o) method: public boolean equals(Object o) Compares by value → will evaluate to true on two distinct objects with equivalent values (if defined properly!)
164
how to check types
○ Usage: instanceof Boolean isBunny = fluffy instanceof Bunny;
165
Pattern matching:
equivalent to a type check + a cast, but without an explicit cast used ti check the type of an object and assign it to a new variable of that type if its type matches
166
Hashing
Hashing is a technique used to store data that relies on computing an integer “hash code” for each piece of data
167
hash collisions
two objects that arent equal have the same hash code
168
toString()
combines the name of the class with the hash code of the instance, e.g.: “main.rice.Bunny@a9cd3b1” you’ll typically want to override toString() More informative: include the value of one or more key fields ● You can delegate to a field’s toString() ● You can combine multiple strings using concatenation (+) or Java’s built-in StringBuilder class
169
string builder
the StringBuilder class defines two constructors: ● a zero arg constructor representing the empty string ● a constructor that takes the first segment of the String being built
170
Every user-defined class must either
Define one or more constructors, or Inherit a zero-argument (“default”) constructor from its superclass hierarchy Java will only search the superclass hierarchy for a default constructor as long as it has not yet found a constructor with > 1 arguments
171
Every constructor must call its superclass’ constructor either
Explicitly: super(); in the first line of the constructor Implicitly: if no call to super() is found, the compiler tries to automatically insert it (with zero arguments)
172
When a class Sub does not explicitly extend another class
○ Sub’s direct superclass is Object ○ Object defines a zero-argument constructor ○ Therefore Sub doesn’t need to define any constructors ○ If Sub does define constructors, they do not need to call super() explicitly
173
When a class Sub does explicitly extend another class Supr:
1. If Supr defines a zero-argument constructor: ○ Sub does not need to define any constructors ○ If it does, these constructor(s) do not need to call super() explicitly (compiler will insert appropriate call) 2. If Supr does not define any constructors: ○ Assuming Supr compiles… same as case 1! 3. If Supr defines one or more constructors, but they all take one or more arguments: ○ Sub must define at least one constructor ○ These constructor(s) can have any number of arguments ○ Must explicitly call super() with appropriate arguments in the first line of the constructor
174
constructor takeaways
even if you define a constructor in the subclass, the superclass(es)’ default constructor(s) will get called if the superclass has a default constructor, the subclass doesn’t need a constructor if at any point in the hierarchy a class X has no constructor, subclasses of X will find X’s parent class’ default constructor if it exists : if a class X has a constructor with parameters but no default constructor, its child classes cannot call super() without args (even if there’s a default constructor higher up) you can explicitly call the superclass’ non-default constructor
175
obj instance class Other
checks if obj is instance of Class, if it is creates a new object (other) that is of class Class returns a boolean
176
what is privacy of abstract methods
public
177
What are the two rules of assignment in Java?
values cannot be defined before variable type is declared value of variable must be same type its declared as
178
What privacy level should be used for fields? What privacy level should be used for methods?
For fields they should be protected or private and for methods it should also be protected or private.
179
What is JVM, what are its two key components
Write once run anywhere, JVM defines platform-independent behavior. It is basically a run time system that includes an interceptor. JVM takes the burden of resource management off the programmer's shoulders. Serves as an extra layer of system software running beneath java programs. The 2 key components are a class loader which is responsible for loading classes and making them available for execution. The second is the execution engine which is key for executing and communicating with the operations system in order to manage resources.
180
What is JIT compilation? Give an example of how JIT compilation could be used to optimize program performance.
During execution the compiler executes hot code (code run frequently) and compiles it; the idea is that it incurs a one-time overhead but will speed up all subsequent executions of the compiled piece of code which makes the trade off worthwhile for code that is run frequently.
181
If you want your compiled program to be a stand alone executable ,you must define a function with what signature?
Public static void main (String[] args);
182
define the 2 primary patterns of reusability in OO design
a. Composition: where a defined object of one class is a composite of other objects b. Inheritance : where one class is defined as a more specific version of a different class