Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introducing Java CSC1401. Course Goals Teaching programming concepts In a “real” language.

Similar presentations


Presentation on theme: "Introducing Java CSC1401. Course Goals Teaching programming concepts In a “real” language."— Presentation transcript:

1 Introducing Java CSC1401

2 Course Goals Teaching programming concepts In a “real” language

3 Course Approach Alternate between Alice and Java as we learn programming concepts Some concepts we’ll explore first in Alice Others we’ll explore first in Java The problem of Java It’s hard We’ll use specially created graphics libraries to help us

4 Java libraries What is a Java library? It’s just a class or several classes In Alice, classes were located Local Gallery CD Gallery Web Gallery In Java, we’ll need to tell the computer where to find the classes Setting the classpath (this is the directory where the classes will be located) Or, using an import statement in our Java program We’ll see how to do this in lab on Friday

5 Important object-oriented concepts Class Object Method Parameter Sequencing (Do in order vs. Do together) Design

6 Alice Java similarities We are going to find that Alice and Java are quite similar, and that concepts learned in one language immediately apply to the other There are some differences, mostly mechanical, between the 2 languages

7 Some differences between Java and Alice Alice uses a drag and drop editor Java has Integrated Development Environments (IDEs) that generally require typing code. We’ll be using one called JGrasp

8 Alice-Java Differences Classes are found in the local gallery, the CD gallery, or the web gallery Classes can be located anywhere, but you need to tell the computer where they are

9 Alice-Java Differences The main program is generally world.my first method The main program is generally public static void main (String [] args)

10 Alice-Java Differences In Alice, objects are added to a world by dragging them and dropping them into position In Java, we use the new keyword. We also use the constructor to specify such things as where to place them.

11 Alice-Java Differences In Alice each method is located on a separate window – but you can export all of the dragon’s methods into a single html file In Java, all of the methods for a single class are in one window

12 Alice – Java Differences File names always end in.a2w (and sometimes.a2c) File names always end in.java

13 Alice-Java Differences To run an Alice program, just click on the play button Running a Java program is a 2-step process: 1)Click on compile. This will make sure you don’t have any typos and generates a.class file 2)Click on Run

14 Alice-Java differences In Alice, an object’s methods are located in the object pane at the lower left of the screen In Java, we need to look at an html file (called Javadoc- short for Java documentation) to see an object’s methods

15 Alice – Java differences In Alice most objects (except for billboards) are 3D In Java, most of our objects will be 2D. Java supports 3D, but it’s much harder to program.

16 Java Example: Turtles We will work with Turtles in a World in Java We do this by writing a Turtle class definition Turtle.java We compile it to convert it into something the computer can understand Bytes codes for a virtual machine Turtle.class

17 History of Turtles Seymour Papert at MIT in the 60s By teaching the computer to do something the kids are thinking about thinking Develop problem solving skills Learn by constructing and debugging something Learn by making mistakes and fixing them

18 JGrasp Demo Opening a new Java file

19 Using Turtles Add bookClasses to your classpath to use these classes

20 Telling JGrasp where to find the Turtle class

21 Classpath part 2 Then click on OK Then click on Apply Then click OK →

22 Turtle Demo Writing a Turtle program class public static void main(String [] args) {} versus ; // and /* new Compiling and running and stopping Looking at the Javadoc

23 Assignment Read Media Computation Chapter 3, Sections 1 through 5 Classes Objects Methods


Download ppt "Introducing Java CSC1401. Course Goals Teaching programming concepts In a “real” language."

Similar presentations


Ads by Google