I study computer science and I have a class called "Programming Techniques". Its purpose is to teach (us) good object oriented design principles. During the semester we have homeworks, programs that we must write to demonstrate what we've learned.

The lab assistant demands for each of these homeworks that specific design patterns should be used. For example, the current homework is an application used for processing customer orders. We are demanded to use either "Factory Method" or "Abstract Factory" design patterns for this. It gets even worse: at the end of the semester we must write a program (something more complex) that must use at least one creational pattern, at least one structural pattern and at least one behavioural pattern.

Is it normal to demand this ? I mean, forcing us to design our programs in such a way that a specific design pattern makes sense is just beyond what I consider ok. If I'm a car mechanic and have a huge tool box, then I will use a certain tool from that box if and when the situation demands it. Not more, not less. If my design of the application doesn't demand at all the use of "Abstract Factory" (for example), then why should I implement it ?

I'm not sure yet if the senior lecturer agrees with what the lab assistant is demanding, but I want to talk to him about it and I need solid arguments to do so. How should I approach this problem with him ?

PS: I'm sure there must be a better way to teach us these things. Maybe making us each week read about 3 design patterns and the next week giving us a test with small but specific programming or architectural situations/problems. The goal in that test would be to identify what design patterns would make sense and how they could be implemented. This way, he can see if we understand them.

EDIT: These homeworks are not just 100-line programs, they have quite a lot of requirements and are fairly complicated. This is the reason we have about 2 - 3 weeks of deadline for each of them.

I agree that practicing this is the best way to learn. But shouldn't smaller programs/applications be used for this ? Something just for demonstrating purposes. Not big programs with lots of requirements/classes/etc.

Sorry, but I think your teachers are right.

If you were developing software for a customer, and the customer or your boss requires you to use specific design patterns, I would definitely say that that was a big mistake. But there is a difference between class assignments and software development for a customer: both serve completely different purposes:


If you are developing for a customer, the purpose is the software you create. It should work, it should be maintainable, it should satisfy your customer's requirements.
The purpose of your assignments is not the software you create, it is the experience you gather during the whole creation process. During the assignment you will learn things about implementing  patterns, which will help you understand how the patterns work, when to use a pattern, and (hopefully) when not to use it, as well.


To use your car mechanic analogy: You are not a mechanic, you are learning how to become one. And maybe your teacher will tell you which wrench to use, in order to change the  tires. That is completely ok. And if the owner of the garage tells you to change the tires with a screwdriver, because he wants you to learn something from the failure that will certainly occur, that is ok, too.
