46
Copyright © 2012, Oracle. All rights reserved. Introduction

JF V01 S01 L02 - Wikispaces · PDF file• Describe the purpose for using Alice 3 and Greenfoot tools to learn Java ... Here is an example of a Greenfoot world with ... • A boy says

  • Upload
    lethu

  • View
    216

  • Download
    1

Embed Size (px)

Citation preview

Copyright © 2012, Oracle. All rights reserved.

Introduction

2Copyright © 2012, Oracle. All rights reserved.

Introduction

What Will I Learn?ObjectivesIn this lesson, you will learn how to: • Describe the purpose for using Alice 3 and Greenfoot

tools to learn Java• Describe the skills used to generate an animation or

create a game• Describe the components of a team project• Create a teamwork assessment rubric• Describe the purpose for creating a journal to

document programming projects• Describe the code of ethics and cyber security

3Copyright © 2012, Oracle. All rights reserved.

Introduction

Why Learn It?PurposeModern computers and software have made programming of animations and games very easy and fun to do.

In this lesson, we will introduce you to two popular Java tools – Alice 3 and Greenfoot – so you can learn to program your own animations and games.

4Copyright © 2012, Oracle. All rights reserved.

Introduction

What is an Animation?An animation is a series of independent movements that when viewed rapidly, one-after-another, creates the illusion of movement.

Using Alice 3 you can create animations with 3D objects that move and act.

Because Alice 3 lets the programmer manipulate objects, it is considered object-oriented programming (“OOP”).

5Copyright © 2012, Oracle. All rights reserved.

Introduction

3D ObjectsAlice 3 uses three-dimensional (“3D”) objects that a programmer can drag-and-drop into a scene to create a virtual world.

A 3D object is one with width, height, and depth.

6Copyright © 2012, Oracle. All rights reserved.

Introduction

Virtual WorldYou will use Alice 3, and your imagination, to create a virtual world. Your virtual world will contain the following 3D objects:• Settings: objects that will remain stationary in your

animation (a tree, rocks, or a building).• Actors: objects that will move in your animation (people,

animals, or vehicles).• Background Template: a background onto which you

place both setting and actor objects.

A virtual world contains 3D objects and simulates a real or imaginary physical environment.

7Copyright © 2012, Oracle. All rights reserved.

Introduction

Virtual World (cont.)Here is an example of a 3D world. A 3D world is referred to as a “virtual world.” The example virtual world has both setting and actor objects as well as a background template.

Setting Object

Actor Object

BackgroundTemplate

8Copyright © 2012, Oracle. All rights reserved.

Introduction

View an Alice 3 AnimationTo view an animation that has already been created in Alice 3, follow these steps:1. Launch the Alice 3 software program.2. Locate the example animation file on your computer.3. Run the animation.

9Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 1: Launch Alice 3To launch Alice 3:1. Locate the Alice 3 icon on your desktop.2. Double click the icon to launch the application.3. A dialog box will display Alice templates.

10Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 2: Locate Example AnimationTo locate an animation file, follow these steps:1. From the dialog box, select the File System tab.2. Click the Browse button.3. Search for and select the “greetings.a3p” file from the

location you saved it in on your computer.‡ 4. Click the Open button from the dialog box.5. Click the OK button from the dialog box.

‡ The scenario example must first be downloaded from the videos page for this lesson in Oracle iLearning. Remember the location the file has been saved to. If you are unable to run the Alice file due to your version of Alice, watch the corresponding video.

11Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 3: Play the AnimationTo run an animation, click the Run button in the world window.

12Copyright © 2012, Oracle. All rights reserved.

Introduction

GreenfootAn interactive game is one that involves human interactions, decisions, and actions.

Using Greenfoot, you can addobjects and program their actions to create an interactive game.

Because Greenfoot lets the programmer manipulate objects, it is considered object-oriented programming (“OOP”).

13Copyright © 2012, Oracle. All rights reserved.

Introduction

Greenfoot (cont.)Greenfoot uses 2 dimensional (“2D”) objects that the programmer can drag-and-drop into a scene to create a world.

