World-level Classes and Methods. Chapter 6

Similar documents
Classes, Objects, and World-level Methods. Alice

Class-level Methods. Chapter 6 part 1

Variables and Functions Chapter 3

Decision Structures. Chapter 4

Methods in Alice. Brookwood High School Mrs. Crystal L. Furman

Getting Started with Java Using Alice. 1 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

The Essentials of Alice

potions. The troll doubles in size.

Anjuli Kannan. Google Earth Driving Simulators (3:00-7:00)

Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two

The Alice Scene Editor

A Simple Quiz for Alice 3.2: Ask User Functions.

Appendix A Reference: Built-in Methods

What Is Alice? Classes and Objects. The Power of Alice. A modern programming tool 3-D graphics 3-D models of objects

Telling a Story Visually. Copyright 2012, Oracle. All rights reserved.

2.9 Modularization. Department of CSE,Coimbatore

Marking Period 1. Marking Period 2

New Perspectives on PowerPoint Module 2: Adding Media and Special Effects

GETTING AROUND STAGE:

IT Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008

Choose the best answer from each of the following; answer A for True, B for False for any T/F questions.

How to Use Windows Movie Maker to Create a Video

9. Simple contact forms

The Essentials of Alice (Bunny) By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008

WINTER BREAK HOLIDAY HOMEWORK

Program Planning, Data Comparisons, Strings

Using nu/tpu on UNIX Last revised: 1/28/00

CompSci 94 Making Decisions February 8, Prof. Susan Rodger

