Chapter 1
Download
1 / 21

Chapter 1 Computers, Programs, and Java - PowerPoint PPT Presentation


  • 374 Views
  • Uploaded on

Chapter 1 Computers, Programs, and Java Computer Science Why should anyone who doesn’t want to be a computer scientist learn about computer science? Manipulation is done with a computer Media Business data Scientific data

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Chapter 1 Computers, Programs, and Java' - paul2


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Slide1 l.jpg

Chapter 1Computers, Programs, and Java


Computer science l.jpg
Computer Science

Why should anyone who doesn’t want to be a computer scientist learn about computer science?

  • Manipulation is done with a computer

    • Media

    • Business data

    • Scientific data

      If you can only manipulate data with software that someone else created, you are limiting your ability to communicate.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Slide3 l.jpg

Hardware

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Software l.jpg
Software

  • Software are the instructions that tell the hardware what to do.

  • A set of software instructions that tells the computer what to do is called a computer program.

    • A program is like a recipe

  • There are different types of programs that make up a computer.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Operating systems l.jpg
Operating Systems

  • An operating system, or OS, is the “glue” that binds the hardware to the application software.

  • An operating system is a collection of computer programs dedicated to managing the resources of the system.

  • What are some tasks the operating system manages?

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Machine language l.jpg
Machine Language

  • All of the hardware components in a computer system, including the CPU, operate on a language made up of binary numbers

  • Binary numbers are made up of only 2 digits - 0 and 1.

  • A CPU does not understand any other language.

  • Every instruction is eventually translated into machine language.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Assembly language l.jpg
Assembly Language

  • Assembly language is one step up from machine language.

  • Assembly language employs alphabetic abbreviations called mnemonics.

  • For instance, the mnemonic for addition is ADD, the mnemonic for move is MOV, and so forth.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


High level language l.jpg
High-level language

  • A high-level language consists of instructions, or statements, that are closer to English and common mathematical notation.

  • When programming in a high-level language, you do not have to concern yourself with the specific machine language of the CPU.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Structured languages l.jpg

A structured language allows complex problems to be solved using a modular, top/down, approach.

C is a structured programming language

Structured Languages

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Object oriented programming oop l.jpg

An object-oriented language allows complex problems to be solved using more natural objects that model the way we humans think about things in terms of attributes and behavior.

C++ and Java are object-oriented programming languages

Object-Oriented programming (OOP)

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Slide11 l.jpg

A Quick Language Comparison

FeatureCC++Java

Object-Oriented No Yes Yes

Easy GUIs No No Yes

Portable No No Yes

Internet Programming No No Yes

Easy Multitasking No No Yes

Easy Database Connectivity No No Yes

Built-In Security No No Yes

Simplicity No No Yes

High Speed Execution Yes Yes No

Low Level Coding Yes Yes No

Widely Accepted Yes Yes Yes

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Slide12 l.jpg
Java

  • In Java, you can write many different kinds of programs, including applications, applets, servlets, EJBs, and JavaBeans.

    • Java applications are designed to be run on a computer just like any other computer program written in any other language.

    • Java applets are programs designed only to be run over the Internet using a Web browser.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Why java l.jpg
Why Java?

  • Object-oriented

  • Portable – compile once, deploy many

  • Growing in popularity

  • Cheap - free

  • For our class

    • Simpler than C

    • A “real” programming language, not just scripting

    • Once you know Java you can pick up any other language easily

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Creating a program l.jpg
Creating a Program

  • Even when programming in a high level language, the system must still translate your instructions into machine language.

  • High level programming languages use either a compiler or an interpreter to translate the instructions into machine code.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Compiler l.jpg
Compiler

  • A compiler is a program that takes a high-level language program and translates the entire program into machine code all at one time.

  • All instructions are compiled before any are executed by the CPU.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Interpreter l.jpg
Interpreter

  • An interpreter translates and executes one high-level instruction at a time.

  • Once a given instruction has been executed, then it translates and executes the next, and so on.

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Java programs l.jpg
Java Programs

Java is unique in that it uses a compiler and an interpreter:

  • Type your program into an editor

  • Save it in a file with a .java extension – source code

  • Invoke the Java compiler to translate the source code into Java bytecode (.class file)

  • Bytecode is similar to machine language but not associated to any specific CPU

  • Any computer with a Java Virtual Machine (JVM) has a Java interpreter

  • Java interpreter translates the generic bytecode into machine language instructions specific to the CPU

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Language translation l.jpg

A source program is the one that you write in the Java language and that always has a file extension of .java.

An object program is the binary byte-code program generated by the Java compiler, which always has a file extension of .class.

Language Translation

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Language translation19 l.jpg

The .class file generated by the Java compiler contains bytecode

low-level code similar to machine language

generic and not specific to any particular CPU.

The Java Virtual Machine (JVM) translates the generic bytecode into machine language

A computer must have a JVM to run the Java program.

Language Translation

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Slide20 l.jpg

Java Translation bytecode

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.


Java programs21 l.jpg
Java Programs bytecode

  • Why does Java use both a compiler and interpreter?

  • What are the pros and cons of this?

Information Systems Programming with Java, 2nd edition

Andrew C. Staugaard, Jr.