Sie sind auf Seite 1von 48

Java Fundamentals

Introduction

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Overview
This lesson covers the following topics:
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
g
Describe the components of a team project
Create a teamwork assessment rubric
Describe the purpose for creating a journal to document
programming projects
Describe
D
ib th
the code
d off ethics
thi and
d cyber
b security
it
2

Copyright 2012, Oracle and/or its affiliates. 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
g Alice 3 yyou can create animations with 3D objects
j
that move and act.
Because Alice 3 lets the p
programmer
g
manipulate
p
objects,
j
it is
considered object-oriented programming (OOP).

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

3D Objects
Alice 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.

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Virtual World
You 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.
5

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

3D World Example
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

Background
T
Template
l t
Actor Object

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to 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.

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to Locate the Example Animation File


1. From the dialog box, select the File System tab.
2. Click the Browse button.
3. Search for and select the greetings.a3p
greetings.a3p file from the location you
saved it in on your computer.
4. Click the Open button from the dialog box.
5 Click
5.
Cli k the
th OK button
b tt from
f
the
th dialog
di l box.
b
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 an
issue with your version of Alice, watch the corresponding video.

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Run the Animation


To run an animation, click the Run button in the world
window.

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Greenfoot
An interactive game is one that involves human
interactions, decisions, and actions. Using Greenfoot, you
can add objects and program their actions to create an
interactive game.
Because Greenfoot
B
G
f t lets
l t th
the programmer manipulate
i l t objects,
bj t it iis
considered object-oriented programming (OOP).

10

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

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

11

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

High-level Steps to Play a Greenfoot Game


1. Launch Greenfoot.
2. Open the game file.
3. Set up the objects in the game.
4. Play the game.

12

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to Launch Greenfoot


1. Locate the Greenfoot icon on your desktop.
2. Double click the Greenfoot icon to launch the program.

13

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to Open the Greenfoot Game File


1. Download the flying_frog example from the lessons Videos page
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
4.
box. The game should
display.
If this
thi iis th
the fi
firstt ti
time Greenfoot
G
f t is
i llaunched
h d on your machine,
hi
you
may be prompted for a decision. Select Scenario Open from the
menu.

14

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to Set Up the Games Objects


1. Place objects in the world that will interact in the game.
A.
B.

Click once on the Frog class.


Hold the Shift key down on your keyboard while you click and hold
the Frog class.
C. Drag the Frog object onto the World.

2. Repeat step 1 to add objects from the Fly class.

15

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to Play the Game


1. Click the Run button.
2. Steer the Frog using your keyboards arrow keys.
3. Have the frog eat the fly!
4. Add more flies to the game to make it more interesting.

16

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Greenfoot Objects
Look around you. Undoubtedly, you will see many objects.
Your classmates are even objects!
Similar to Alice 3
3, you will use Greenfoot to create a
world that contains objects. The objects have states
(descriptors) and behaviors (actions).
Example: Classmate
States can include: Name, ethnicity, and hair color
Behaviors can include: Talking
Talking, walking
walking, and running
running.
All objects have two characteristics: states and behavior.

17

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Greenfoot Classes
Every 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.

Color= Red
Speed= 10 MPH
Speed

18

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Wheels = 2

Introduction

Greenfoot Objects and Classes Example


Here is an example of a Greenfoot world with objects.
The Frog and Fly objects are subclasses of the Animal
class.

Object

Classes

Object

19

Copyright 2012, Oracle and/or its affiliates. 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
p yyou learn
programming concepts and how to program in Java?

20

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Why Learn Alice 3?


Alice 3 offers a good introduction to learning how to
program for many reasons:
It uses natural English language words like move
move
forward or turn left rather than obscure programming
syntax.
You drag and drop objects on the screen and press
Run to run your animation rather than using the
keyboard to type
type.
When you make a mistake in Alice 3, it is usually
obvious how to fix it. In programming languages, it is
often difficult to interpret error messages.
21

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Why Learn Alice 3? (cont.)


Alice 3 offers a good introduction to learning how to
program for many reasons:
When you program in Alice 3,
3 it is like being a movie
director.
Alice 3 allows yyou to learn fundamental p
programming
g
g
concepts in the context of creating animated movies and
simple video games.
By manipulating the objects in a virtual world
world, you can
gain experience with many of the programming
constructs typically taught in an introductory
programming course.
22

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Why Learn Alice 3? (cont.)


Alice 3 offers a good introduction to learning how to
program for many reasons:
Programming in Alice 3 is fun!

23

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Why Learn Greenfoot?


Greenfoot is a good introduction to programming for
several reasons:
It teaches the basics of Java syntax and object
orientation which makes developing desktop Java
applications easier than starting from scratch.
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
debug,
IDE s.

24

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Skills Needed to Generate Animations and


Games
Alice 3 and Greenfoot will help you learn to program in
Java. In order to use Alice 3 and Greenfoot to create
animations and games, you need to learn certain skills.

25

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Steps to Create an Animation or Game


1. Define a scenario.
A. What story is to be told?
B. What objects are needed?
C. What actions will take place?

2. Design the storyboard for the scenario.


A.

Visual, textual, or both.

3. Create the animation in Alice 3 or game in Greenfoot.


