Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "A High Flying Overview CS139 – Fall 2010 How far we have come."— Presentation transcript:

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

2 We started with the notion of an algorithm

3 Algorithm A step by step process for solving a problem in a finite amount of time given a finite amount of data. A step by step process for solving a problem in a finite amount of time given a finite amount of data.

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

5 Algorithm structures Sequencing Sequencing Decisions Decisions Loops Loops Abstraction (separate procedures) Abstraction (separate procedures) Abstraction (separate classes) Abstraction (separate classes)

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

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

8 And performed operations on them addition assignment subtraction multiplication division

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

10

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

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

13 We got to know and love Scanner // consume the new line // consume the new line More runtime errors More runtime errors and output and output and printf (%s, %f, %d, %c) and printf (%s, %f, %d, %c)

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

15 And we played with the Stars and Planets

16 Then came abstraction We learned that we can break code up and refer to a segment of code by a single name. We learned that we can break code up and refer to a segment of code by a single name. Functions provided a way to reuse code; write once, use any number of times. 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. We also learned that we can create an application with multiple classes. Qualified names let us link all of these pieces together. Qualified names let us link all of these pieces together.

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

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

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

20 And of course we had a PA to go along with functions we had a PA to go along with functions Hangman.java Hangman.java

21 and we learned lots of new terms formal parameterargument visibility modifyer static qualified name return statement return type

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

23 We saw Stars! * *** ***** ******* ********* ******* ***** *** * ********** ******** ******* ****** ***** **** *** ** * ** *** **** ***** ****** ******* ******** ********* **********

24 And yet another PA

25 Objects class – blueprint class – blueprint object – specific house object – specific house

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

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

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

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

30 And what can we see between classes PrivatePublic

31 And another PA

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

33 and the last pa

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

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

36 Tomorrow’s exam You will have a starter file You will have a starter file You will have to fill in method code You will have to fill in method code You MUST read the documentation for each method that you are to code You MUST read the documentation for each method that you are to code Strategies Strategies read through all of the methods in the class…some may already be built that can help you…some you may build could help you with others. read through all of the methods in the class…some may already be built that can help you…some you may build could help you with others. Work through what you are clearest on first. Then go on to the others Work through what you are clearest on first. Then go on to the others Build stubs so that you can compile as you go along. Compiling will help you find silly mistakes Build stubs so that you can compile as you go along. Compiling will help you find silly mistakes Review the labs from Color139 through to the end of the semester. Make sure you understand what each method does and how it is coded. Review the labs from Color139 through to the end of the semester. Make sure you understand what each method does and how it is coded. Pay attention to input parameters and returns. Pay attention to input parameters and returns. You may start 5 minutes before your section begins and stay for 5 minutes after. You may start 5 minutes before your section begins and stay for 5 minutes after.

37 Now onto the rest of the review


Download ppt "A High Flying Overview CS139 – Fall 2010 How far we have come."

Similar presentations


Ads by Google