Download
slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Chapter 1 Computers, Programs, and Java PowerPoint Presentation
Download Presentation
Chapter 1 Computers, Programs, and Java

Chapter 1 Computers, Programs, and Java

403 Vues Download Presentation
Télécharger la présentation

Chapter 1 Computers, Programs, and Java

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Chapter 1Computers, Programs, and Java

  2. 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.

  3. Hardware Information Systems Programming with Java, 2nd edition Andrew C. Staugaard, Jr.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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.

  13. 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.

  14. 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.

  15. 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.

  16. 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.

  17. 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.

  18. 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.

  19. 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.

  20. Java Translation Information Systems Programming with Java, 2nd edition Andrew C. Staugaard, Jr.

  21. Java Programs • 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.