Presentation is loading. Please wait.

Presentation is loading. Please wait.

Concepts From Alice Switching to Java Copyright © 2006-2017 Curt Hill.

Similar presentations


Presentation on theme: "Concepts From Alice Switching to Java Copyright © 2006-2017 Curt Hill."— Presentation transcript:

1 Concepts From Alice Switching to Java Copyright © Curt Hill

2 Concepts We Have Seen Concepts
Objects Looping statements Blocks Concurrency Variables Bugs We should have seen the equivalent Java code for Alice statements Copyright © Curt Hill

3 The Process Programming is bossing the machine around
Making it do what you want When it does not do what you intended it is a bug A program is a sequence of statements that accomplish this There are many little details that must be right for good results Copyright © Curt Hill

4 Objects A self contained piece of code Methods, properties, events
An object may be composed of smaller objects We may do things to the larger object We may also do things to the contained objects Copyright © Curt Hill

5 More on Objects Alice objects are obtained from gallery
We may drag in an object more than once In Java we have classes and objects An object being an instance of a class The Java library is much larger than the Alice gallery Often we specify the portion of the library that contains the class we need Copyright © Curt Hill

6 Variables An item that may contain a value Two kinds in Java
Primitive types contain simple things like an integer or character Similar to Alice parameter values Objects Contains values and methods Values may be primitive or other objects Copyright © Curt Hill

7 Decision statements Java decision statements are actually easier to create than those of Alice Type rather than drag and drop Two types of decision If Similar to Alice Based on boolean Switch case Multi-way decision Copyright © Curt Hill

8 Looping statements There are three loops in Java compared to two in Alice The for is the counting loop Most similar to the Loop of Alice The while of Java is similar to the Alice while The do of Java is a trailing decision loop There are no trailing decision loops in Alice Copyright © Curt Hill

9 Blocks The statements of a Do Together, Do In Order, If, Loop etc. form a block A block is a container that holds one or more statements Bundles these together as one The Java block is just a pair of braces { } It is stronger than that of Alice Copyright © Curt Hill

10 Concurrency Java handles concurrency very well for a language
It is not nearly as easy to use as in Alice It is unlikely that we will cover in this class The important terms in Java are: thread runnable interface Copyright © Curt Hill

11 Event Handling An event is some action that occurs at an unpredictable time A user types a key Event handling is the action that a program does in response to the event We will likely see event handling in regards to a user clicking a button in Java Copyright © Curt Hill

12 Environment In early programming languages the entire program was typed Today we usually use a combination Drag and drop Used to design the window Initialize event handling Typing Enter the central logic of the program Copyright © Curt Hill

13 Java Environment There are many, some are even free
We will use Eclipse Java SE You should download this soon Even as you are still working on the Alice program Copyright © Curt Hill

14 Finally This concludes our short detour through Alice
Alice shows all the features of a general purpose language Since you are able to create Alice programs you are also able to create Java programs Even if it is not quite as fun or easy Copyright © Curt Hill


Download ppt "Concepts From Alice Switching to Java Copyright © 2006-2017 Curt Hill."

Similar presentations


Ads by Google