A 2D object is one with width and height (and no depth).

14Copyright © 2012, Oracle. All rights reserved.

Introduction

Play a Greenfoot GameThe steps to play a Greenfoot game are:1. Launch Greenfoot.2. Open the game file.3. Set up the objects in the game.4. Play the game.

15Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 1: Launch GreenfootTo launch Greenfoot: 1. Locate the Greenfoot icon on your desktop.2. Double click the Greenfoot icon to launch the

program.

16Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 2: Open Game FileTo open the example Greenfoot game for this course:1. Download the flying_frog example from Section 0

Course Resources in Oracle iLearning. Save the file to a location on your computer or hard drive.‡

2. From the Scenario Menu in Greenfoot, select Open. †3. Search for and select the flying_frog file. ‡4. Click the Open button from the dialog box. The game

should display.

† If this is the first time Greenfoot is launched on your machine, you may be prompted for a decision. Select Click Scenario – Open from the menu.‡ Refer to Section 1, Lesson Videos and Scenarios. Remember the location the file has been saved to on your computer.

17Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 3: Set Up the GameTo set up the game, you will need to place objects in the world that will interact in the game. To place objects in the world:1. Click once on the Frog class.2. Hold the Shift key down on your keyboard while you click

and hold the Frog class.3. Drag the Frog object onto the World.4. Repeat steps 1-3 to add objects from the Fly class.

18Copyright © 2012, Oracle. All rights reserved.

Introduction

Step 4: Play the GameTo play the game:1. Click the Run button. 2. Steer the Frog using your keyboard arrow keys.3. Eat the fly!4. Add more flies to the game to make it more interesting.

19Copyright © 2012, Oracle. All rights reserved.

Introduction

Greenfoot ObjectsLook around you. Undoubtedly, you will see many objects. Your classmates are even objects!

Similar to Alice 3, you will use Greenfoot to create a world that contains objects. The objects have states (i.e., descriptors) and behaviors (i.e., actions).

Example: ClassmateStates can include: Name, ethnicity, and hair color

Behaviors can include: Talking, walking, and running.All objects have two characteristics: State and behavior.

20Copyright © 2012, Oracle. All rights reserved.

Introduction

Greenfoot ClassesEvery object is created from a class. A class is a set of instructions for an object.

An example of a class is Bicycle. The class will define the general characteristics for all bicycle objects within that class.

A class is the general set of instructions and rules that objects created from that class will follow.

Speed = 10 MPHColor = Red

Number of wheels = 2

21Copyright © 2012, Oracle. All rights reserved.

Introduction

Greenfoot Objects and Classes ExampleHere is an example of a Greenfoot world with objects. The Frog and Fly objects are sub-classes of the Animal class.

Object

Object

World

Class

Class

22Copyright © 2012, Oracle. All rights reserved.

Introduction

Why Learn These Programs?Now that you've had a chance to install and run Alice 3 and Greenfoot, do you have any ideas about why these programs are included in this course?

How can Alice 3 and Greenfoot help you learn programming concepts and how to program in Java?

23Copyright © 2012, Oracle. All rights reserved.

Introduction

Why Learn Alice 3?Alice 3 offers a good introduction to learning how to program for many reasons:1. It uses natural English language words like “move

forward” or “turn left” rather than obscure programming syntax.

2. You drag and drop objects on the screen and press “Run” to run your animation rather than using the keyboard to type.

3. When you make a mistake in Alice 3, it is usually obvious how to fix the mistake. In programming languages it is often difficult to interpret error messages.

4. When you program in Alice 3, it is like being a movie director.

24Copyright © 2012, Oracle. All rights reserved.

Introduction

Why Learn Alice 3? (cont.)Alice 3 offers a good introduction to learning how to program for many reasons (cont.): 5. Alice 3 allows you to learn fundamental programming

concepts in the context of creating animated movies and simple video games.

6. By manipulating the objects in a virtual world, you can gain experience with many of the programming constructs typically taught in an introductory programming course.

7. Programming in Alice 3 is fun!

25Copyright © 2012, Oracle. All rights reserved.

Introduction

