1 / 34

A High Flying Overview

A High Flying Overview. CS139 – Fall 2010 How far we have come. We started with the notion of an algorithm. A step by step process for solving a problem in a finite amount of time given a finite amount of data. Good algorithms. Require thought – and reading all of the words And are: Simple

rreynoso
Download Presentation

A High Flying Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A High Flying Overview CS139 – Fall 2010 How far we have come

  2. We started with the notion of an algorithm A step by step process for solving a problem in a finite amount of time given a finite amount of data.

  3. Good algorithms • Require thought – and reading all of the words • And are: • Simple • Precise • Correct • Complete • Have levels of abstraction

  4. Algorithm structures • Sequencing • Decisions • Loops • Abstraction (separate procedures) • Abstraction (separate classes)

  5. We learned about our lab environment mount-n Novell – n-drive submit Lab 248 Lab 250 stu – Linux?

  6. We made containers And learned that there were different kinds that hold different data Constant numbers Strings (why is this capital?) variable letters simple (value) literal complex (several values)

  7. And performed operations on them addition division subtraction assignment multiplication

  8. And then we were ready to build our first program public class Hello { public static void main(String args[]) { System.out.println(“Hello World”); } }

  9. But that was just the start • Containers became variables, literals, and constants • Operations became expressions • Our programs began to really do something. • Remember me? PA1 (Change Maker)

  10. Of course that is when we also learned about • documentation • and the dreaded submit • and of course we had to relearn division • 3 / 6 is not .5 • 3 % 6 is not something to do with percentages. • compile time errors • run time errors • logic errors

  11. We got to know and love Scanner • // consume the new line • More runtime errors And output • System.out.print( “ blah “ + “blah”); • and printf (%s, %f, %d, %c)

  12. Then came abstraction • We learned that we can break code up and refer to a segment of code by a single name. getAverage(5, 7, 9) • Functions provided a way to reuse code; write once, use any number of times. • We also learned that we can create an application with multiple classes. • Qualified names let us link all of these pieces together.

  13. Passing 5 to the displayValue Method The argument 5 is copied into the parameter variable num. displayValue(5); public static void displayValue(int num) { System.out.println(“The value is “ + num); } The method will display The value is 5

  14. And we played with Physics

  15. We also began to explore object oriented programming • We began to use “classes” in a more purposeful way. • We began to look at the “services” provided by java classes. • Scanner • System.out • Random • Math

  16. variable = new ObjectName() constructor keyboard = Scanner (System.in) new instantiation

  17. and we learned lots of new terms formal parameter return type argument visibility modifyer static return statement qualified name

  18. Then we added decisions else if(boolean expression) &&, ||, == { } switch & case break; MadLibs.java:56: 'else' without 'if’ and new error messages

  19. And of course, PA3

  20. On to the last of our “procedural” structures • But of course not least…bring on the loops. 4 while pre for do/while infinite loop loop control variable off by one error post

  21. We saw Stars! * *** ***** ******* ********* ******* ***** *** * ********** ******** ******* ****** ***** **** *** ** * * ** *** **** ***** ****** ******* ******** ********* **********

  22. And yet another PA

  23. Then we learned to make objects • class – blueprint • object – specific house

  24. and more terms • members • attribute • method • visibility modifiers again • this • static • instantiation • constructor • overloading • mutator • accessor • immutable • mutable

  25. We learned to hand trace methods and objects • Back to containers on a desk. • Each container holds its current value. • We must change the value as it changes during program execution • Each container must be identified with its scope. • And about scope….

  26. block scope • inside {} • local - inside method { } • global – inside class { } • visibility is controlled by where the declaration is made. • Careful for (….);

  27. And even further “scope” • static – belongs to the class • non-static – belongs to individual objects of the class • static = 1 container named by the class • non-static = 1 container per object

  28. And what can we see between classes Private Public

  29. And another PA

  30. and finally arrays • subscripted variable • reference type • arr1[3] • One name, many items • Collections • loops – for each loop • index

  31. and the last pa

  32. Think about how far we have come • And how much you have learned. • What was hard is now easy. • What is now hard will continue to become easy.

  33. Next semester in no particular order Abstract Classes Interfaces Polymorphism Recursion and much much more… • Objects, more and more • Inheritance • Input and output • Exceptions • Enumerated Types

  34. Tomorrow’s exam • Will be much like a normal exam but the focus is on objects and arrays. • Should be about the same length as other midterms • Will include no big coding (but will likely include “small” coding).

More Related