1 / 51

Alice Workshop: Developing Software for Alice Worlds

Join the PIIT Computer Science Summer Camp and learn how to develop software for Alice Worlds. In this workshop, we will discuss the software development cycle, create custom methods for Alice objects, and go through the various phases of software development including design, implementation, testing, and debugging.

nlamb
Download Presentation

Alice Workshop: Developing Software for Alice Worlds

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PIIT Computer Science Summer Camp - Alice July 10, 2012 Brenda Parker Computer Science Department MTSU

  2. Welcome – Day 2 • Demonstrate Alice Worlds • Review Contest Brenda Parker - Alice Workshop

  3. Workshop Agenda • Discuss how programmers develop programs (software) • Apply the “software life” cycle to Alice • Create “custom” methods for Alice Objects Brenda Parker - Alice Workshop

  4. Part I – Developing Software Programmers use the “Software Development Cycle” • Design Phase • Implementation Phase • Testing Phase • Debugging Phase Brenda Parker - Alice Workshop

  5. Developing Software Design Phase • Programmers will learn about all specifications (what the program should do) • Programmers will create a list of instructions needed to solve the problem • Programmers will break complex methods down into a smaller methods called “modules” Brenda Parker - Alice Workshop

  6. Developing Software Design Phase In Alice, we should learn : • Which objects are needed? • Which methods are needed? • What does the first scene look like? Brenda Parker - Alice Workshop

  7. Developing Software Implementation Phase Programmers will use a programming language to enter instructions (coding) In Alice, we add and position objects and code methods for the objects Brenda Parker - Alice Workshop

  8. Developing Software Testing Phase Programmers will “test” the program to see if it works properly and meets its specifications. Testing involves testing each method to see if it works by itself and with other methods Brenda Parker - Alice Workshop

  9. Developing Software Debugging Phase Programmers will correct mistakes found in the Testing Phase In Alice, correct the design of each method and correct the initial state of the world Brenda Parker - Alice Workshop

  10. Good Programmers know the importance of DESIGN 1. Design their software carefully! 2.Use a “Modular” design • break a large task down into smaller tasks called modules • Each module performs one task In Alice, this is performed by creating “user defined methods” = “Custom World Methods”

  11. Creating User Methods Why? • Makes Alice programs easier to debug • Makes Alice programs easier to create • Supports “modular” design Now, let’s learn to create our own methods! Brenda Parker - Alice Workshop

  12. World Custom Methods • Created by the user • Used to break up large complex methods into smaller more manageable methods Brenda Parker - Alice Workshop

  13. Example Suppose we wish to create an “Ice Skater World” which opens with an introduction by the skater. Then, the skater skates around 2 cones and jumps in the air. At the end the skater says goodbye and the camera circles the skater.

  14. Example We would break this task down into 3 separate tasks! • Opening Scene • Skating Scene • Closing Scene Therefore, we need to create these three methods!

  15. Design Phase • Determine objects needed • Ice skater • 2 cones • Determine methods • openingScene • skatingScene • closingScene

  16. Design Phase • Describr beginning scene • Snow world • Class lake environment • Add and position objects • Red and green cones • Skater in the middle of the cones

  17. Implementation Phase • Open Alice • Choose snow world • add Class Lake Environment • Add ice skater and two cones (red and green) as shown • Save your world as iceSkate1.a2w

  18. Implementation Phase (coding) • Write code for your three methods • openingScene • skatingScene • closingScene

  19. Custom World Method How to create and use Custom World Methods • Name the method • Write the method • Call the method (Tell Alice to execute the method) Brenda Parker - Alice Workshop

  20. Create your Methods • Name your method • Click on World in the Object Tree • Click on create new method in the World’s Details Panel • Name the method – openingScene Repeat above for the skatingScene and the closingScene methods Brenda Parker - Alice Workshop

  21. Custom World Method 2. Write the method • Click on the world object in the object tree • Click on methods • Click edit to write the method Brenda Parker - Alice Workshop

  22. Testing Phase • Test each method to see if each method works as desired • Test to see if the methods work with other methods.

  23. Testing Phase –Part 1 Test each method to see if it works. • Test the openingScene method • Play the video to see if it works. • If it doesn’t work properly, edit the method and replay.

  24. Testing Phase – Part 1 • Test all methods to see if they work properly.

  25. Testing Phase – Part 2 Test methods to see if they work with other methods. • Open world.my first method • Click and drag your method names to the editor window as shown. • Make sure that world.my first method begins when the world starts.

  26. Testing Phase - Part 2 Brenda Parker - Alice Workshop

  27. Debugging Phase • Developers should attempt to correct mistakes that have been found. • During the debugging phase, developers may often find improvements that can be made.

  28. Practice VII Questions 1.What is the difference between “primitive” methods and custom methods? 2. Give two reasons that custom methods are often used in Alice. 3. What is the name of the method that is executed when your animation first begins? 4. What are the three steps for creating custom world methods? 5.What does “call” the method mean? 6. How are custom methods “called”? 7. Name the 4 steps of the Software Development Cycle. Brenda Parker - Alice Workshop

  29. Software Documentation • Written text and visual material (chart) that describe computer software • Good software requires good documentation. • Comments that appear in the program • Notes that appear while the program is running • Instruction manual supplied with the software Brenda Parker - Alice Workshop

  30. Alice Documentation Add “Comment Tiles” which • Name the program (peguinsDance.a2w) • Programmer’s Name • Date • Program details Brenda Parker - Alice Workshop

  31. Drag a copy of the comment tile from the bottom of the Editor Area and drop it into the method. Adding Comments Brenda Parker - Alice Workshop

  32. 2. Click the phrase No comment and type in your information. Adding Comments Brenda Parker - Alice Workshop

  33. ACTIVITY Use the “software development cycle” and develop your own video. To receive points for this exercise, you should design your animation using the DAY 2 Assignment Sheet. Some ideas: • Create a story about dancing penguins • Create a story about space invaders • Create a story about trip to the moon

  34. Practice VIII Choose 1 of the following. Be sure to add comments: • Page AL 120 - #1 Penguin Dance • Page AL 123 - #2 Airport Animation • Page AL 126 - #3 Ballerina Movements • Create your own story (must have a beginning, a middle and an end). Use primitive methods as well as your own methods. Brenda Parker - Alice Workshop

  35. Using Logic and Looping Structures Logic • If –then– else • If something is true do this else do this! Brenda Parker - Alice Workshop

  36. LOGIC Example: Suppose we have two objects, Elvis and a cuckoo clock. Let’s ask the user if the user wants the Elvis to sing or does the user wish to see the cuckoo clock sound out 3 times! Brenda Parker - Alice Workshop

  37. How do we allow the user to input a value? Asking the user for input while a program is running is called “interactive input”. How do we do this in Alice? Brenda Parker - Alice Workshop

  38. User Input Example Suppose that we have a world with Elvis and a cuckoo clock. The program should ask, “Do you want Elvis to sing? If the user answers, “YES”, Elvis will sing. Otherwise, the cuckoo bird will sound out cuckoo 3 times. Brenda Parker - Alice Workshop

  39. User Input Example 1 Create a world with the two objects. 2. Drag the If/Else Control Structure to the Editor Area. 3.Set the If condition to true 4.Select the world function called “ask user for yes or no” 5.Use the function in the “if else” structure. 6. Click Question=Yes or No? to add the question. Brenda Parker - Alice Workshop

  40. User Input Example Brenda Parker - Alice Workshop

  41. Better Example – User Defined Methods

  42. Using Logic and Looping Structures Loop – statements that are executed repeatedly. Types of Loops • While • Loop • For all in order • For all together Brenda Parker - Alice Workshop

  43. Looping Structures While • Continue to repeat until a certain condition occurs. • Example: Suppose that we have a penguin that we wish to continue to move toward a hole in the ice until he “almost” reaches the hole! Brenda Parker - Alice Workshop

  44. Looping Structures Loop • Used to specify that a group of statements is to be repeated a set number of times Brenda Parker - Alice Workshop

  45. Example Edit the elvisSing method so that the user is asked to input the number of times Elvis should sing. • Drag the loop structure to the beginning of the method and set to 1 time. • Drag the world function “ask the user for a number” and place in the 1 time slot • Choose other to ask appropriate question. • Drag methods to the loop structure

  46. Loop Example

  47. variables • Variable – a name that refers to a piece of the program’s memory, in which a value can be stored, retrieved, and changed. • In Alice, there are two kinds of variables • World variable – variables that can be used by all methods • Method variable – variable that can only be used in a method that creates it.

  48. Method Variable • Click on “create new variable” • Indicate type of variable • Number • Boolean • Object • Other • Give the variable a name • Click on OK

  49. Example • Use the Elvis and cuckoo clock world and update the program so that you ask the user how many times the Elvis/cuckoo should sing. Use a variable called numberOfTimes (camelCase)

  50. Using Variable in a Loop • Edit the method to contain the variable • Click create new variable called numberOfTimes • Drag variable to beginning of method and set value to expressions – numberOfTimes • Drag World function “ask user for a number” and place in set value to and add “How many times should the cuckoo sing?” • Drag loop and set expression to numberOfTimes • Drag needed methods into the loop structure

More Related