Presentation is loading. Please wait.

Presentation is loading. Please wait.

13 X 11 Java Lecture 1 CS 1311 Introduction 13 X 11.

Similar presentations


Presentation on theme: "13 X 11 Java Lecture 1 CS 1311 Introduction 13 X 11."— Presentation transcript:

1 13 X 11 Java Lecture 1 CS 1311 Introduction 13 X 11

2 Serious Stuff

3 13 X 11 Put these in order Avoid damage to equipment and material Get the job done Avoid injuries Maintain good community relations

4 13 X 11 Normal World Avoid injuries Avoid damage to equipment and material Get the job done Maintain good community relations

5 13 X 11 Get the job done Avoid injuries Avoid damage to equipment and material Maintain good community relations

6 13 X 11 Ballistics  ? v0v0

7 13 X 11 Ballistics  v0v0

8 13 X 11 Ballistics  vxvx vyvy v0v0

9 13 X 11 Ballistics  vxvx vyvy v0v0 t

10 13 X 11 Ballistics  vxvx vyvy v0v0 t t

11 13 X 11 Ballistics  vxvx vyvy v0v0 t t

12 13 X 11 Ballistics  vxvx vyvy v0v0 t t Assumptions Flat non-rotating earth Vacuum Constant gravity

13 13 X 11 Ballistics Calculations Required rooms full of mathematicians Very slow, tedious work Anything that would help could help to win the war Money no object Commercialization not considered Software Engineering?

14 13 X 11 Let's invent a computer

15 13 X 11 Computer Programming Initially by hand Big breakthrough: Machine translation Analysis of computation Church-Turing Functional Imperative/Procedural

16 13 X 11 Paradigm Review Functional Programming –Mathematical base –Provably correct –Disassociated from machine model Imperative/Procedural Programming –Machine oriented –Mathematical ties Object Oriented Programming –Some features of both –Result of industry maturation & growth

17 13 X 11 Origins of OO USAF ATC Randolph AFB B220 Locations Routines Data

18 13 X 11 Origins of OO USAF ATC Randolph AFB B220 Simulation Machines Workers Products Conveyor

19 13 X 11 Origins of OO USAF ATC Randolph AFB B220 Simulation Large scale projects

20 13 X 11 Origins of OO USAF ATC Randolph AFB B220 Simulation Large scale projects GUI's

21 13 X 11 So what is it? A brief overview My favorite example Queue

22 13 X 11 Chez Guillaume Application to maintain 2 queues Allow adding to either list Allow removing from either list

23 13 X 11 How might it be done? Enqueue Module Dequeue Module isEmpty Module head.tail Restaurant Module head.tail Input Module Output Module Menu Module Data Structure

24 13 X 11 How might it be done? Enqueue Module Dequeue Module isEmpty Module head.tail Restaurant Module head.tail Input Module Output Module Menu Module Data Structure Where is the queue?

25 The OO Approach Restaurant Object Input Module Output Module Menu Module Data Objects Queue Object Enqueue Module Dequeue Module isEmpty Module head.tail Queue Object head.tail Enqueue Module Dequeue Module isEmpty Module Data Object Get Data Module Set Data Module Cust Data Ref

26 13 X 11 The OO Approach Why do we want a new language? Why do we want to arrange things in such a fashion? What are the goals?

27 13 X 11 Goals Encapsulation Reusability Adaptability/Flexibility Decentralization/Distribution

28 13 X 11 OOP Terminology Abstract Data Type Class Object Method Fields/Attributes References

29 13 X 11 Characteristics of OOP Language Everything is an object A program is a bunch of objects telling each other what to do by sending each other messages Each object has its own memory made up of other objects Every object has a type which in OO terms means that every object is an instance of some class All objects of a particular type can receive the same messages. An object of type circle will also be an object of type shape thus...

30 13 X 11 Java Toasters Smart cards Killer apps The wwweb

31 13 X 11 Java, the good news Real Very powerful In demand Software engineering Universal

32 13 X 11 Java, the bad news Real Very powerful Not an educational language Jack of all trades/Master of none Slow

33 13 X 11 Clever Java Stuff Java program can be run by web browser Borrowed a lot of syntax from c and c++ Give it away WORA Security

34 13 X 11 Translation Compilation –Fortran –Cobol –Pascal –Algol –C/C++ Interpretation –Basic –Lisp –Scheme

35 13 X 11 Emulation How to sell a new computer to someone with lots of software? Emulate the old hardware! Old Software New Computer Program Emulating Old Computer

36 13 X 11 The Java Approach Compilation into ByteCode Java Source Byte Code Javac Compiler

37 13 X 11 The Java Approach Interpretation by the Java Virtual Machine Any Computer Java Virtual Machine Byte Code

38 13 X 11 Why is this cool?

39 13 X 11 The Internet ©Al Gore Java Source Byte Code Javac Compiler Do this once Web Server Your Computer Your Favorite Browser Java Virtual Machine

40 13 X 11 “Source Code” [.java] Java compiler Generic “Byte Code” [.class] OS-specific JVM interpreter Execute program Compilation/Execution Need one of these for every different OS

41 13 X 11 Sample Application public class HelloWorld { public static void main(String argv[]) { System.out.println(“Hello World!”); } We create a file (using an editor) called “HelloWorld.java” We compile by typing (at the OS prompt): javac HelloWorld.java Which produces HelloWorld.class Then we execute by typing: java HelloWorld Hello World!

42 13 X 11 Demo >javac HelloWorld.java >java HelloWorld Hello World! >

43 13 X 11 Quick Trix The name of the file must match the name of the class EXACTLY!!! File: Bubba.java Contains: Everything must be EXACTLY correct!!! class Bubba {... Capitalization counts

44 13 X 11 A Final Word static static is a source of great confusion and sometimes even frustration Here's the basic idea (don't worry if this is confusing we'll explain it again and again

45 13 X 11 Java Structure Java programs consist entirely of files containing classes Classes are like blueprints or templates They describe the structure and operation of objects. Objects are like whatever is made from a blueprints or template. Objects are considered to be dynamic Sometimes there is a need for something to not be dynamic hence you may declare it static.

46 13 X 11 Questions?

47 13 X 11


Download ppt "13 X 11 Java Lecture 1 CS 1311 Introduction 13 X 11."

Similar presentations


Ads by Google