Why Learn Greenfoot? Greenfoot is a good introduction to programming for several reasons:1. It teaches the basics of

Java syntax and object orientation which makes developing desktop Java applications easier than starting from scratch.

2. It's interface is an interactive development environment (IDE) that allows you to edit source code, compile, and debug, just like in other Java IDE's.

26Copyright © 2012, Oracle. All rights reserved.

Introduction

Skills Needed to Generate Animations and GamesAlice 3 and Greenfoot will help you learn to program in Java. In order to use Alice 3 and Greenfoot, however, you need to learn certain skills to create animations and games.

27Copyright © 2012, Oracle. All rights reserved.

Introduction

Skills Needed to Generate Animations and Games (cont.)Here is a high level overview of the steps involved in creating an animation or game:1. Define a scenario

– What story is to be told?– What objects are needed?– What actions will take place?

2. Design the storyboard for the scenario– Visual or textual (or both)

3. Create the animation or game (in Alice or Greenfoot)4. Test

28Copyright © 2012, Oracle. All rights reserved.

Introduction

Define a ScenarioA scenario is a description of what a game or animation program will do. It tells us what should happen when the program runs, and the objects within the program that will make it work.

The scenario will create a result, as:• A lesson to tell• A story to tell• A game

A scenario is a story in the form of a problem to solve or task to perform.

29Copyright © 2012, Oracle. All rights reserved.

Introduction

Define a Scenario (cont.)A scenario contains three parts:• Story: The story to tell, or game to play. For example,

a flying frog will catch flies and eat them.• Objects: The objects you will use in your story. For

example, a frog and flies.• Actions: All the actions the objects will take.

– For example: The frog will fly using arrow keys while the flies move about randomly. When the frog touches the fly, the fly is removed from the screen.

30Copyright © 2012, Oracle. All rights reserved.

Introduction

Scenario ExampleStory• A boy says hello to his friend. His friend waves at him and

says hello back. Objects• Two children (two males, or one male and one female)

and two trees.ActionsBoy looks at his friend and says, “Hello.” Friend says “Hello” and waves back at him. Result• Using Alice 3, we have told a simple story about two

friends greeting each other.

31Copyright © 2012, Oracle. All rights reserved.

Introduction

Components of a Team ProjectTeamwork is a skill that is needed in the 21st century workplace. Throughout this course you will be asked to work with others on a team. Each team will work on assignments and projects. As a team, your success is dependent on many things including:• Common goal• Shared responsibility • Equal participation• Regular meetings• Clear roles• Clear and defined tasks

32Copyright © 2012, Oracle. All rights reserved.

Introduction

Standards for Team SuccessImagine this: Your team has begun work on an animation project and you have been tasked with writing the animation's scenario. After hours of thinking and writing, you have created the scenario and are ready to present it to your team.

How will you know if you're work will meet the expectations of your teammates, and be well received?

33Copyright © 2012, Oracle. All rights reserved.

Introduction

Standards for Team Success (cont.)To ensure success, a team will define a rubric, a set of rules that clearly define its definition of success. Students will be graded based on how their performance matches the rubric criteria. Both the team and its individuals will review the rubric for evaluation and reflection.

A rubric is a team defined set of rules and standards used for project assessment. If followed, the rubric will aid in meeting the team's criteria for success.

34Copyright © 2012, Oracle. All rights reserved.

Introduction

Standards for Team Success (cont.)Below is a sample team assessment rubric.

4 (highest) 3 2 1 (lowest)

Contributions Always... Usually Sometimes... Rarely...

Problem Solving Always Usually Sometimes Rarely

Attitude Always Usually Sometimes Rarely

35Copyright © 2012, Oracle. All rights reserved.

Introduction

JournalJournaling is a learning tool most commonly used in writing and history classes. It can also be very helpful when coding and developing software. For example, you can use a software journal to: • Summarize new concepts• Track changes and discoveries • Solve problems • Consider varying perspectives• Track ideas for future implementation

One of the best things about using a journal in a programming class is that you can see your academic and personal growth by reading past entries.

36Copyright © 2012, Oracle. All rights reserved.

