Introduction to design patterns
On this page
What is a design pattern?
"Micro-patterns"
Questions
Q1
QDesign Patterns, Q1
This question is ungraded.
We introdcued the following quote in today's lesson. Fill in the blank with the best response:
"Each describes a problem which occurs
over and over again in our environment, and then describes the core of the solution to
that problem, in such a way that you can use this solution a million times over, without
ever doing it the same way twice." (Christopher Alexander)
Q2
QDesign Patterns, Q2
This question is ungraded.
A design pattern has four essential elements. Which elements allow us to develop a vocabulary for patterns in conversations with colleagues, documentation, etc.?
Q3
QDesign Patterns, Q3
This question is ungraded.
A design pattern has four essential elements. Today's lesson stated that this element is not concrete: we must adapt it to different situations. Which element was this?
Q4
QDesign Patterns, Q4
This question is ungraded.
In today's lesson, we introduced different "micro-patterns." Which pattern does the following code snippet apply? Select the best response.
std::vector<int> scores { 71, 100, 90, 93, 81 };
int best_score = scores.at(0);
for (const auto& score : scores) {
if (score > best_score)
best_score = score;
}
Q5
QDesign Patterns, Q5
This question is ungraded.
In today's lesson, we introduced different "micro-patterns." Which pattern does the following code snippet apply? Select the best response.
auto* curr = head_->next;
auto* prev = head_;
while (curr != nullptr && curr->data > prev->data) {
prev = curr;
curr = curr->next;
}