Bài giảng An Introduction to Computer Science Using Java - Chapter 1 What is Programming?

Tài liệu Bài giảng An Introduction to Computer Science Using Java - Chapter 1 What is Programming?: Chapter 1 What is Programming?Lecture Slides to AccompanyAn Introduction to Computer Science Using Java (2nd Edition)byS.N. Kamin, D. Mickunas, E. ReingoldChapter PreviewIn this chapter we will:demonstrate some problem-solving techniques needed in programmingdesign an algorithm to solve a problemwrite a program to implement an algorithmdiscuss the importance of object-oriented programmingdiscuss some basics of computer hardwaredescribe the process of entering and running Java programsDefinitionsprograma set of directions telling a computer exactly what to doprogramming languageslanguages for specifying sequences of directions to a computeralgorithma sequence of language independent steps which may be followed to solve a problemFinal Maze Solving Programstep forward;while (inside the maze?) {turn right;while (facing a wall?) {turn left;}step forward;}Object-Oriented ProgrammingA modern programming paradigm that allows the programmer to model a problem in a real-world fashionObjects inte...

ppt22 trang | Chia sẻ: honghanh66 | Lượt xem: 734 | Lượt tải: 0download
Bạn đang xem trước 20 trang mẫu tài liệu Bài giảng An Introduction to Computer Science Using Java - Chapter 1 What is Programming?, để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên
Chapter 1 What is Programming?Lecture Slides to AccompanyAn Introduction to Computer Science Using Java (2nd Edition)byS.N. Kamin, D. Mickunas, E. ReingoldChapter PreviewIn this chapter we will:demonstrate some problem-solving techniques needed in programmingdesign an algorithm to solve a problemwrite a program to implement an algorithmdiscuss the importance of object-oriented programmingdiscuss some basics of computer hardwaredescribe the process of entering and running Java programsDefinitionsprograma set of directions telling a computer exactly what to doprogramming languageslanguages for specifying sequences of directions to a computeralgorithma sequence of language independent steps which may be followed to solve a problemFinal Maze Solving Programstep forward;while (inside the maze?) {turn right;while (facing a wall?) {turn left;}step forward;}Object-Oriented ProgrammingA modern programming paradigm that allows the programmer to model a problem in a real-world fashionObjects interact with each other by sending messagesAn object is an instance of a classA class implements an interface and specifies the behavior of an objectObject-Oriented Programming and JavaThe use of OOP in Java is pervasiveeasy to create multiple objects of the same typeeasy to create similar objects without having to rewrite the overlapping codeOOP makes programs easier to understand and more reliablePrevents objects from having to know any more about structure of other objects than is really necessaryComputer Organizationcentral-processing unitperforms the actual work of executing the programmain memoryholds the program and during executionhard diskholds all programs not executing and all data filesinput/output devicesallow the computer to communicate with the outside worldRunning a ProgramFirst the program and all its data is copied from the hard disk into main memoryThe CPU goes to the location of the program instruction and reads that wordThe CPU determines what action is requested by decoding its bit pattern representationThe CPU performs the actionThe CPU then moves to the location of the next program instruction in memory, reads the word, and repeats the processData RepresentationComputers use binary numbersNumbers can be used to represent any type of datapictures are represented by dividing them into picture elements known as pixelsvideo images or animations are represented by placing several picture one after anothersounds are represented by sampling the wave at regular intervalsAll data are stored in files on the hard diskRunning Your Own Java ProgramEnter the program source code in a data file using an editorTransform the source program into machine language or Java Bytecode using an compiler (e.g. javac)Use an interpreter to execute the compiled program (e.g. java)Return to the editor to correct any errors (or bugs) and start the cycle againErrorsDebugging is the process of detecting and fixing errors found in a programSyntactic errors are caused by giving the compiler a program it cannot recognizeLogical errors come from programs that compile correctly but fail to execute as expectedPrograms must be designed carefully and tested thoroughly to ensure that neither error will occurJavaapplicationsstand-alone programs that run on you own computercan read and write data on your disk diskappletsexecuted from within a browser window (e.g. Netscape or Internet Explorer)can be loaded from the World Wide Web and executed on another computercannot read or write data on your hard disk

Các file đính kèm theo tài liệu này:

  • pptchapter1_2212.ppt
Tài liệu liên quan