Docsity

Data Structures with Java Course at University of New Mexico - Prof. Joel Castellanos, Study notes of Computer Science

Toggle sidebar
bg1
1
CS-259
Data Structures with Java
Data
Structures
with
Java
Welcome
Instructor: Joel Castellanos
8/28/2009
web: http://cs.unm.edu/~joel/
Course website:
http://cs.unm.edu/~joel/cs259/
Introductions
Your Name
Your Background in Computer
Your
Background
in
Computer
Programming: quickBasic,
Visual Basic FORTRAN, C, C++,
or hours and hours of WoW.
UNM major, intended major, just taking one
class
2of 19
class
....
Why you are taking this class and what you
expect to get from it.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Data Structures with Java Course at University of New Mexico - Prof. Joel Castellanos and more Study notes Computer Science in PDF only on Docsity!

CS-

Data Structures with JavaData Structures with Java

Welcome

Instructor: Joel Castellanos e-mail : [email protected]

8/28/

web: http://cs.unm.edu/~joel/

Course website: http://cs.unm.edu/~joel/cs259/

Introductions

„ Your Name

„„ Your Background in ComputerYour Background in Computer

Programming: quickBasic,

Visual Basic FORTRAN, C, C++,

or hours and hours of WoW.

„ UNM major, intended major, just taking one

class

2 of 19

class....

„ Why you are taking this class and what you

expect to get from it.

Course Resources

Class website: http://cs.unm.edu/~joel/cs259/ „ Syllabus „ Lecture Notes „ Supplemental readings Textbook: Core Java, Volume I- Fundamentals (8th Edition) byu da e a s (8 d o ) by Cay S. Horstmann, and Gary Cornell. WebCT: http://vista.unm.edu/ „ Grades „ Homework assignments

Grades

Midterm Exam 15%

Final Exam 15%

i-clicker quizzes 10%

Labs 30%

Projects 30%

„ Attendance is required for both i-clicker and lab

grades.

4

Quiz Question #1:

Do you have your i-clicker?Do you have your i clicker?

a) Yes – I am ready to go.

b) I bought one from the bookstore, but forgot it.

c) My dog ate it.

d) No – I did not get one yet.

e) What is an i-clicker anyway?

7

Who Should Take This Course

„ Someone who has studied Java in school, on a job or is self-taught, but does not feel ready to skip CS-152 and take CS-251. „„ Someone who has solid programming experience but does not knowSomeone who has solid programming experience, but does not know anything about Java. A person who knows C or FORTRAN well enough to write a program that calculates the first 50 prime numbers would probably be board in CS-152, but, without any Java experience, would be lost on day-one of CS-251. „ An engineering, science or math student with junior or senior standing who generally gets As or Bs. Even if that student has never taken a programming class he or she would probably find this class more

8

programming class, he or she would probably find this class more interesting and appropriately challenging than the CS-152 & CS- series. „ Calculus is not required or used in this class, but a student, straight out of high school, who found AP calculus and AP physics fairly easy would be much happier in this class than in CS-152 & CS-251.

Homework: Due Wed, Aug 26

Read Chapter 1

„ Java as a

Programming Platform.

„ Java Buzzwords.

„ Java Applets and the

Internet.

„ A Short History of Java.

9

y

„ Common Misconceptions about Java.

Wednesday: i>clicker quiz on the reading.

Java Rocks

„ Advantages for Large Programs

„ JUnit Testing

„ JavaDocs

„ Object-Oriented

„ Platform-independent

„ Secure

„ Rob st (emphasis on earl checking for possible

10

„ Robust (emphasis on early checking for possible

errors)

„ Multithreaded

„ Well suited for Automated Optimization

Java Performance - Wikipedia

Programs written in Java have had a reputation for

being slower and requiring more memory than

those written in natively compiled languages

such as C or C++.

However, Java programs' execution speed has

improved significantly due to introduction of

Just-In Time compilation (in 1997/1998 for Java

13

1.1), language features supporting better code

analysis, and optimizations in the Java Virtual

Machine itself (such as HotSpot becoming the

default for Sun JVM in 2000).

Micro Benchmarks vs. Production Code

C/C++ (wins on small)

„ Hand optimized, Pointers are quick „ Native floating-point operations. „ No error checking „ Quick statup

Java (often wins on big)

14

„ C-style pointers make optimization hard in languages that support them (particularly fine grain parallelism) „ Adaptive optimization is impossible in fully compiled code. „ Auto Garbage Collection beats application programmer GC!

Structured Programming

//Find Prime Factors.

while (testNumber <= endTest)

{{ if (if (n % testNumber == 0) % b 0)

{ //testNumber divides n.

System.out.println(testNumber);

n = n / testNumber;

elseelse

{ //testNumber does not divide n.

testNumber++;

15

OOP: Object-Oriented Programming

Do not be afraid of OOP.

Small Java programs are often not object-oriented.p g j

OOP is a superset of structured programming.

Inside each method (a.k.a. subroutine) OOP uses

structured programming style.

An object oriented program may be viewed as a

16

An object-oriented program may be viewed as a

collection of cooperating objects ,

In a conventional model, a program is seen as a list

of tasks (subroutines) to perform in some order.

Class Ideas

„ What is Java?

„ What is Computer

Programming?

„ What is Object-Oriented

Programming?

19