Feel the Pain/alx
|Feel the Pain|
|Last modification||May 17, 2017|
|Source||Köppe (2011); Köppe (2013)|
|Pattern formats||OPR Alexandrian|
Also Known As:,
Students often have (naturally) a limited experience in the domain of their study. This experience is mainly based on some school projects, but these school projects are of limited scope themselves due to time constraints and other environmental factors like the size of classes or the teaching model.
Students often apply patterns without understanding why the problem really is a problem. They are not aware of the consequences if this problem is not addressed properly.
The required functionality of a software system can be implemented in countless ways. Only a few of these ways equally respect and balance the non-functional requirements of the system too, while the others often lead to a . Many problems related to non-functional requirements emerge long after they have been caused.
Shortened Software Lifecycle. As students’ projects are often of limited scope, these non-functional requirements — even if gathered and described in the beginning of the project — are not obviously necessary and of value to students, as the phase where these requirements become important is mostly out of the scope of the project. The need for — and advantage of — the consideration of these requirements during design becomes hence not obvious to the students.
Sparse Experience. The problems which are addressed by the different design patterns are often ones that students have never experienced by themselves. The consequences of high coupling, low cohesion, low modifiability etc. are not obvious to them, so they often just implement the required functionality without thinking about possible consequences for the non-functional requirements.
Therefore: Let the students experience the problems addressed by a pattern first hand before they implement the pattern. Help them to understand what consequences it has if these problems are not addressed appropriately.
This pattern is specific for teaching design patterns to students without prior (excessive) design experience. It also can be inappropriate to let pattern users experience the problems addressed by the patterns, e.g. when teaching pedagogical patterns one should not enforce the problems addressed by pedagogical patterns. We therefore do not consider this as sufficiently high-level to be marked with one asterisk.
Experiencing a problem yourself improves the awareness of this particular problem, but also the awareness of why a problem should have been understood properly before solving it. This might require the adaptation of some existing exercises in a way that also the phases of the software lifecycle are covered so that the problems can actually be experienced. In software engineering projects most often this will be the integration or maintenance phase. So possible applications of this pattern could be the task of implementing a new requirement which has huge impact on the current design, or the integration of a new component in a software system.
Astrachan et al. used this technique as well. They based it on the idea that “good design comes from experience, and experience comes from bad design” (attributed to Fred Brooks and Henry Petroski according to Astrachan).
An important aspect is that the students should not have the experience of complete failing up to the point of loss of motivation. Struggling with the problem and having difficulties to solve it are necessary part of the solution, but should not have a negative effect on the students’ self-confidence. This requires a sensible application of this pattern: the period where the students actually “feel the pain” should be long enough to make the point, but not longer.
Immediately after feeling the pain of an unsolved problem, the students should look for the .and, when found, should see and have the which the solving of the problem gives them. Astrachan et al. describe this as the before and after model
The application of this pattern is often not necessary in commercial contexts, where trainings in design patterns are given to somewhat experienced software developers or designers. These people often have a good understanding of the problems, as they have experienced them themselves and these problems were often the reason for following the course on design patterns.
We implemented this pattern in a workshop using Class-ResponsibilitiesCollaboration (CRC) cards as introduced by Beck and Cunningham. Prior to the introduction of the pattern the students were asked to think of classes and a mechanism which automatically represents changes different values on different display types (which is actually one of the most often found examples of a possible Observer-application). They were required to use the CRC cards for the design process. After finishing their designs, they had to replay a simple change of one value including the automatic refresh of all representations. Then they had to add another representation and to discuss what they had to change in their design and how difficult this was. This way the students recognized that even a small addition of another display can require a relative large amount of changes.
This pattern can also be found in an exercise Cinn´eide and Tynan gave their students. The students had to implement an extension for two different solutions which were given to them. One of these solutions made use of design patterns while the other solution was using an ad-hoc implementation without a good design. The students struggled with the ad-hoc solution, trying to figure out the complex control flow and where to put what code in order to implement the extension. They therefore experienced the maintenance problems generated with this bad design and were able to compare this experience with the one made while extending the well-designed solution, which used design patterns. So this exercise implemented both and .
Eduardo Guerra also uses this pattern in his lecture on ”Understanding Design Patterns” (in combination withand ). He starts there to work towards a complex UI-menu structure, initially without making use of the later introduced Pattern. During this design process many problems are detected and identified, which shows the students that the straightforward approach presented by Guerra obviously leads to design problems.
In the book Head First Design Patterns. much attention is spent on the problems the design patterns are addressing. All these problems are discussed in detail and also related to the principles possibly violated by applying a simple solution to them.
This pattern is also implemented in the assignments given by Uwe Zdun in his course on software architecture at the University of Vienna.
- Pattern first published in Köppe, C. (2011). A pattern language for teaching design patterns (part 1). In Proceedings of the 16th European Conference on Pattern Languages of Programs (EuroPLoP 2011) (p. 2). New York:ACM.
- Patlet published in Köppe, C. (2011). A pattern language for teaching design patterns (part 2). In Proceedings of the 18th Conference on Pattern Languages of Programs (PLoP 2011). New York:ACM.
- Pattern also published in Köppe, C. (2013). A Pattern Language for Teaching Design Patterns. In Transactions on Pattern Languages of Programming III (pp. 24-54). Springer Berlin Heidelberg.
- Foote, B., Rohnert, H., & Harrison, N. (1999). Pattern languages of program design 4. Addison-Wesley Longman Publishing Co., Inc..
- Warren, I. (2005). Teaching patterns and software design. In Proceedings of the 7th Australasian conference on Computing education-Volume 42 (pp. 39-49). Australian Computer Society, Inc..
- Astrachan, O., Mitchener, G., Berry, G., & Cox, L. (1998). Design patterns: an essential component of CS curricula. In ACM SIGCSE Bulletin (Vol. 30, No. 1, pp. 153-160). ACM.
- Beck, K., & Cunningham, W. (1989). A laboratory for teaching object oriented thinking. In ACM Sigplan Notices (Vol. 24, No. 10, pp. 1-6). ACM.
- Gamma, E., Helm, R., Johnson, R. & Vlissides, J. (1995). Design Patterns: elements of reusable object-oriented software. Addison-Wesley: Boston, MA.ISBN 0-201-63361-2.
- Cinnéide, M. Ó., & Tynan, R. (2004). A problem-based approach to teaching design patterns. In ACM SIGCSE Bulletin (Vol. 36, No. 4, pp. 80-82). ACM.
- Freeman, E., Robson, E., Bates, B., & Sierra, K. (2004). Head first design patterns. O'Reilly Media, Inc..