Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Practical tasks for students who learn design patterns [closed]

I need to compose some tasks (problems) for students who learn design patterns. Please suggest me some practical short-term tasks that would help students understand the theory.

I need some interesting ideas for creational design patterns. It would be great if you shared your experience: when a particular design pattern perfectly fit your design.

like image 306
Kniganapolke Avatar asked Jan 22 '10 15:01

Kniganapolke


4 Answers

I found examples in book "Head First Design Patterns" very easy to understand yet enough to understand the patterns.

like image 77
nanda Avatar answered Nov 03 '22 13:11

nanda


I recently took a class which had a design patterns aspect to it (in a half-semester course, we spent maybe 3-4 weeks going over design patterns).

Many of our practicals, and our coursework consisted of using JHotDraw to explore their use of patterns (as well as how to develop a framework). JHotDraw is a framework for structured drawing editors e.g. directed graphs, or an example we used was for drawing an orrery. There are several patterns which must be understood in order to use JHotDraw. IIRC the creational patterns used included at least Abstract Factory and the Prototype pattern.

It may take a while to identify which parts of JHotDraw are suitable for your course, but the Javadoc does make it helpful, identifying the pattern a class uses and such like.

As stated in another answer, the examples in Head First Design Patterns are also excellent, we used them in our course too (honours year undergraduate level).

like image 32
Grundlefleck Avatar answered Nov 03 '22 13:11

Grundlefleck


I suppose that you should just come up with some scenarios and ask the students which design pattern(s) they would use for each.

For example: We have a object that represents a File and has methods open and close. We want to optionally log a message whenever the application calls open or close.

Another example: We have a downstream system that responds very slowly. We want to design a component that will queue up requests for the downstream system and feed them one by one in the background.

like image 28
Willis Blackburn Avatar answered Nov 03 '22 12:11

Willis Blackburn


If you could think of a project that might use many patterns at various points that could give them something a little more meaty to learn with, while at the same time teaching patterns in turn. I'm thinking of something like a simple HTTP server, where you might apply patterns in the request handling, logging, session maintenance, all of that kind of stuff, so you could teach different ones as individual topics but come out with a relatively well structured whole and one that gives practical experience of using the various patterns you're exploring and of their interaction.

like image 25
glenatron Avatar answered Nov 03 '22 13:11

glenatron