31
votes
Why do we practice printing patterns while coding?
Why do we practice printing patterns while coding?
Because bugs love to hide in loops.
Talk students into using loops to print these patterns and they will create bugs. Tracking down and squishing ...
9
votes
Why do we practice printing patterns while coding?
Are these kinds of pattern questions just for fun and to get better at
using loops [...] ?
Absolutely yes. Practical applications of such patterns nearly don't exist. It's good training for control ...
7
votes
Accepted
Using questions from a code-competition website in homework and exams
Whether this is a good plan or not depends on some things, most especially the nature of your students.
However, it seems a bit too unstructured. If you have a general mix of student ability it ...
7
votes
Exercise or example to reinforce idea of functions?
I saw the light at the end of the fiber optic cable as soon as you said that these are students of electronics. There is nothing more modular and encapsulated than that! Software is simply electronics ...
6
votes
Accepted
Exercise or example to reinforce idea of functions?
Instead of an example, use a metaphor. Get yourself a frisbee - ultimate disk and two packs of sticky notes. You are the caller of a function. Another person is the function itself. Write a value on ...
6
votes
Reference request for resource with difficult programming exercises
If he wants to have a blast biting into some very fun and challenging problems, Project Euler is fantastic, and entirely language neutral.
He may find that certain problems are out of his grasp until ...
6
votes
Reference request for resource with difficult programming exercises
Although the question is asking for a book, looking a "Project Euler" mentioned in another answer, I would like to suggest Codewars might be what you are looking for. On codewars you choose ...
6
votes
Why do we practice printing patterns while coding?
I was skeptical about this as well. Those pictures feel like a cheesy attempt to make programming cool, from an era when that meant ASCII graphics; or the sort of cutsie junk we need to keep the ...
5
votes
Accepted
Should I Provide Answers To Exercises?
I post solutions after the due date of an assignment. And usually, I'll go over them in class as well.
Two birds...
Students get to see at least one working solution, although I try to come up with ...
5
votes
Lambda expressions exercises and practice
One of the interesting things added to java in v8 is functional interfaces. Previously java only matched things up and verified correctness by type (type names). With functional interfaces, java now ...
5
votes
Accepted
Is it worth to learn to make a MD5-hash cracker?
I have used a similar idea - writing an SHA-1 hash cracker - as a mini-project for students learning Java. These students had previously learned to program in other languages, so they had experience ...
5
votes
Reference request for resource with difficult programming exercises
The International Olympiad in Informatics is an international competition for gifted young amateur programmers. The tasks from past editions are available online, including detailed problem ...
4
votes
A meaningful exercise that requires using a destructor
Create an object that creates a new file and writes in to it over several method invocations (not just one). Assure that the object has been deleted before continuing (Make the object go out of scope ...
4
votes
Should I Provide Answers To Exercises?
To give or not to give, that is the question
There are actually several possibilities that reflect how you want
the provided solution to be used. For context, I am an instructor at
Colorado State ...
4
votes
Should I Provide Answers To Exercises?
Don't provide code dumps. Provide guides that outline the process of solving the problem.
Create a function that squares a number passed to it
Don't just give out a fully-coded solution. The ...
3
votes
Should I Provide Answers To Exercises?
Reading an answer is not the same thing as solving a problem. I think different areas of the brain are engaged. Solving the problem yourself is a stronger reinforcement of the ideas certainly.
...
3
votes
A meaningful exercise that requires using a destructor
There are 2 good examples of patterns where the destuctor is a key.
This way you can teach a couple of useful patterns on the way.
RAII - Resource Acquisition Is Initiation
Rule of 3/5/0
It's ...
3
votes
Accepted
Genetic Algorithm enrichment lesson
Classification problems are reasonable candidates. For instance, I wrote a GA that looked at the mushroom dataset taken from the UCI Machine Learning Repository with the goal of classifying an ...
3
votes
Best Practices for introductory teaching
I think you have left out two essential elements here. Your first two points leave the students passive consumers. The last is about testing. But there is no guarantee of any learning in between.
In ...
3
votes
Basic OOP practice exercises for inheritance and polymorphism
You could have a hierarchy based on an abstract class or interface Car, with implementations/subclasses for ElectricCar, ...
3
votes
Exercise or example to reinforce idea of functions?
Can I craft an exercise ... that would give a dramatically wrong output, e.g. cause the screen to "blow" up if the function print-ed instead of return-ed...
[my emphasis]
Early in my Python ...
3
votes
Accepted
Looking for good Master Theorem examples
A famous example is Strassen's matrix multiplication algorithm, whose running time satisfies the recurrence $T(n) = 7T(n/2) + O(n^2)$. A similar example is Karatsuba's algorithm for fast integer ...
3
votes
Accepted
Reference request for resource with difficult programming exercises
Disclaimer 1: I haven't seen the book, and I have no idea what exercises it offers.
Disclaimer 2: I haven't seen your brother's code.
The goal of an easy exercise is to learn how to write the perfect ...
3
votes
Accepted
What are some good conditional branching excercise scenarios?
There are literally zillions of scenarios. Even before the loops are introduced. For example,
Min, max, and clipping a value into an interval.
Figure out whether a year is a leap one.
Determine if a ...
2
votes
Basic OOP practice exercises for inheritance and polymorphism
I have used an example of a machine which has a serial number and a state. It can be turned on and off, it can be told to give out its serial number. A ...
2
votes
Accepted
Basic OOP practice exercises for inheritance and polymorphism
One example that isn't necessarily exciting but would allow for a lot of class design is a Shape interface. From there let's say you have ...
2
votes
Excel macro recorder exercises
One extremely handy macro is creating names ranges.
Start recording
Select the range you want to name
Press the "create named range" in the "formulas" tab
give name
stop recording.
Voila. This has ...
2
votes
Excel macro recorder exercises
I'll start by adding the exercises I'm currently using, but please don't let this stop you from posting more!
Create a macro that inserts a header row. (Story: "Every day I download a csv file. ...
2
votes
Lambda expressions exercises and practice
I think the most critical thing about lambda functions is that they enable the convenient use of map and filter functions on ...
2
votes
Accepted
Lambda expressions exercises and practice
One idea might be to borrow SQL-related exercises -- find problems asking the reader to come up with some sort of SQL query to find information, and rephrase the problem and ask students to come up ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
exercises × 23lesson-ideas × 3
curriculum-design × 3
java × 3
resource-request × 2
high-school × 2
best-practice × 2
algorithms × 2
object-oriented-paradigm × 2
functional-programming × 2
homework × 2
self-learning × 1
student-motivation × 1
programming × 1
undergraduate × 1
teaching-analogy × 1
introductory-lesson × 1
textbook × 1
classroom-management × 1
labs × 1
adult-education × 1
c++ × 1
exams × 1
resource-information × 1
html × 1