Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.

Similar presentations


Presentation on theme: "Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An."— Presentation transcript:

1 Chapter 4 Software

2 Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An instruction is a pattern of ones and zeros stored in a “word” of computer memory. A “word” of memory is the basic unit of storage for a computer When a computer accesses memory, it usually stores or retrieves a word of information at a time.

3 Chapter 4: Software Generations of Languages A “word” of memory is the basic unit of storage for a computer 8 bits = 1 byte A 16-bit computer has a word size of 16 bits, or two bytes A 32-bit computer has a word size of 32 bits, or 4 bytes A 64-bit computer has a word size of 64 bits, or 8 bytes

4 Chapter 4: Software Generations of Languages First-Generation 0110000001000000 (Load the A-register from 64) Second-Generation – assembly language LDA 100 (Load the A-register from 100 octal = 64)

5 Chapter 4: Software Generations of Languages Third-Generation FORTRAN – first third-generation language x = y + z Statements look something like English and mathematical statements. Easier to read and write. C, C++, Java, BASIC, Visual Basic, COBOL

6 Chapter 4: Software Compilers and Interpreters A compiler is a program for creating machine language from a high-level programming language. The job of the compiler is to translate the source code into machine code. The result of compiling a program is a file of object code, which is a binary file of machine instructions that will be executed when the program is run.

7 Chapter 4: Software Compilers and Interpreters Interpreters translate source code to machine code one source code line at a time and they do this every time the program runs. Unlike Compilers translate all lines of source code at once and only once. Compilers do not run when the program runs.

8 Chapter 4: Software Compilers and Interpreters Compiled programs run faster but it’s harder to find and fix errors. Interpreters run slower, however, it’s easier to find and fix errors because interpreters usually provide better error messages and it’s quicker to rerun an interpreted program because the program doesn’t have to be compiled first.

9 Chapter 4: Software Virtual Machines Generally describes an additional layer of abstraction between the user and the hardware. It is also used to describe software that makes one type of computer appear to be another.

10 Chapter 4: Software Virtual Machines Java Virtual Machine (JVM) Java is both compiled and interpreted The Java compiler (javac) translates Java source code into “bytecode” which is platform-independent intermediate code. When the Java program runs the JVM interpretes the bytecode into machine code.

11 Chapter 4: Software Procedural Programming A list of instructions to be executed in order. The code for a specific job is contained in a named procedure also known as a subroutine. This is called structured/modular programming. The subroutines can be reused throughout the program. Write once, use many.

12 Chapter 4: Software Object-Oriented Programming Instead of subroutines, OO programming relies on software objects as the unit of modularity Objects are called “classes” Classes have attributes and behaviors Attributes are defined using instance variables. Behavior are defined using subroutines aka methods Automobile class Attributes: four wheels, a motor, seats…etc. Behavior: change speed, park, turn, refuel.

13 Chapter 4: Software Object-Oriented Programming Encapsulation – reliable operation even as things change. If the creator of the class decides to make a change, the interface will remain the same. Inheritance – ability to create a class by inheriting attributes and methods from another class. Polymorphism – A method of a given name may be different depending on the class of the object for which the method is invoked.

14 Chapter 4: Software Summary The machine instruction sets themselves constituted the first generation programming languages. Programs were conceived as sequences of machine operations, and programmers worked directly with the hardware, often entering code in ones and zeros directly through the front panel switches. Assembly languages, using mnemonic character strings to represent machine instructions, made up the second generation of programming languages. Beginning with FORTRAN in 1954, third-generation languages allowed programmers to work at a higher level, with languages that were much more independent of the computer hardware. Programs can be compiled or interpreted. Compilers generate machine instructions that can run directly on the computer, independent of further availability of the compiler program. Interpreters, on the other hand, are programs that read and execute source code a line at a time. Java is an environment that uses both. Java source code is compiled into machine- independent bytecode, and the Java Virtual Machine interprets the bytecode at execution. Many JVM implementations today also compile bytecode to machine instructions.


Download ppt "Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An."

Similar presentations


Ads by Google