Lesson Plan Course Title: Advanced Computer Programming Session Title: Software Modeling Lesson Duration: 2-3 days Performance Objective: Upon completion of this assignment, the student will be able to: • use advanced modeling techniques to document software, • identify modular design concepts through documentation, and • use current, appropriate modeling and analysis tools (UML) Specific Objectives: • identify the key attributes of source code that can and should be documented • construct UML diagrams to model the structure and relationships between parts of a program • construct diagrams that document components of a software object Preparation TEKS Correlations: 130.277 (c) • 3.H – use advanced modeling and analysis of functional requirements • 7.H – identify modular design concepts • 5.F – use appropriate modeling and analysis tools Instructor/Trainer References: • Horstmann, Cay S. Big Java. Hoboken, NJ: Wiley, 2010. Print. • Fowler, Martin, and Kendall Scott. UML Distilled: a Brief Guide to the Standard Object Modeling Language. Reading, MA: Addison Wesley, 2000. Print. • Davison, Andrew. Killer Game Programming in Java. Sebastopol, CA: O'Reilly Media, 2005. Print. Instructional Aids: Presentation Software Modeling Labs (KEY is provided for PreLab and Lab) PreLab and Lab Handout Student Files SpaceGame (Bullet.java, Enemy.java, EnemyBullet.java, Invaders.java, Ship.java, Stars.java) (PreLab) WallBuster(BreakIn.java, Brick.java, Paddle.java, Ball.java) (Lab) Materials Needed: Copies of PreLab and Lab Student Files should be loaded on student computers, or provided in some manner. It is useful to have copies of the Student Files, but not necessary if the students use the files from the computer. Equipment Needed: No special equipment is necessary to complete this assignment. Students should have knowledge and experience with inheritance and extending classes. Introduction MI Introduction (LSI Quadrant I): Imagine being given a program that has several class files. What if you were asked to add a feature to the program? How difficult do you think that would be? Do you think you would know which files you would have to change? How would you determine what other files would be affected by changes you make? Software modeling allows you to provide a “road map” to a computer program so you can see where things happen in the program and how different classes affect each other. Outline MI Outline (LSI Quadrant II): Instructor Notes: • Reasons for creating documentation and modeling • Overview of UML modeling tool • Class Diagrams • Relationship Diagrams • Instance Diagrams • Creating Relationship Diagrams • Creating Class Diagrams IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 2 Application MI Guided Practice (LSI Quadrant III): The PreLab can be a good opportunity to practice with the students. It would also be beneficial to select a program the students have previously written and practice modeling it. MI Independent Practice (LSI Quadrant III): Following the presentation, students should be provided with the lab to complete on their own. Summary MI Review (LSI Quadrants I and IV): Have students model a program written by a different student. Evaluation MI Informal Assessment (LSI Quadrant III): You may use the PreLab to assess whether or not the students are progressing well. The PreLab is important in determining whether or not the students are ready to complete the lab. MI Formal Assessment (LSI Quadrant III, IV): Software Modeling Lab Extension MI Extension/Enrichment (LSI Quadrant IV): This lesson only covers documenting code. Students should find software models and see if they can develop source code from the models. The book Killer Game Programming (see references) has several models that would make good exercises to work from. IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 3 Icon MI Verbal/ Linguistic Logical/ Mathematical Visual/Spatial Musical/ Rhythmic Bodily/ Kinesthetic Intrapersonal Interpersonal Naturalist Existentialist Teaching Strategies Lecture, discussion, journal writing, cooperative learning, word origins Problem solving, number games, critical thinking, classifying and organizing, Socratic questioning Mind-mapping, reflective time, graphic organizers, color-coding systems, drawings, designs, video, DVD, charts, maps Use music, compose songs or raps, use musical language or metaphors Use manipulatives, hand signals, pantomime, real life situations, puzzles and board games, activities, role-playing, action problems Reflective teaching, interviews, reflective listening, KWL charts Cooperative learning, roleplaying, group brainstorming, crosscultural interactions Natural objects as manipulatives and as background for learning Socratic questions, real life situations, global problems/questions Personal Development Strategies Reading, highlighting, outlining, teaching others, reciting information Organizing material logically, explaining things sequentially, finding patterns, developing systems, outlining, charting, graphing, analyzing information Developing graphic organizers, mind-mapping, charting, graphing, organizing with color, mental imagery (drawing in the mind’s eye) Creating rhythms out of words, creating rhythms with instruments, playing an instrument, putting words to existing songs Moving while learning, pacing while reciting, acting out scripts of material, designing games, moving fingers under words while reading Reflecting on personal meaning of information, studying in quiet settings, imagining experiments, visualizing information, journaling Studying in a group, discussing information, using flash cards with other, teaching others Connecting with nature, forming study groups with like minded people Considering personal relationship to larger context IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 4 Name: __________________________ Date: ________________ Period: _________ Software Modeling – PreLab Purpose: At the end of this lab, you should be able to use UML diagrams to identify components of a system and generate UML documentation for an existing project. Materials: You will require a java compiler and editor, the SpaceGame example source code and the documents for this lab. Directions: Compare the following Relationship Diagram with the example source code and answer the questions. Questions: 1. How many classes are there in the project? 2. Two of the classes are extended from other classes. Which classes are extended and what are they extended from (e.g. Cat extends from Pet)? 3. Examine the Invaders object. What objects does it use (what objects does it contain)? 4. Fill in the Class Diagram for Ship. IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 5 Grading note: for the attributes, the private indicator may be left out, and for methods the public indicator may be left out as these are the expected visibility modifiers. Ship IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 6 Name: __________________________ Date: ________________ Period: _________ Software Modeling – PreLab KEY Purpose: At the end of this lab, you should be able to use UML diagrams to identify components of a system and generate UML documentation for an existing project. Materials: You will require a java compiler and editor, the SpaceGame example source code and the documents for this lab. Directions: Compare the following Relationship Diagram with the example source code and answer the questions. Questions: 1. How many classes are there in the project? 6 2. Two of the classes are extended from other classes. Which classes are extended and what are they extended from (e.g. Cat extends from Pet)? EnemyBullet extends from Bullet Enemy extends from Ship 3. Examine the Invaders object. What objects does it use (what objects does it contain)? Invaders uses: Stars, Bullet, Ship and Enemy IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 7 4. Fill in the Class Diagram for Ship Grading note: for the attributes, the private indicator may be left out, and for methods the public indicator may be left out as these are the expected visibility modifiers. Ship -x:int -y:int -dx:int -dy:int -img:ImageIcon -shotTimer:int -liveTimer:int -alive:boolean +Ship(int,int) #setLiveTimer(int):void +destroy():void #revive():void +isAlive():boolean #setVelocity(int, int):void #setImage(String):void +getShot():Bullet +getBounds():Rectangle +moveLeft():void +moveRight():void +moveUp():void +moveDown():void +draw(Graphics):void #loadImage(String):javax.swing.ImageIcon IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 8 Name: __________________________ Date: ________________ Period: _________ Software Modeling – Lab Purpose: At the end of this lab, you should be able to use UML diagrams to identify components of a system and generate UML documentation for an existing project Materials: You will require a java compiler and editor, the WallBuster example source code and the documents for this lab. Directions: 1. Create the Relationship Diagram for WallBuster. 2. Create the Class Diagrams for the four classes (Ball, BreakIn, Brick, Paddle) IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 9 Name: __________________________ Date: ________________ Period: _________ Software Modeling – Lab KEY Purpose: At the end of this lab, you should be able to use UML diagrams to identify components of a system and generate UML documentation for an existing project Materials: You will require a java compiler and editor, the WallBuster example source code and the documents for this lab. Directions: 1. Create the Relationship Diagram for WallBuster. 2. Create the Class Diagrams for the four classes. IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 10 IT: Advanced Computer Programming : Software Modeling Lesson Plan Copyright © Texas Education Agency, 2013 11