Java Programming From Problem Analysis To Program Design PDF

Document Details

ComfortableWendigo7558

Uploaded by ComfortableWendigo7558

National University Fairview

Tags

java programming computer science programming languages computer history

Summary

This document provides a detailed and thorough overview of Java programming and the history of computers. It covers various topics relating to programming languages, computer components, and the evolution of computers.

Full Transcript

Java Programming From Problem Analysis to Program Design WEEK 1: An Overview of Computers and Programming Languages OBJECTIVES Learn about different types of computers Explore the hardware and software components of a computer system Learn about the language of a computer Learn about the...

Java Programming From Problem Analysis to Program Design WEEK 1: An Overview of Computers and Programming Languages OBJECTIVES Learn about different types of computers Explore the hardware and software components of a computer system Learn about the language of a computer Learn about the evolution of programming languages Examine high-level programming languages OBJECTIVES Discover what a compiler is and what it does Examine how a Java program is processed Learn what an algorithm is and explore problem-solving techniques Become aware of structured and object-oriented programming design methodologies INTRODUCTION Computers have greatly affected our daily lives – helping us complete many tasks. Computer programs (software) are designed specifically for each task. INTRODUCTION TO PROGRAMMING AND THEORIES Introduction Software is created with programming languages. Java is an example of a programming language. INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers The first device known to carry out calculations was the abacus The abacus uses a system of sliding beads on a rack for addition and subtraction INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers Blaise Pascal invented the calculating device called the Pascaline INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In 1819, Joseph Jacquard, a French weaver, discovered that the weaving instructions for his looms could be stored on cards with holes punched in them. INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In the early and mid-1800s, Charles Babbage, an English mathematician and physical scientist, designed two calculating machines: 1. the difference engine INTRODUCTION TO 2. the analytical engine PROGRAMMING AND THEORIES An Overview of the History of Computers The first computer-like machine was the Mark I Built in 1944 Used punched cards to feed data into the machine 52 feet long, weighed 50 tons, and had 750,000 parts INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In 1946, ENIAC (Electronic Numerical Integrator and Calculator) was built at the University of Pennsylvania Contained 18,000 vacuum tubes and weighed some 30 tons INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In 1956, the invention of the transistors resulted in smaller, faster, more reliable, and more energy-efficient computers INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers This era also saw the emergence of the software development industry with the introduction of FORTRAN and COBOL, two early programming languages INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In 1970, the microprocessor, an entire CPU on a single chip, was invented INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In 1977, Stephen Wozniak and Steven Jobs designed and built the first Apple computer in their garage INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers In 1981, IBM introduced its personal computer (PC) INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers Modern-day computers are very powerful, reliable, and easy to use o Can accept spoken-word instructions and imitate human reasoning through artificial intelligence INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers A computer is an electronic device capable of performing commands. INTRODUCTION TO PROGRAMMING AND THEORIES An Overview of the History of Computers The basic commands that a computer performs are o input (get data), o output (display results), o storage, o and performance of arithmetic and logical operations. INTRODUCTION TO PROGRAMMING AND THEORIES Elements of a Computer System A computer has two components Hardware Software INTRODUCTION TO PROGRAMMING AND THEORIES Hardware Components of a Computer Central Processing Unit (CPU) Main memory INTRODUCTION TO PROGRAMMING AND THEORIES Central Processing Unit Arithmetic and logical operations are carried out inside the CPU INTRODUCTION TO PROGRAMMING AND THEORIES Central Processing Unit and Main Memory INTRODUCTION TO PROGRAMMING AND THEORIES Central Processing Unit and Main Memory Ordered sequence of cells (memory cells). Directly connected to CPU. All programs must be brought into main memory before execution. When power is turned off, everything in main memory is lost. INTRODUCTION TO PROGRAMMING AND THEORIES Input Devices Definition: devices that feed data and computer programs into computers Examples o Keyboard o Mouse o Secondary storage INTRODUCTION TO PROGRAMMING AND THEORIES Output Devices Definition: devices that the computer uses to display results Examples o Printer o Monitor o Secondary storage INTRODUCTION TO PROGRAMMING AND THEORIES Software Software consists of programs written to perform specific tasks. Two types of programs: o System programs o Application programs INTRODUCTION TO PROGRAMMING AND THEORIES System Programs System programs control the computer. The operating system is first to load when you turn on a computer. INTRODUCTION TO PROGRAMMING AND THEORIES Application Programs Written using programming languages Perform a specific task Run by the OS Example programs o Word processors o Spreadsheets INTRODUCTION TO o Games PROGRAMMING AND THEORIES Operating System (OS) OS monitors overall activity of the computer and provides services Example services o Memory management o Input/output o Activities o Storage management INTRODUCTION TO PROGRAMMING AND THEORIES Language of a Computer Machine language: the most basic language of a computer A sequence of 0s and 1s Every computer directly understands its own machine language A bit is a binary digit, 0 or 1 INTRODUCTION TO A byte is a sequence of eight bits PROGRAMMING AND THEORIES Language of a Computer INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages Early computers programmed in machine language Assembly languages were developed to make programmer’s job easier INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages In assembly language, an instruction is an easy-to- remember form called a mnemonic Assembler: translates assembly language instructions into machine language INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages High-level languages make programming easier Closer to spoken languages Examples o COBOL o Basic o C/C++ o FORTRAN o Java INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages To run a Java program: 1. Java instructions need to be translated into an intermediate language called bytecode. 2. Then the bytecode is interpreted into a particular machine language. INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages Compiler: a program that translates a program written in a high-level language into the equivalent machine language In the case of Java, this machine language is the bytecode INTRODUCTION TO PROGRAMMING AND THEORIES Evolution of Programming Languages Java Virtual Machine (JVM): hypothetical computer developed to make Java programs machine independent INTRODUCTION TO PROGRAMMING AND THEORIES A Java Program INTRODUCTION TO PROGRAMMING AND THEORIES Processing a Java Program Two types of Java programs: applications and applets Source program: written in a high-level language Loader: transfers the compiled code (bytecode) into main memory Interpreter: reads and translates each bytecode instruction into machine language and then executes it INTRODUCTION TO PROGRAMMING AND THEORIES Processing a Java Program INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java The Internet is an interconnection of networks that allows computers around the world to communicate with each other. INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java In 1969, the U.S. Department of Defense’s Advanced Research Project Agency (ARPA) funded research projects to investigate and develop techniques and technologies to interlink networks. INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java This was called the internetting project, and the funding resulted in ARPANET, which eventually became known as the “Internet”. The Internet allows computers to be connected and communicate with each other. INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java World Wide Web (WWW), or Web uses software programs that enable computer users to access documents and files (including images, audio, and video) on almost any subject over the Internet with the click of a mouse. INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java World Wide Web (WWW), or Web Computers around the world communicate via the Internet; the World Wide Web makes that communication a fun activity INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java The primary language for the Web is known as Hypertext Markup Language (HTML) Java applets are programs that run from a Web browser and make the Web responsive and interactive INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java The primary language for the Web is known as Hypertext Markup Language (HTML) Java applets are programs that run from a Web browser and make the Web responsive and interactive INTRODUCTION TO PROGRAMMING AND THEORIES Internet, World Wide Web, Browser, and Java Two well-known browsers are Mozilla Firefox and Internet Explorer Java applets can run in either browser Through the use of applets, the Web becomes responsive, interactive, and fun to use INTRODUCTION TO PROGRAMMING AND THEORIES Problem-Analysis-Coding-Execution Cycle Algorithm: a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time INTRODUCTION TO PROGRAMMING AND THEORIES Problem-Solving Process 1. Analyze the problem and outline the problem and its solution requirements 2. Design an algorithm to solve the problem 3. Implement the algorithm in a programming language, such as Java 4. Verify that the algorithm works 5. Maintain the program by using and improving it and modifying it if the problem domain changes INTRODUCTION TO PROGRAMMING AND THEORIES Problem-Analysis-Coding-Execution Cycle INTRODUCTION TO PROGRAMMING AND THEORIES Programming Methodologies Two basic approaches to programming design 1. Structured design 2. Object-oriented design INTRODUCTION TO PROGRAMMING AND THEORIES Structured Design 1. A problem is divided into smaller subproblems 2. Each subproblem is solved 3. The solutions of all subproblems are then combined to solve the problem INTRODUCTION TO PROGRAMMING AND THEORIES Object – Oriented Design (OOD) In OOD, a program is a collection of interacting objects An object consists of data and operations INTRODUCTION TO PROGRAMMING AND THEORIES Object – Oriented Design (OOD) Steps in OOD 1. Identify objects 2. Form the basis of the solution 3. Determine how these objects interact INTRODUCTION TO PROGRAMMING AND THEORIES Chapter Summary A computer system is made up of hardware and software components Computers understand machine language; it is easiest for programmers to write in high-level languages A compiler translates high-level language into machine language Java steps to execute a program: edit, compile, load, and execute Chapter Summary Algorithm: step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Three steps to problem solving: analyze the problem and design an algorithm, implement the algorithm in a programming language, and maintain the program Two basic approaches to programming design: structured and object-oriented BYE BYEBYE

Use Quizgecko on...
Browser
Browser