Classes, Objects, and World-level Methods MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.

Slides:



Advertisements
Similar presentations
CS320n –Visual Programming Class-level Methods and Inheritance – Part 1 Mike Scott (Slides 4-3-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger.
Advertisements

Class-level Methods Alice. World / Class Method World method A general method that may refer to multiple objects; not closely associated with any particular.
Class-level Methods and Inheritance Part 1 Alice.
Review of Chapter 4 Sections 1 and 2 World-level methods involve two or more objects break a large problem into smaller, logical units follow a design.
Class-level Methods and Inheritance MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
CSC1401 Animation Creating methods/instructions (class-level)
Parameters and World-level methods Alice. Our Dragon world The dragon must to take off and fly, to carry the princess.
Parameters and Event-Handler Methods Alice. Mouse input Interactive programs often allow the user to use a mouse to click buttons in a windows-based interface.
World-level Methods with Parameters Alice. Larger Programs As you become more skilled in writing programs, you will find that your programs quickly begin.
Programming in Alice Chapter 2. Today’s Agenda Designing a Program Writing Methods Executing Instructions Simultaneously Comments Tips for Setting Up.
Creating an Animation Program Alice. Step 1: Design Decide on the problem to be solved Design a solution We will use a storyboard design technique, commonly.
Classes, Objects, and World-level Methods Alice. Programming in Alice© 2006 Dr. Tim Margush2 Class / Object Class A template describing the characteristics.
Copyright 2011 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Implementation Algorithm  Code World.my first method Control blocks Statements (methods,
Functions and Conditionals in Alice 1 Stephen Cooper Wanda Dann Barb Ericson September 2009.
Programming: Simple Control Structures Alice. Control Statements We have been using Do in order and Do together to control the way instructions are executed.
Creating An Animation Program Alice Web Design Section 8-4.
Recursion1 Stephen Cooper Wanda Dann Randy Pausch Barb Ericson Jan 2010 Recursion in Alice.
Classes, Objects, and World-level Methods
Today’s Agenda 1.Collect Pre-Lab 4 2.Alice Programming Assignment Storyboards 3.Classes 4.Objects 5.Methods 6.Assign pair programming teams and meet upstairs.
Classes, Objects, and World-level Methods Alice. Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase.
Classes, Objects, and World-level Methods Section 47 Web Design.
Animation Programs: Scenarios and Storyboards Alice Web Design Section 8-3.
Using Alice to Introduce Programming Concepts Mr. Craig Ham Technology Coordinator Westminster Schools of Augusta Augusta, GA.
Classes, Objects, and World-level Methods Alice. Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase.
Class-level Methods Chapter 6 part 1. Classes and Objects Classes o In Alice, classes are predefined as 3D models Objects o An object is an instance of.
Getting started with Alice Adapted from presentations by Jenna Hayes, Duke University Donna Gavin, UWP Computer Science and Software Engineering.
Parameters and Event-Handler Methods MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
A first program Sept 14, 2010 – Day 3 Object-oriented Programming thru Video Games TIDE 1840 Harry Howard Tulane University.
Classes, Objects, and World-level Methods Alice. Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase.
Creating An Animation Program Alice. Recall We began the animation creation process We introduced the concept of storyboard We will continue using the.
ActionScript: Addressing Display Objects, Duplicating MovieClips, Attaching MovieClips Dynamically MMP 220 Multimedia Programming This material was prepared.
ActionScript: Loading External Content with MovieClipLoader Class, Listener Objects, Preloaders, HitTest, Loading Sound MMP 220 Multimedia Programming.
Animation Programs: Scenarios and Storyboards
ActionScript: Functions, Parameters, Functions that return a value, Variables, setInterval Functions MMP 220 Multimedia Programming This material was prepared.
CompSci 4 Chap 4 Sec 1 Sept 15, 2005 Prof. Susan Rodger.
Creating an Animation Program
CS320n –Visual Programming Classes, Objects, and World- Level Methods Mike Scott (Slides 4-1)
ActionScript: For Loops, While Loops, Concatenation and Arrays MMP 220 Multimedia Programming This material was prepared for students in MMP220 Multimedia.
ActionScript: Classes, Properties, EventHandler Methods, Datatypes & Control Structures MMP 220 Multimedia Programming This material was prepared for students.
Fall 2009ACS-1805 Ron McFadyen1 Chapter 2 Program Design & Implementation.
Storyboarding and Program Design Alice. Step 1: Design Decide on the problem to be solved Design a solution We will use a storyboard design technique,
Copyright 2008 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Functions, Loops, and Parameters.
Programming: Simple Control Structures
Programming: Simple Control Structures MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)
World-level Classes Chapter 6 Part 2. Programs Grow Program code grows larger over time This makes it more difficult to read and process the code in our.
Wanda Dann Don Slater Classes and Objects Copyright 2012 Wanda Dann, Don Slater All rights reserved.
Animation Programs: Scenarios and Storyboards Alice.
Interactive Programming MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project.
Parameters MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project funded.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Using Placeholders to Simplify your Methods: Learning Methods, Part 2 By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
World-level Methods with Parameters
Classes, Objects, and World-level Methods
Class-level Methods Alice.
Creating an Animation Program
Classes, Objects, and World-level Methods
Parameters and World-level methods
Animation Programs: Scenarios and Storyboards
Programming: Simple Control Structures
Classes, Objects, and World-level Methods
Class-level Methods and Inheritance
Presentation transcript:

Classes, Objects, and World-level Methods MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project funded by National Science Foundation grant # Co PI’s Christopher Stein and Jody Culkin BMCC CUNY The material in this handout is taken from “Learning to Program with Alice” a project supported by the National Science Foundation under Grant NSF , NSF , and NSF Contact Wanda Dann: Stephen Cooper: Randy Pausch: and Don Slater:

Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase to many, many lines of code. Games and other "real world" software applications can have thousands, even millions of lines of code.

Classes, Objects, & Methods Object-oriented programming uses classes, objects, and methods as basic programming components. These components help to – organize a large program into small modules – design and think about an intricate program – find and remove errors (bugs)

In our programs, we have been using… Classes – In Alice, classes are predefined as 3D models Objects – An object is an instance of a class. Class: Frog (Uppercase name) Objects: frog, frog1, frog2, frog3 (lowercase names)

We have also used… built-in (predefined) methods – Examples: move, turn to face, say World.my first method – Example: In the FirstEncounter world, we wrote program code where a robot was surprised by an alien. All the program code was written in this one method, see next slide…

Potential Problem The program code just seemed to grow and grow. If we continue to write programs this way the programs will become longer and more difficult to read and think about.

Solution A solution is to organize the instructions into smaller methods. A possible storyboard Do in order surprise – spiderRobot and alienOnWheels surprise each other investigate – spiderRobot gets a closer look at alienOnWheels react – alienOnWheels hides and spiderRobot sends message

Next Step The next step is to break down each major task into simpler steps. – Example: surprise Do in order alienOnWheels moves up alienOnWheels says "Slithy toves?" spiderRobot's head turns around

Stepwise Refinement The process of breaking a problem down into large tasks and then breaking each task down into simpler steps is called stepwise refinement. Once the storyboard is completed, we write a method for each task.

Demo: Starting a new method First, to associate the new method with the World select the World tile in the Object Tree select the methods tab in the details area click on the "create new method" button

Demo Ch04Lec1FirstEncounter Concepts illustrated in this example world: – surprise is a world-level method because it is defined as a method for World and has instructions that involve more than one object (spiderRobot, alienOnWheels) –The surprise method is executed by calling (invoking) the method.

Why? Why do we want to write our own methods? – saves time -- we can call the method again and again without reconstructing code – reduces code size – we call the method rather than writing the instructions again and again – allows us to "think at a higher level" can think surprise instead of “The alien moves up and says ‘Slithy toves?’ and then the robot's head turns around. " the technical term for "think at a higher level" is "abstraction"

Assignment Read Chapter 4 Section1 – World-level Methods How to create them How to call them When it is appropriate to use them