Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Types and the Class Diagram/First Look at Code1-22-2010Opening Discussion●Recipes vs. algorithms–Specificity (add eggs)●Humans read recipies–Simplicity/logic–Making the objects/ingredients●How do you program the selector so you don't have to move it manually?Greenfoot Class Diagram●You might have wondered some about the area in Greenfoot that shows you classes and why it is organized the way it is.●The organization relates to the type system in Java.●Arrows represent an is-a relationship.Inheritance/Subtyping●In programming we call this type of relationship inheritance because the subclass gets all the things in the superclass.●It also provides subtyping. This means that anyplace where you use the supertype, any subtype can be substituted.●Greenfoot is programmed to work with Actors in general. It will work with any subtype of actor as well.First Look at Java●Now we will take our first look at real Java code. You can look at the program behind any class by double clicking on the class. This brings up an editor window.●Java programs can be edited with any text editor. Word is not a text editor. Notepad is.●Let's start with the Leaf class in PSPGWombat.●Now the Wombat class.Structure and Punctuation●When looking at the code you will see certain patterns.●There is a lot more punctuation than normal English, including parentheses and braces.●These things matter. The language is specific. If something is missing the code won't compile and nothing happens.Minute Essay●Do you have any questions about the material we discussed
View Full Document