Click Freegal Music from the surreylibraries.ca (hover over the blue Research and Downloads tab and select Downloads.

PowerPoint Level 2. An advanced class in presentation software. Phone: SCIENCE SKILL SOLUTIONS TECH CENTER

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 1 The Blender Interface and Basic Shapes

Advanced PowerPoint. Course Description. Objectives: Using Master Slides. Using a Notes Master and a Handout Master. Add a Picture to a master

Alice 3 Workshop. CS & IT Irvine, CA July 9, Copyright 2012 Wanda Dann, Don Slater, Steve Cooper

Lesson 6: Add Animations, Audio, and Video Microsoft PowerPoint 2016 IN THIS CHAPTER, YOU WILL LEARN HOW TO

Premiere Pro CC 2018 Essential Skills

Introduction to Events

Methods & Classes in Alice

Downloaded from

GET FAMILIAR WITH WINDOWS MOVIE MAKER

Chapter 0. Getting Started. Objectives

Kids College Computer Game Programming Exploring Alice 3.X and Object-Oriented Programming

New buttons New buttons: Excel View & settings 2/3. Excel View & settings 1/3 PLEASE SKIP THIS SLIDE. It s old. Excel View & settings 3/3

Exit: These control how the object exits the slide. For example, with the Fade animation the object will simply fade away.

Events (Alice In Action, Ch 6)

Creating a slideshow with captions

Scratch Lesson 2: Movies Made From Scratch Lesson Framework

Duration 30 minutes Notes This tutorial was built using Alice

First, collect your digital photos prior to starting this project. You may want to storyboard (plan) your PhotoStory also.

Animate a Name Cards

Microsoft PowerPoint 2016 Part 2: Notes, Links, & Graphics. Choosing a Design. Format Background

SCRATCH MODULE 3: NUMBER CONVERSIONS

Alice Methods and Classes. Methods and Classes

Sound Editing in Final Cut Studio Creating a Sound Mix

Introduction to Computer Science with MakeCode for Minecraft

Windows Movie Maker Reinforcement Handout

EDITING ON FINAL CUT PRO

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy

Making Objects Move in Unison: Using Lists. Overview

Making Objects Move in Unison: Using Lists

PowerPoint : :. PowerPoint

Tech Guide XMind. Where to find it:

Tutorial00. Jumping down the rabbit hole

Introduction to Alice. Computer Science for High School (CS4HS)

Welcome to COMP 388 Tutorial on:

Figure 1: My Blocks are blue in color, and they appear in the Custom palette in NXT-G.

ViewSonic Elite XG240R Cooler Master MasterPlus+ Software How-To GUIDE

DIRECTV Message Board

The Oracle Academy Supports 1.5 million students in 95 countries

Welcome to Sinclair Wilson Movie Making!

imovie 08 Apple s Free Video Editor

Creating and Triggering Animations

I wish to thank the unknown photographer who has clicked these photos.

Peeking into Computer Science Alice Lab Manual. Lab Manual. Programming

PowerPoint Applying Transitions. Introduction. About transitions

Methods Tutorial: Part Two. By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008

Finite State Machines

Start menu. Toggles between All Programs & Back

Welcome. Microsoft PowerPoint 2010 Fundamentals Workshop. Faculty and Staff Development Program

How to Submit a New UIW IRB Application

Information and Creative Technology

University of Pennsylvania Department of Electrical and Systems Engineering Digital Audio Basics

By Ruthie Tucker Under the direction of Professor Susan.

Skills covered: Add a Table Insert, Move, and Resize Clip Art Apply a Transition Animate Objects Create a Handout Header and Footer

Module 2: Content Development Organize Course Materials

Writing and Running Programs

ECE/CS 3710 Computer Design Lab Lab 2 Mini-MIPS processor Controller modification, memory mapping, assembly code

Computer graphics 2: Graduate seminar in computational aesthetics

1. In the accompanying figure, the months were rotated by selecting the text and dragging the mouse pointer up and to the right.

Alice Tutorial 2. Downloading Tutorials

Microsoft Office 2003 Beginning Microsoft Word

Guide to accessibility for students

2. Getting Started When you start GeoGebra, you will see a version of the following window. 1

The Many Uses of ALE

1.1 Considering for Choosing Layout in SmartArt Graphics

Crossley Fields - Computing Vocabulary

Due to conversion of powerpoint to PDF some of the Animation, all of the sound and any inserted video Will Not play in the PDF version, when given in

using Arrays and Lists in an Alice world Prerequisites Everything World.OpeningScene Cinderella.end the chickens while they dance.

Chapter 15: Object Oriented Programming

Exploring Alice and Object-Oriented Programming

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

Transcription:

World-level Classes and Methods Chapter 6

Programs Grow Code seems to grow and grow Makes program more difficult to read and process in our minds Games and other software can have thousands, even millions of lines of code

Basic Components Classes, objects, and methods in object-oriented programming These components help to o Organize a large program into small modules o Design and think about an intricate program o Find and remove errors (bugs)

Classes and Objects Classes o In Alice, classes are predefined as 3D models Objects o An object is an instance of a class Class: Frog (Uppercase first letter) Objects: frog, frog1, frog2, frog3 (lowercase first letter)

Methods Built-in (predefined) methods o Examples: move, turn to face, say Custom methods o User creates own method

Stepwise Refinement Process of breaking problem into smaller tasks o Then break each task into simpler steps Once storyboard completed write method for each task

Lunar Robot Example

Lunar Robot Using Methods Organize instructions into smaller methods A possible storyboard for Lunar Robot example 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

surprise Method Break down each major task into simpler steps o Example for surprise method: surprise Do in order alienonwheels moves up alienonwheels says "Slithy toves?" spiderrobot's head turns around

Demo: Starting a new method First 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

World.surprise Code Editor Click on tabs to switch between methods

World Level Method Method for entire World Has instructions involving more than one object (spiderrobot, alienonwheels)

Demo First Encounter Concepts illustrated in this example world: o surprise is a world-level method Executed by calling (invoking) the method

Starting Method Can run surprise by self by clicking down arrow to right of method in Events

Method investigate Instructions that moves robot and legs one meter at time

Method react Alien moves down, Robot informs Houston

Edit or Read Method Click on edit button to edit or read method code

Combine all Methods 2 instances of investigate used to move 2 meters Can use loop to move more than 2 meters

Deleting Methods Delete all calls to method Close its edit window o Right click edit window and select close Drag name to trash bin

Why Write Own Methods? No method does what you need o You need new functionality Saves time o Can call method many times without making your own code to do same thing Reduces code size o Call method instead of rewriting code Allows thinking at a higher level o o Can think surprise instead of The alien moves up and says Slithy toves? and then the robot's head turns around. Abstraction "thinking at a higher level"

Example: A Beetle Band Create an animation for a bug band as an advertisement for their next concert

Demo BeetleBand-v1 Concepts illustrated o To play a sound, a sound file must first be imported into Alice Alice is not a sound editor o This code is only for georgebeetle o Three more methods (one for each band member) will be needed

Storyboards Each bug band member will perform a solo. Do together Do in order georgebeetle move up georgebeetle move down play sound Do together Do in order ringobeetle move up ringobeetle move down play sound Do together Do in order paulbeetle move up paulbeetle move down play sound Do together Do in order lennonbeetle move up lennonbeetle move down play sound

A Better Solution Creating four versions of similar code is tedious Only things that change are band member and music played Better solution o Write more flexible method

Beetles Storyboard One method can be used Use parameters to specify Which band member will perform Which music should be played solo Parameters: bandmember, music Do together Do in order bandmember move up bandmember move down play music

Parameters Built-in methods give flexibility by providing parameters like distance and direction Parameters allow values (arguments) to be passed to methods o Example Parameters: direction, distance, duration Arguments: up, 0.5 meters, 0.5 seconds Where duration is optional

Kinds of Parameters Alice provides several kinds of parameters that can be used in custom methods o Number, Boolean, Object, Other Create parameter using Create parameter bandmember is passed as Object parameter

Place bandmember in Method Drag bandmember to editor

Create More Parameters Click on create new parameter

Drag bandmember to Editor Fill in parameters:

Placeholders A value is passed to a method with an argument Parameters act as placeholders for the argument o Takes value of argument being passed and uses it in method o Parameter name is likely to be different than argument Example: in move method o You pass arguments that are specific direction and distance to move (ex: up, 0.5 meters) o Those specific arguments are passed to the move method s parameters (direction and distance)

BeetleBand-v2 New solo method is added for each band member and music to play

Demo BeetleBand-v2 Concepts illustrated o Enter name and select type for each parameter bandmember is an Object parameter music is a Sound parameter o Arguments passed to parameters in called method bandmember: georgebeatle, lennonbeatle, paulbeetle, ringobeatle What are the arguments passed into music parameter? o Parameters are placeholders bandmember and music get new values when called

Homework Read chapter 6 sections 3,4,6,7 Answer questions in handout Do lab assignments after handing in answered questions Due one week after assigned with 1 week grace