During his last rant on the last day of my graduate Software Engineering class, the professor gave each of the students a pack of train-shaped sponges. What the… I thought. I laughed like crazy, trying to write down everything he said so I could tell everyone about this hilarious last day.
While it was really funny for a graduate level class, he did have a good message. Here it is, in his own words:
When I was young, I lived near a railroad. Whenever we heard a train coming, we would run to see it. We would try to get the engineer to blow the whistle.
I tried to imagine what I would have thought if I had heard the term “Software Engineer” when I was little. To me, an engineer was a person who drove a train. Therefore, I guess a Software Engineer would be a person who drives a soft train.
I have been giving these toy trains out to my students since 1987. More than being a “soft train for software engineers,” these trains remind us of some of the important software engineering principles.
The first thing you notice is that the sponges (which are shaped like train cars) are inside little gelatin capsules. This, of course, reminds us of encapsulation.
If you dissolve the capsules in warm water, the sponges will emerge. You can hook the sponges together to form a train. This illustrates the principle of well-defined coupling between components.
A train is made up of a collection of cars. This is the application of modularization. Each car has its own purpose. Different cars have different purposes. This is the principle of cohesion. Furthermore, you will find it very difficult to pull one of these cars apart, or put two of them together (except at the defined interfaces). Each car has very strong cohesion.
When you look at a real train, you can’t really see inside the boxcars or tank cars. The only way you know what’s inside is to read the label on the outside. This is the principle of information hiding.
I thought this was just great, a nice little gimmicky real-world example that drives home a ton of concepts. Maybe it’s a little low-level for graduate students, but it’s still good, and even better that it’s original. If I ever teach computer science high schoolers or undergrads one day, I will definitely use this.
You can tell a professor who really cares about what he’s teaching when they think of brilliant examples. I hope you enjoy this as much as I did. Thanks Sam!