JF_V02_S01_L02_διαβασμενο

48
Java Fundamentals Introduction Introduction 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

description

java

Transcript of JF_V02_S01_L02_διαβασμενο

  • Java FundamentalsIntroductionIntroduction

    1 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 Javatools to learn Java Describe the skills used to generate an animation or

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

    programming projectsD ib th d f thi d b it

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

    Describe the code of ethics and cyber security

    nikTypewritten text

    nikTypewritten texta scoring rubric is a set of criteria and standards typically linked to learning objectives

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

  • 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.illusion of movement.

    Using Alice 3 you can create animations with 3D objects g y jthat move and act.

    Because Alice 3 lets the programmer manipulate objects, it is p g p jconsidered object-oriented programming (OOP).

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

    nikTypewritten text

    nikHighlight

  • 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.virtual world.

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

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

    nikHighlight

    nikHighlight

  • 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: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 Background Template: a background onto which you place both setting and actor objects.

    A virtual world contains 3D objects and simulates a real or

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

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

    nikHighlight

    nikHighlight

    nikHighlight

    nikHighlight

    nikHighlight

  • 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 backgroundsetting and actor objects as well as a background template.

    Setting Object

    Background T l tTemplate

    Actor Object

    6 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.3. A dialog box will display Alice templates.

    7 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 file from the location you3. 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 Cli k th OK b tt f th di l b5. 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 an issue with your version of Alice, watch the corresponding video.

    8 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.

    9 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 ancan add objects and program their actions to create an interactive game.

    B G f t l t th i l t bj t it iBecause Greenfoot lets the programmer manipulate objects, it is considered object-oriented programming (OOP).

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

    nikHighlight

    nikHighlight

  • Introduction

    Greenfoot Interface

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

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

    nikHighlight

  • 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.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 The game should4. Click the Open button from the dialog box. The game should

    display.

    If thi i th fi t ti G f t i l h d hi If this is the first time Greenfoot is launched on your machine, 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. Click once on the Frog class. B. 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!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 you will use Greenfoot to create a Similar to Alice 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 walking and running Behaviors can include: Talking, walking, and running.

    All objects have two characteristics: states and behavior.

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

    nikTypewritten text

    nikHighlight

    nikHighlight

    nikHighlight

    nikHighlight

  • 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 allThe class will define the general characteristics for all bicycle objects within that class.

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

    Wheels = 2

    Color= Red

    Speed= 10 MPH

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

    Speed 10 MPH

    nikHighlight

    nikHighlight

  • 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.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?programs are included in this course?

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

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

    nikHighlight

    nikHighlight

    nikHighlight

  • 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 It uses natural English language words like 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 typekeyboard to type.

    When you make a mistake in Alice 3, it is usually obvious how to fix it. In programming languages, it is

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

    often difficult to interpret error messages.

    nikHighlight

    nikHighlight

    nikHighlight

    nikHighlight

  • 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 it is like being a movie When you program in Alice 3, it is like being a movie

    director. Alice 3 allows you to learn fundamental programming y p g g

    concepts in the context of creating animated movies and simple video games. By manipulating the objects in a virtual world you can By manipulating the objects in a virtual world, you can gain experience with many of the programming constructs typically taught in an introductory

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

    programming course.

    nikHighlight

    nikHighlight

    nikHighlight

    nikHighlight

  • 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! 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 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'sdebug, just like in other Java IDE s.

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

    nikHighlight

    nikHighlight

  • 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 to create animations and games, you need to learn certain skills.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.

    nikHighlight

  • 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 willprogram 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.

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

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

  • 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 themflying frog will catch flies and eat them. Objects: The objects you will use in your story. For

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

    For example: The frog will fly using arrow keys while the fli b t d l Wh th f t h fl thflies move about randomly. When the frog touches a fly, the fly is removed from the screen.

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

    nikHighlight

    nikHighlight

    nikHighlight

  • Introduction

    Scenario Example

    Scenario Element Description

    A boy says hello to his friend His friend waves at himStory 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) Objects and two trees.

    ActionsBoy looks at his friend and says, Hello.

    F i d H ll d b k t hiFriend says Hello and waves back at him.

    Result Using Alice 3, we have told a simple story about two friends greeting each other.

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

  • 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 in teams. g

    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 Common goal Shared responsibility Equal participationEqual participation Regular meetings Clear roles Clear and defined tasks

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

    nikTypewritten text

  • 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'syou have been tasked with writing the animation s scenario.

    After hours of thinking and writing, you have created the g g yscenario 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 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 set of rules and standards used forA 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.

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

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

  • Introduction

    Team Assessment Rubric Example

    4 (Highest) 3 2 1 (Lowest)Contributions

    Always Usually Sometimes Rarely

    Problem Solving Always Usually Sometimes Rarely

    AttitudeAlways Usually Sometimes Rarely

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

    nikTypewritten text

    nikTypewritten text

  • 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.when coding and developing software.

    For example, you can use a software journal to: p y j Summarize new concepts. Track changes and discoveries. Solve problems. Consider varying perspectives.

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

    Track ideas for future implementation.

    nikTypewritten text

    nikHighlight

    nikHighlight

    nikTypewritten text

    nikTypewritten text

  • 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.entries to see your academic and personal growth.

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

    nikTypewritten text

  • 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 and code.p 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.

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text-

  • Introduction

    Journal Components

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

    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 that the society agrees are either acceptable oror laws, that the society agrees are either acceptable or unacceptable.

    All societies rely on its citizens to abide by ethics, or y ymoral principals.

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

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

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

  • Introduction

    Cyber Ethics Dos and Donts

    Do DontDo use the Internet to help you do your Don't copy information from the Internet schoolwork. 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 Don't use the Internet to communicateDo 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

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

    or passwords.

  • Introduction

    IEEE Code of Ethics

    The Institute of Electrical and Electronics Engineers (IEEE):

    Is a global association dedicated to the advancement of 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.

    nikTypewritten text .

    nikTypewritten text IEEE , .

  • Introduction

    IEEE Code of Ethics Summary

    Summary of the IEEE Code of Ethics: Accept responsibility for decisions.

    Miti t fli t f i t t (i ti ) Mitigate conflicts of interest (i.e., corruption). Be honest. Educate others on the best use of technology Educate others on the best use of technology. Continuously improve one's work. Always credit contributions to one's workAlways credit contributions to one s work. Treat everyone fairly and with respect. Never cause harm to your peers; rather, assist and

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

    y p ; ,support them.

    nikTypewritten text

    nikTypewritten text . (, ). .

    nikTypewritten text

  • 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 cybercomputers 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

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

    computers as possible.

    nikTypewritten text

    nikTypewritten text

    nikTypewritten text

  • Introduction

    Cyber Attacks and Cyber Security

    Most 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 y p yattack.

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

  • Introduction

    Cyber Security Practices

    Examples of cyber security practices: Don't share passwords.

    K ti i ft t d t Keep anti-virus software up-to-date. Only open emails from trusted sources. Never provide personal information (phone number last Never provide personal information (phone number, last

    name) on websites, including social media sites.

    C b i i h bli h f i h h lCyber security is the establishment of processes with the sole objective of mitigating cyber attacks.

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

    nikTypewritten text .

  • Introduction

    Terminology

    Key terms used in this lesson included: Object-oriented programming

    3 di i l (3D) d 2 di i l (2D) 3 dimensional (3D) and 2 dimensional (2D) Virtual world State State Behavior ClassClass Rubric Cyber ethics

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

    y Cyber security

  • Introduction

    Summary

    In this lesson, you should have learned how to: Describe the purpose for using Alice 3 and Greenfoot

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

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

    programming projectsD ib th d f thi d b it

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

    Describe the code of ethics and cyber security

  • Introduction

    Practice

    The exercises for this lesson cover the following topics: Playing a sample game in Greenfoot

    Id tif i bj t t t d b h i Identifying objects, states and behaviors Creating a scenario Creating a team rubric Creating a team rubric Reviewing IEEE code of ethics and relate to school

    group projectsg p p j Discussing cyber security and its impact to your country

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