4. Test the animation or game.

26

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Define a Scenario
A 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 to play.
A scenario is a story in the form of a problem to solve or task to
perform.
27

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Parts of a Scenario
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
them.
Objects: The objects you will use in your story. For
example,
p a frog
g and flies.
Actions: All the actions the objects will take.
For example: The frog will fly using arrow keys while the
fli move about
flies
b t randomly.
d l Wh
When th
the ffrog ttouches
h a flfly, th
the
fly is removed from the screen.

28

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Scenario Example

Scenario Element

Description

Story

A boy says hello to his friend


friend. His friend waves at him
and says hello back.

Objects

Two children (two males, or one male and one female)


and two trees.

Actions

Result

29

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Boy looks at his friend and says, Hello.


F i d says H
Friend
Hello
ll and
d waves b
back
k att hi
him.
Using Alice 3, we have told a simple story about two
friends greeting each other.

Introduction

Components of a Team Project


Teamwork is a skill that is needed in the 21st century
workplace.
Throughout this course, you will work on projects and
assignments
g
in teams.

30

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Components of a Team Project (cont.)


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

31

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Standards for Team Success


Imagine this:
Your team has begun work on an animation project and
you have been tasked with writing the animation's
animation s
scenario.
After hours of thinking
g and writing,
g yyou have created the
scenario and are ready to present it to your team.
How will you know if your work will meet the expectations
of your teammates, and be well received?

32

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Use a Rubric to Define Team Success


To ensure success, a team will define a rubric to assess
how the team performed.
Students will be graded based on how their performance
matches the rubric criteria.
The team and its individual members will review the
rubric for evaluation and reflection.
A rubric is a team-defined
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.

33

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Team Assessment Rubric Example

4 (Highest)

1 (Lowest)

Always

Usually

Sometimes

Rarely

Always

Usually

Sometimes

Rarely

Always

Usually

Sometimes

Rarely

Contributions

Problem
Solving
Attitude

34

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Journal
Journaling 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,
p yyou can use a software jjournal to:
Summarize new concepts.
Track changes and discoveries.
Solve problems.
Consider varying perspectives.
Track ideas for future implementation.
35

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Read Past Journal Entries


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

36

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Journal Cookbook
In this course, your journal will take the form of a
cookbook.
You will add recipes to your cookbook as you learn
new concepts
p and code.
Keep a recipe for each lesson or new concept.
Make your recipes easy to follow by others.
Use the recipes as your main study guide for the AP or
Oracle Certification Exam.

37

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Journal Components
Your journal cookbook must be kept current and will
include:
An index
Recipe titles
Recipe images
Important objectives and vocabulary
p to reproduce
p
Steps

38

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Code of Ethics
You are a member of society.
As a member, you are expected to follow certain rules,
or laws,
laws that the society agrees are either acceptable or
unacceptable.
All societies relyy on its citizens to abide byy ethics, or
moral principals.
Cyber ethics is a code of behavior for using the Internet.

39

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Cyber Ethics Dos and Donts

Do

Dont

Do 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
passwords.

40

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

IEEE Code of Ethics


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.

41

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

IEEE Code of Ethics Summary


Summary of the IEEE Code of Ethics:
Accept responsibility for decisions.
Mitigate
Miti t conflicts
fli t off interest
i t
t (i.e.,
(i
corruption).
ti )
Be honest.
Educate others on the best use of technology.
technology
Continuously improve one's work.
Always credit contributions to one's
one s work
work.
Treat everyone fairly and with respect.
Never cause harm to yyour peers;
p
; rather,, assist and
support them.
42

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Computer Viruses
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.
possible
43

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Cyber Attacks and Cyber Security


Most computers prevent cyber attacks by using virus
scanning software.
Large organizations (even governments) rely on cyber
securityy teams to define p
processes that will avoid a cyber
y
attack.

44

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Cyber Security Practices


Examples of cyber security practices:
Don't share passwords.
Keep
K
anti-virus
ti i
software
ft
up-to-date.
t d t
Only open emails from trusted sources.
Never provide personal information (phone number
number, last
name) on websites, including social media sites.
Cyber
C
b security
i iis the
h establishment
bli h
off processes with
i h the
h sole
l
objective of mitigating cyber attacks.

45

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Terminology
Key terms used in this lesson included:
Object-oriented programming
3 di
dimensional
i
l (3D) and
d 2 di
dimensional
i
l (2D)
Virtual world
State
Behavior
Class
Rubric
Cyber
y
ethics
Cyber security
46

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Summary
In this lesson, you should have 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
g
Describe the components of a team project
Create a teamwork assessment rubric
Describe the purpose for creating a journal to document
programming projects
Describe
D
ib th
the code
d off ethics
thi and
d cyber
b security
it
47

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Introduction

Practice
The exercises for this lesson cover the following topics:
Playing a sample game in Greenfoot
Identifying
Id tif i objects,
bj t states
t t and
d behaviors
b h i
Creating a scenario
Creating a team rubric
Reviewing IEEE code of ethics and relate to school
group
g
pp
projects
j
Discussing cyber security and its impact to your country

48

Copyright 2012, Oracle and/or its affiliates. All rights


reserved.

Das könnte Ihnen auch gefallen