Chapter 1 Background Fundamentals of Java AP Computer
Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4 th Edition Lambert / Osborne
Objectives l l Chapter 1 l 2 Give a brief history of computers. Describe how hardware and software make up computer architecture. Explain the binary representation of data and program in computers. Lambert / Osborne Fundamentals of Java 4 E
Objectives (continued) l l Chapter 1 l 3 Discuss the evolution of programming languages. Describe the software developmental process. Discuss the fundamental concepts of objectoriented programming. Lambert / Osborne Fundamentals of Java 4 E
Vocabulary l l Chapter 1 l l 4 application software assembly language auxiliary input/output (I/O) auxiliary storage device bit byte Lambert / Osborne l l l central processing unit (CPU) hardware information hiding instance variables internal memory machine language Fundamentals of Java 4 E
Vocabulary (continued) l l Chapter 1 l l network connection object-oriented programming primary memory RAM secondary memory software l l l 5 Lambert / Osborne software development life cycle (SDLC) system software ubiquitous computing user interface waterfall model Fundamentals of Java 4 E
History of Computers l l ENIAC (1940 s) was one of the world’s first digital electronic computers. IBM sold its first business computer in the 1950 s. Chapter 1 – 6 – l It was thought the world needed no more than 10. Power was 1/2000 of the typical laptop of today. Today there are hundreds of millions of laptop and desktop computers in the world. Lambert / Osborne Fundamentals of Java 4 E
History of Computers (continued) l The first computers could perform only a single task at a time. – Chapter 1 l 7 Paper cards and tape used for input and output. In 1960 s, time-sharing computers were sold for businesses. – – – Cost up to millions of dollars. 30 people could work at once. Teletypes used phone wires. Lambert / Osborne Fundamentals of Java 4 E
History of Computers (continued) l l Chapter 1 l 8 l In 1970 s, e-mail and file transfers were born. In 1980 s, personal computers and local area networks were available. In 1990 s, an explosion of computer use and availability of Internet access. Computing has become ubiquitous. – Cell phones, cameras, PDAs, music players Lambert / Osborne Fundamentals of Java 4 E
Computer Hardware and Software l l l Chapter 1 l 9 l l Computers are machines that process information. Hardware the physical devices on your desktop. Software the programs that give the hardware functionality. Bits and Bytes: Bits are the smallest unit of information processed by a computer (0 s and 1 s). Bytes are eight bits. Lambert / Osborne Fundamentals of Java 4 E
Computer Hardware and Software (continued) l l Computer Hardware: Computers have six major subsystems: – – User interface Auxiliary input/output (I/O) Chapter 1 l – Auxiliary storage devices l l – Secondary memory Hard disks, DVDs, flash memory Network connection l 10 Keyboard, monitor, printer, digital camera, joystick Modem, TV cable, satellite dish, Ethernet cards Lambert / Osborne Fundamentals of Java 4 E
Computer Hardware and Software (continued) l Computer Hardware (cont): – Internal memory (RAM) l l Chapter 1 – 11 RAM (random access memory) is primary memory ROM (read-only memory) Central processing unit (CPU) l l l Performs basic tasks using complex hardware. Moore’s Law: speed is doubled every two years Transistor is the building block of the CPU and RAM. Lambert / Osborne Fundamentals of Java 4 E
Secondary Memory Devices Information is moved Chapter 1 Secondary memory devices provide long-term storage Hard disks Floppy disks ZIP disks Writable CDs Writable DVDs Tapes Lambert / Osborne Central Processing Unit between main memory and secondary memory as needed Hard Disk Main Memory Floppy Disk Fundamentals 12 of Java 4 E
Computer Hardware and Software (continued) A computer’s six major subsystems Chapter 1 l 13 Lambert / Osborne Fundamentals of Java 4 E
Computer Hardware and Software (continued) l Computer Software: – System software l Chapter 1 l 14 – Supports the operations of the computer. Includes the operating system, communication software, compilers, and the user interface subsystem. Application software l l Allows users to accomplish tasks. Types include Word processors, spreadsheets, databases, and multimedia. Lambert / Osborne Fundamentals of Java 4 E
Binary Representation of Information and Computer Memory l l Chapter 1 l 15 Computer memory stores patterns of electronic signals. The patterns are strings of binary digits or bits. Computers use binary (base 2) notation. – – Two bases: On/Off Computer scientists also use bases octal (8) and hexadecimal (16). Lambert / Osborne Fundamentals of Java 4 E
Representing Text Digitally l For example, every character is stored as a number, including spaces, digits, and punctuation l Corresponding upper and lower case letters are separate characters Chapter 1 Hi, Heather. 72 105 44 32 72 101 97 116 104 101 114 46 Lambert / Osborne Fundamentals 16 of Java 4 E
Chapter 1 Binary Numbers l Once information is digitized, it is represented and stored in memory using the binary number system l A single binary digit (0 or 1) is called a bit l Devices that store and move information are cheaper and more reliable if they have to represent only two states Lambert / Osborne Fundamentals 17 of Java 4 E
Binary Numbers A single bit can represent two possible states, like a light bulb that is either on (1) or off (0) l Combinations of bits are used to store values Chapter 1 l Lambert / Osborne Fundamentals 18 of Java 4 E
Bit Combinations 2 bits 00 01 10 11 Chapter 1 1 bit 0 1 3 bits 000 001 010 011 100 101 110 111 4 bits 0000 1000 0001 1001 0010 1010 0011 1011 0100 1100 0101 1101 0110 1110 0111 1111 Each additional bit doubles the number of possible combinations Lambert / Osborne Fundamentals 19 of Java 4 E
Bit Combinations l l Chapter 1 l Each combination can represent a particular item There are 2 N combinations of N bits Therefore, N bits are needed to represent 2 1 1 bit ? 2 = 2 items unique items How many items can be represented by Lambert / Osborne 2 bits ? 22 = 4 items 3 bits ? 23 = 8 items 4 bits ? 24 = 16 items 5 bits ? 25 = 32 items N Fundamentals 20 of Java 4 E
Bit Combinations l Suppose we have three bits … see how different numbers are represented with them 1 Chapter 1 22 = 4 0 + 1 22 = 4 1 0 1 + 21 = 2 Lambert / Osborne 5 + 1 5 = 1 7 + 1 = 7 Fundamentals 21 of Java 4 E
Chapter 1 Bit Combinations l Since you were very small, people have told you that you can count up to 10 with your two hands, right? l Well … you can do better than this … l With one hand you can count up to 31 … l With two hands you can count up to 1023 … Lambert / Osborne Fundamentals 22 of Java 4 E
Binary Representation of Information and Computer Memory (continued) l Floating-Point numbers – – l Characters and Strings Chapter 1 – 23 l Fractions Use mantissa/exponent notation ASCII, represents patterns as bytes Java uses Unicode – Patterns of 15 bits from 0000 to 1111 Lambert / Osborne Fundamentals of Java 4 E
Binary Representation of Information and Computer Memory (continued) l Floating-Point numbers – – l Characters and Strings Chapter 1 – 24 l Fractions Use mantissa/exponent notation ASCII, represents patterns as bytes Java uses Unicode – Patterns of 15 bits from 0000 to 1111 Lambert / Osborne Fundamentals of Java 4 E
Binary Representation of Information and Computer Memory (continued) l Sound is analog data. – – Chapter 1 – l Images – – 25 Analog information has a continuous range of infinite values. Sampling reads the waveform at intervals. Memory requirements for sound are higher than text. Sampling measures color values as pixels in a twodimensional grid. Grayscale, black-and-white, RGB, true-color Lambert / Osborne Fundamentals of Java 4 E
Binary Representation of Information and Computer Memory (continued) l Video – – Chapter 1 l 26 Program instructions – l Video includes a soundtrack and a set of images called frames. Data compression is difficult. A sequence of bits in RAM Computer Memory – A gigantic sequence of bytes, each with an address. Lambert / Osborne Fundamentals of Java 4 E
Programming Languages l Chapter 1 l 27 l l l Generation 1 (Late 1940 s to Early 1950 s)Machine Languages: Programs were coded in machine language, whose only symbols are binary digits. Coding was tedious, slow, and error-prone. It was difficult to modify programs. Each type had its own machine language so programs were not portable. Lambert / Osborne Fundamentals of Java 4 E
Programming Languages (continued) l l Chapter 1 l 28 l l Generation 2 (Early 1950 s to Present)-Assembly Languages: Assembly languages use mnemonic symbols to represent instructions & data. Programs are translated by assembler and loaded and run using a loader. Assembly language is more programmer friendly, but still tedious. Like machine language, it is not portable as each computer has its own unique language. Lambert / Osborne Fundamentals of Java 4 E
Programming Languages (continued) l l Chapter 1 l 29 l l Generation 3 (Mid-1950 s to Present)-High-Level Languages: Examples of high-level languages are FORTRAN, COBOL, BASIC, C, Pascal, C++, Python, Smalltalk, and Java. High-level languages are easy to write, read, understand. Translation to machine language is done using a compiler. Java does not need to be recompiled for each type of computer. Lambert / Osborne Fundamentals of Java 4 E
The Software Development Process l Software development life cycle (SDLC) – Waterfall method: l l Chapter 1 l 30 l l l Customer request (user requirements) Analysis Design Implementation (coding) Integration Maintenance Lambert / Osborne Fundamentals of Java 4 E
The Software Development Process (continued) Percentage of total cost incurred in each phase of the development process Chapter 1 l 31 Lambert / Osborne Fundamentals of Java 4 E
Basic Concepts of Object-Oriented Programming l Chapter 1 l 32 l High-level programming languages fall into two major groups. The older languages, COBOL, FORTRAN, BASIC, C, and Pascal, all use a procedural approach. New languages, Smalltalk, C++, Python, and Java use an object-oriented approach. – Object-oriented is considered superior. Lambert / Osborne Fundamentals of Java 4 E
Basic Concepts of Object-Oriented Programming (continued) l Object-oriented programming (OOP) process is the process of programming with objects. – Chapter 1 l 33 l Programs are composed of different types of software components called classes. Classes define: – – l Steps: planning, execution, outcome Instance variables (data resources) Methods (rules of behavior) Combining resources and behaviors into a single software entity is encapsulation. Lambert / Osborne Fundamentals of Java 4 E
Basic Concepts of Object-Oriented Programming (continued) l An executing program is composed of interacting objects. – Chapter 1 l 34 l An object is an instance of the class that describes its resources and behavior. Objects send messages to each other to accomplish the mission of the program. Information hiding provides access to services but not data resources. Lambert / Osborne Fundamentals of Java 4 E
Basic Concepts of Object-Oriented Programming (continued) l l Chapter 1 l 35 l Classes are organized into hierarchies. Subclasses share methods and instance variables with the root class using inheritance. Different types of objects can understand the same message, called polymorphism. An object’s response to a message depends on its class. Lambert / Osborne Fundamentals of Java 4 E
Chapter 1 Summary 36 In this chapter, you learned: l The modern computer age began in the late 1940 s with the development of ENIAC. Business computing became practical in the 1950 s, and time-sharing computers advanced computing in large organizations in the 1960 s and 1970 s. The 1980 s saw the development and first widespread sales of personal computers, and the 1990 s saw personal computers connected in networks. During the first decade of the twenty-first century, computing has become ubiquitous. Lambert / Osborne Fundamentals of Java 4 E
Summary (continued) Chapter 1 l 37 l Modern computers consist of two primary components: hardware and software. Computer hardware is the physical component of the system. Computer software consists of programs that enable us to use the hardware. All information used by a computer is represented in binary form. This information includes numbers, text, images, sound, and program instructions. Lambert / Osborne Fundamentals of Java 4 E
Summary (continued) Chapter 1 l 38 l Programming languages have been developed over the course of three generations: generation 1 is machine language, generation 2 is assembly language, and generation 3 is high-level language. The waterfall model of the software development process consists of several standard phases: customer request, analysis, design, implementation, integration, and maintenance. Lambert / Osborne Fundamentals of Java 4 E
Summary (continued) Object-oriented programming is a style of programming that can lead to better-quality software. Breaking code into easily handled components simplifies the job of writing a large program. Chapter 1 l 39 Lambert / Osborne Fundamentals of Java 4 E
- Slides: 39