Introduction

Journal (cont.)In this course, your journal will take the form of a “cookbook.” You will add “recipes” to your “cookbook” as you learn new concepts and code.• Keep a recipe for each lesson or new concept• Make your recipes easy to follow by others• Recipes are your main study guide for the AP or

Oracle Certification Exam

37Copyright © 2012, Oracle. All rights reserved.

Introduction

Journal (cont.)Your “cookbook” must be kept current and will include:• An index• Recipe titles• Recipe images• Important objectives and vocabulary• Steps to reproduce

38Copyright © 2012, Oracle. All rights reserved.

Introduction

Code of EthicsYou are a member of society. • As a member, you are expected to follow certain rules,

or laws, that the society agrees are either acceptable or unacceptable.

• All societies rely on its citizens to abide by ethics, or moral principals.

• Cyber ethics is a code of behavior for using the Internet.

39Copyright © 2012, Oracle. All rights reserved.

Introduction

Code of Ethics (cont.)Cyber Ethics - Do's and Don'ts

Do Don'tDo use the Internet to help you do your schoolwork.

Don't copy information from the Internet and call it your own.

Do use the Internet to learn about music, video and games.

Don't use the Internet to download or share copyrighted material.

Do use the Internet to communicate with friends and family.

Don't use the Internet to communicate with strangers.

Don't pretend to be someone else. Don't be rude or use bad language. Don't give anyone personal information or passwords.

40Copyright © 2012, Oracle. All rights reserved.

Introduction

Code of Ethics (cont.)The Institute of Electrical and Electronics Engineers (IEEE):• is a global association dedicated to the advancement of

technology and innovation. • publishes the IEEE Code of Ethics, a commitment to the

highest ethical and professional conduct.

41Copyright © 2012, Oracle. All rights reserved.

Introduction

Code of Ethics (cont.)Summary of the IEEE Code of Ethics • Accept responsibility for decisions• Mitigate conflicts of interest (i.e., corruption)• Be honest• Educate others on the best use of technology• Continuously improve one's work• Always credit contributions to one's work• Treat everyone fairly and with respect• Never cause harm to your peers; rather, assist and

support them

42Copyright © 2012, Oracle. All rights reserved.

Introduction

Cyber SecurityHave you ever heard of a computer virus?

A computer virus is a form of a cyber attack, a method used to gain control of another computer, or group or computers without permission. Other examples of cyber attacks are:• Identity theft• Spamming• System infiltration

A computer virus is a program created by an unethical individual or group of Individuals with the sole intent of damaging as many computers as possible.

43Copyright © 2012, Oracle. All rights reserved.

Introduction

Cyber Attacks and Cyber SecurityMost computers prevent cyber attacks by using virus scanning software. Large organizations (even governments) rely on cyber security teams to define processes that will avoid a cyber attack.

Examples of cyber security are:• Don't share passwords• Keep anti-virus software up-to-date• Only open emails from trusted sources• Never provide personal information (phone number, last

name) on websites, including social media sites

Cyber security is the establishment of processes with the sole objective of mitigating cyber attacks.

44Copyright © 2012, Oracle. All rights reserved.

Introduction

TerminologyKey terms used in this lesson included:Object-oriented programming3 dimensional (3D) and 2 dimensional (2D)Virtual world StateBehaviorClassRubricCyber ethicsCyber security

45Copyright © 2012, Oracle. All rights reserved.

Introduction

SummaryIn this lesson, you learned how to: • Describe the purpose for using Alice 3 and Greenfoot

tools to learn Java• Describe the skills used to generate an animation or

create a game• Describe the components of a team project• Create a teamwork assessment rubric• Describe the purpose for creating a journal to

document programming projects• Describe the code of ethics and cyber security

46Copyright © 2012, Oracle. All rights reserved.

Introduction

PracticeThe exercises for this lesson cover the following topics:• Playing a sample game in Greenfoot• Identifying objects, states and behaviors• Creating a scenario • Creating a team rubric • Reviewing IEEE code of ethics and relate to school

group projects• Discussing cyber security and its impact to your

country