Breaking a complex problem or system into a collection of smaller parts
When performed correctly, the smaller parts are easier to:
Breaking a complex algorithm into a collection of smaller algorithms
Breaking a function down into a collection of smaller functions
Hide the internal details of a part, algorithm, or function, and only expose the minimal interface
Direction | Example | Type |
---|---|---|
IN | void f(int data); |
value |
void f(const Data& data); |
const reference | |
void f(const Data* data); |
const pointer | |
OUT | void f(int& data); |
reference |
void f(Data& data); |
reference | |
void f(Data* data); |
pointer | |
void f(Data** data); |
pointer to pointer | |
int f(); |
return | |
Data f(); |
return | |
const Data& f(); |
return | |
IN/OUT | void f(int& data); |
reference |
void f(Data& data); |
reference | |
void f(Data* data); |
pointer | |
void f(Data** data); |
pointer to pointer |
Type | Example | Direction |
---|---|---|
value | void f(int data); |
IN |
const reference | void f(const Data& data); |
IN |
reference | void f(int& data); |
OUT |
void f(Data& data); |
OUT | |
void f(int& data); |
IN/OUT | |
void f(Data& data); |
IN/OUT | |
const pointer | void f(const Data* data); |
IN |
pointer | void f(Data* data); |
OUT |
void f(Data* data); |
IN/OUT | |
pointer to pointer | void f(Data** data); |
OUT |
void f(Data** data); |
IN/OUT | |
return | int f(); |
OUT |
return | Data f(); |
OUT |
return | const Data& f(); |
OUT |