Teaching Pattern-Based Development Andreas Seitz Bernd Bruegge Technical University of Munich (TUM) Technical University of Munich (TUM) Department of Informatics Department of Informatics Munich, Germany Munich, Germany seitz@in.tum.de bruegge@in.tum.de Abstract—The use of patterns in software engineering is an categories of cognitive processes ordered by complexity from important and widespread concept. However, teaching patterns lowest to highest: knowledge, comprehension, application, to students is challenging because it requires practical knowledge. analysis, synthesis and evaluation. The goal of teaching PBD To evaluate the usefulness of patterns, students need to remember, and understand them as well as apply and analyze them. is that students are able to understand and remember the Pattern-based development (PBD) is a model-based development learned concepts. In our courses, we try to teach patterns as approach that focuses on the reuse and extensive use of patterns interactively as possible. Our goal is to encourage students to throughout the software lifecycle. In this study, we describe achieve cognitive processes at higher levels of the pyramid the foundation for teaching PBD to large classes using an and to teach students to analyze, synthesize, and evaluate the inductive and formative approach. We encourage students to apply patterns in any stage of the software lifecycle. We apply imparted knowledge. Using this technique for teaching PBD agile methodologies, particularly Scrum, to structure lectures we can attain all of Bloom’s categories of cognitive processes and give students the opportunity to apply patterns in each and allow students to appreciate the beauty of PBD. We aim to iteration. An increment (in our case a simple game) is reviewed ensure that each element (class, component, or source code) and assessed by the instructors after each iteration. In a case of a system is covered by a pattern. A coverage or pattern study, we demonstrate the use of this approach to teach PBD in two university courses with 500 and 1400 students. From our traceability of 100% is desirable, yet difficult to achieve. experience, we conclude that teaching PBD in large courses works The remainder of this paper is structured as follows. Sec- well and discuss the best practices for other instructors. tion II explains the foundations on which we have based the proposed approach for teaching PBD. Teaching PBD is I. I NTRODUCTION described in Section III. In Section IV, an application of The application and use of patterns in software engineering this concept in two large university courses is presented. In are essential. However, teaching these concepts is challenging. Section V, we discuss our experiences and share our best Patterns serve as a reusable solution for recurring problems; practices with other instructors interested in teaching PBD. students should be able to internalize this solution and recall In conclusion, Section VI summarizes the paper and offers an an applicable pattern by name. Software engineering requires outlook into our future work. collaboration and practical application of knowledge [1], [2]. This is particularly true for applying patterns in software II. F OUNDATIONS engineering. The following foundations serve as a basis for the develop- While the theoretical delivery of the structure and composi- ment of the proposed approach for teaching PBD. tion of patterns is easy, the challenge lies in practically impart- ing the knowledge. Students should be able to effectively apply A. Active, Interactive & Chaordic Learning patterns in their university projects or later in their professional Interactive learning involves the combination of lectures careers. We aim to impart theoretical and practical knowledge and exercises into interactive classes with multiple iterations about patterns while also trying to establish patterns as a of theory, examples, exercises, solutions and reflection [4]. language for the students. The approach we are pursuing It is based on the concepts of active, computer-based and must also be applicable to an increasing number of students. experiential learning and focuses on providing immediate The number of students in our department has risen by 67% feedback to improve the learning experience of a large group between 2013 and 2016. Since teaching in private lessons or of students. In this approach, educators teach and exercise small groups is not feasible, a method for teaching pattern- small chunks of knowledge in short cycles and students receive based development (PBD) in large classes is needed. immediate feedback regarding the exercises so that they may By developing a new teaching methodology for PBD, we reflect and gradually increase their knowledge. This approach have introduced a foundation that includes the delivery of requires the active participation of students and the use of theoretical knowledge about patterns and the skill of practi- computers (laptops, tablets, or smartphones) in the classroom. cally applying them. We apply Bloom’s framework to classify Chaordic learning is an educational approach that combines the expectations of what students should learn as the result theoretical and experimental learning and includes aspects of an instruction session [3]. Bloom classified six major of both order and chaos (structured courses with detailed ISEE 2018: 1st Workshop on Innovative Software Engineering Education @ SE18, Ulm, Germany 20 instructions represent order while experimental learning and Course educational innovation represent chaos) [5], [6]. Lecture 1 Lecture 2 Lecture 3 Lecture 4 PBD Lecture Lecture n Interactive and chaordic learning serve as the foundations on which teaching PBD is based. Pattern 1 Pattern 2 Pattern 3 Pattern 4 Pattern n B. Pattern-Oriented Analysis and Design & Pattern-Based Analysis System Design Object Design Testing Build & Release Engineering Yacoub said, “design patterns are immensely powerful, but Fig. 2. Structure of a course in which PBD is applied: In lecture 1 through n, to build large-scale robust systems, you need more.” [7] Ya- patterns are taught and these patterns are then applied in a PBD lecture that involves several iterations of applying individual patterns to a certain phase coub introduced pattern-oriented analysis and design (POAD), of the software lifecycle. a methodology for composing proven design patterns into reliable and robust large-scale software systems. POAD can students apply already learned patterns using a coherent exam- be used to quickly create systems that are robust, scalable and ple. The PBD lecture is comparable to a hackathon: the lecture maintenance-friendly thanks to the use of UML class diagrams begins with a problem statement and students work on the as building blocks. Yacoub found that the most difficult part problem throughout the lecture and must achieve and deliver of software development is not programming but rather the the results by a defined deadline. Instructors choose a subset decision making required in the design phase. These design of the patterns already learned and skillfully formulate them decisions are integrated into the system for its entire lifecycle in the problem statement. The structure of the PBD lecture [7]. Based on this concept, Ackerman developed pattern-based is important and is therefore explained in more detail in the engineering (PBE); a systematic, disciplined, and quantifiable following section. approach to software development. PBE involves the use of pattern specifications and implementations throughout the A. Structure of the PBD Lecture software development and delivery process [8]. The PBD lecture is based on the Scrum1 framework. Similar III. PATTERN -BASED D EVELOPMENT & PATTERN to Scrum, the lecture is divided into several short iterations. T RACEABILITY Based on a problem statement, product backlog items (PBIs) PBD is a model-based development technique that focuses are derived and iteratively implemented. The PBIs are created on the reuse and extensive use of patterns during analysis, by the instructors and are rather generic and intended to stim- system design, object design, testing, and build-and-release ulate discussion. When formulating the problem statement, management. For each phase of the software lifecycle, dif- hints to specific patterns should be given. For example, the ferent patterns are available and can be applied. For ex- phrase “the application must be compatible with the existing ample, architectural patterns are used during system design system” indicates the application of the adapter pattern [9]. (cf. Figure 1). Antipatterns can occur in any phase and are The amount of work for the PBIs should be feasible to therefore also included when teaching PBD. This approach to complete in the given timeframe, which is a challenge for teaching PBD follows an inductive and formative approach. instructors. Instructors may provide code skeletons and parts Traditionally, a university course is divided into 12-14 lectures. of the implementation needed for specific components that can In each lecture, a set of patterns that can be applied in a certain be integrated into the increment. These components can be phase of the software lifecycle are taught. In an interactive made available to the students for each iteration (for example learning approach, these patterns can be applied in small as a git repository). exercises after the delivery of the theory. PATTERN-BASED DEVELOPMENT Product Backlog Item (PBI) Analysis System Object Testing Build and No Dailies 10 - 20 Design Design Release ... MIN Build and Analysis Architectural Design Testing Patterns Patterns Patterns Patterns Release Patterns Antipatterns Product Sprint Exercise Increment Backlog Backlog Fig. 1. Pattern catalog for PBD: Patterns can be applied and used throughout Fig. 3. Exercise iteration for teaching PBD—adopted from Scrum. the software lifecycle: analysis, system design, object design, testing, and build-and-release. Each iteration is either an in-class exercise (IC), a homework As the course progresses, students learn and apply a variety (HW), or a tutorial (T) according to the definitions of different of patterns. To further deepen the students’ understanding of types of exercises given in [4]. the patterns and their application, a PBD-specific lecture is held at a specific point in time (cf. Figure 2). In this lecture, 1 https://www.scrum.org/ ISEE 2018: 1st Workshop on Innovative Software Engineering Education @ SE18, Ulm, Germany 21 B. Artifacts A. EIST PBD involves three artifacts that correspond to the artifacts EIST is an introductory course to software engineering in defined in Scrum: the product backlog, the sprint backlog which students learn to apply relevant concepts and methods and the increment. Instructors can change and add PBIs in in each phase of a software engineering project. The students the product backlog during the lecture and introduce new have university-level knowledge of the most important terms requirements or make changes. The sprint backlog is a subset and concepts in the software engineering domain. They are of the product backlog. Before an iteration, instructors select also aware of the problems and issues that generally must be PBIs to be implemented and thereby determine which patterns considered in software engineering. A non-negligible part of the students should apply. As soon as the exercise iteration is the course is related to patterns. Several design, architecture started, the sprint backlog cannot be changed. At the end of the and testing patterns are introduced over four lectures followed iteration, students must deliver an increment to the instructors by a PBD lecture with the following iterations: (via continuous integration and delivery), which serves as a • Iteration 1: No Pattern Applied (IC) basis for evaluating the students' results. • Iteration 2: Dealing with Generalization (IC) • Iteration 3: Strategy Pattern (IC) C. Roles • Iteration 4: Observer Pattern (IC) During the PBD lecture, instructors serve as a proxy cus- • Iteration 5: Adapter Pattern (HW) tomer and take the role of a product owner in Scrum. The B. PSE instructors are responsible for the product backlog and the sprint backlog. The students can interact with the instructors We have been teaching PSE since 2008. Typically, 500 to clarify PBIs. The Scrum framework is adapted to our students register for the course even though it is an elective needs. The Scrum master (as defined in Scrum) is not required course. Students learn about the principles of patterns in for a PBD lecture. In this lecture, student collaboration is software development and the structure of a pattern-based encouraged to provide the environment of a development software system. We teach the students how to apply patterns team in Scrum, XP or pair programming. During an iteration, to a variety of problems and how to deal with the patterns in students can choose to work alone or as a team; there is no concrete applications. The course covers patterns that can be prescribed team size. applied throughout the software lifecycle: design, architectural, testing, and organizational patterns, as well as anti-patterns D. Events are taught. The PBD lecture was held after nine lectures and A PBD lecture consists of three events that iteratively repeat comprised five iterations that involved the following patterns: during the lecture. An exercise iteration starts with sprint • Iteration 1: No Pattern Applied (IC) planning, followed by the actual development work and a • Iteration 2: Observer Pattern (IC) review of the increment. During planning, the selected PBIs for • Iteration 3: Abstract Factory Pattern (IC) one iteration are discussed. After all of the students’ questions • Iteration 4: Adapter Pattern (IC) have been answered, the exercise time starts: the timeframe • Iteration 5: Strategy Pattern (HW) for one iteration is 10-20 min depending on the number and C. Lecture Structure & Problem Statement difficulty of selected PBIs. At the end of the given time period, We use Java as the programming language and use UML the instructors present a possible solution; this corresponds to class diagrams for modeling. To stay within the scope of the review meeting in Scrum. The instructors indicate which a lecture, we adapt and tailor the software lifecycle based pattern they intend to use to complete the PBIs and students on our needs and focus on the phase in which we want to may reflect on their own results. In addition to this solution apply an appropriate pattern. In the PBD lectures for both inspection, students receive feedback from teaching assistants courses, no pattern is applied in the first iteration as we on their individual solutions. After the end of an iteration, the found that this gives the students an opportunity to familiarize next iteration starts immediately with a new selection of PBIs. themselves with the existing source code. Simple PBIs are IV. C ASE S TUDY chosen to help the students get started. The last iteration is assigned as a homework (HW) assignment rather than an in- We applied this approach for teaching PBD in two large class (IC) exercise and the results of this iteration are reviewed university courses: in the following lecture. For the distribution and assessment of 1) Introduction to Software Engineering (EIST): manda- the source code we use ArTEMiS, a platform for automated tory course with 1400 bachelor students assessment of programming exercises in large classes that 2) Patterns in Software Engineering (PSE): elective makes use of a version control system to track students’ course with 500 master students progress [10]. ArTEMiS enables the execution of structural, In both the courses a set of patterns has been introduced, taught behavioral, runtime, performance, and functional tests to test and applied prior to the PBD lecture. We describe the two the desired patterns. courses in more detail and then describe how the PBD lecture Bumpers, a simple 2D game, in which a certain number is conducted. of cars drive on a rectangular game board is chosen as the ISEE 2018: 1st Workshop on Innovative Software Engineering Education @ SE18, Ulm, Germany 22 Bumpers by designing exercises such that experienced students usually have to solve a challenging additional task in addition to the standard exercise and thereby ensure that all students can Slow Car increase their knowledge during the course. In the lectures, we demand and promote cooperation between students and encourage students to use patterns as a language. The goal is that, e.g., when a student mentions the term “bridge”, all other students immediately know what the term means and have a common understanding of a possible solution to the design problem. Fast Car VI. C ONCLUSION In this paper, we describe the foundation for our approach to Fig. 4. Screenshot of the Bumpers game: the user interface after iteration 1. teaching PBD. We introduce patterns step-by-step in different Fast cars are depicted as sports cars and slow cars are represented as classic cars. phases and emphasize their application in a dedicated PBD lecture that is based on an adaptation of Scrum. This lecture problem. In this game, a car can be controlled by the player is divided into short, recurring iterations each comprising using a mouse. Some cars are fast while others are slow and the planning, development work and review. We have applied this initial driving direction of each car is randomly determined. teaching approach in two different courses to demonstrate that Cars collide with each other and a winner and a loser are it is feasible for students at different levels. Based on our determined in each crash; when a car collides with the border experience, we have developed a best practice catalog for other of the game board, it bounces back depending on its speed and instructors so that they can incorporate our method of teaching direction according to the laws of physics. Figure 4 shows the PBD into their own courses. In the future, we aim to conduct initial user interface of Bumpers. The goal is to continuously qualitative and quantitative evaluations. Further, we plan to improve the game and incrementally extend its functionality. integrate the teaching method into an online course. We expect To ensure that the timeframe of the lecture is not exceeded, a to face and overcome various challenges in our work to make source code is provided for the students to work on. teaching patterns in software development more interactive and V. D ISCUSSION exciting. As we have applied this approach for teaching PBD several R EFERENCES times, we discuss our experiences and share our findings and [1] D. W. Shaffer, “Pedagogical praxis: The professions as models for best practices with other instructors. By combining theoretical postindustrial education,” Teachers College Record, vol. 106, no. 7, pp. knowledge delivery with the immediate practical application 1401–1421, 2004. [2] J. Whitehead, “Collaboration in software engineering: A roadmap,” in of this knowledge, it is possible to attract students to attend the 2007 Future of Software Engineering. IEEE Computer Society, 2007, lectures. As with other major lectures, the number of students pp. 214–225. attending our lectures is declining but not as much as for [3] B. Bloom, M. Engelhart, E. Furst, W. Hill, and D. Krathwohl, “Tax- onomy of Educational Objectives: The Classification of Educational traditional lectures that are not interactive. Students seem to Goals,” 1956. be more motivated and recognize the added value of the PBD- [4] S. Krusche, A. Seitz, J. Börstler, and B. Bruegge, “Interactive Learning: based interactive courses. As additional motivation, we reward Increasing Student Participation Through Shorter Exercise Cycles,” in Proceedings of the Nineteenth Australasian Computing Education students who actively participate in the exercises. Students Conference. New York, NY, USA: ACM, 2017, pp. 17–26. who submit submissions quickly or provide particularly good [5] S. Krusche, B. Bruegge, I. Camilleri, K. Krinkin, A. Seitz, and submissions are rewarded with small gifts such as gummy C. Wöbker, “Chaordic Learning: A Case Study,” in Proceedings of the 39th International Conference on Software Engineering: Software bears or gadgets (for example, bluetooth speakers and power Engineering and Education Track, ser. ICSE-SEET ’17. Piscataway, banks). In our experience, this encourages the students to put NJ, USA: IEEE Press, 2017, pp. 87–96. their newly acquired knowledge into practice and deliver fast [6] D. Hock, “The chaordic organization: Out of control and into order,” World Business Academy Perspectives, vol. 9, no. 1, pp. 5–18, 1995. and high-quality results. Exercises must be carefully planned, [7] S. Yacoub and H. Ammar, Pattern-Oriented Analysis and Design: set up and assessed. It should be noted that it takes more time Composing Patterns to Design Software Systems. Boston, MA, USA: and personnel to prepare and execute a PBD lecture than a Addison-Wesley Longman Publishing Co., Inc., 2003. [8] L. Ackerman and C. Gonzalez, Patterns-Based Engineering: Success- traditional lecture. Another positive impact of applying PBD fully Delivering Solutions via Patterns, 1st ed. Addison-Wesley is that the students become familiar with the methods and Professional, 2010. processes of agile software development; specifically, students [9] E. Gamma, R. Helm, R. Johnson, and J. Vlissides, Design Patterns: Elements of Reusable Object-oriented Software. Boston, MA, USA: learn an adaption of Scrum and learn how to apply it. Changes Addison-Wesley Longman Publishing Co., Inc., 1995. do not pose a major obstacle and can be instantly integrated. [10] S. Krusche and A. Seitz, “ArTEMiS - An Automatic Assessment Man- When applying PBD in large-scale lectures, we can deal with agement System for Interactive Learning,” in 49th Technical Symposium on Computer Science Education (SIGCSE). ACM, 2018. students with different levels of apriori knowledge of students ISEE 2018: 1st Workshop on Innovative Software Engineering Education @ SE18, Ulm, Germany 23