1 / 17

Computer Science: An Overview Tenth Edition by J. Glenn Brookshear

Chapter 6: Programming Languages. Computer Science: An Overview Tenth Edition by J. Glenn Brookshear. Chapter 6: Programming Languages. 6.1 Historical Perspective 6.2 Traditional Programming Concepts 6.4 Language Implementation. Figure 6.1 Generations of programming languages.

Download Presentation

Computer Science: An Overview Tenth Edition by J. Glenn Brookshear

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 6:Programming Languages Computer Science: An OverviewTenth Edition by J. Glenn Brookshear

  2. Chapter 6: Programming Languages • 6.1 Historical Perspective • 6.2 Traditional Programming Concepts • 6.4 Language Implementation

  3. Figure 6.1 Generations of programming languages

  4. Second-generation:Assembly language • A mnemonic system for representing machine instructions • Mnemonic names for op-codes • Identifiers: Descriptive names for memory locations, chosen by the programmer

  5. Assembly Language Characteristics • One-to-one correspondence between machine instructions and assembly instructions • Programmer must think like the machine • Inherently machine-dependent • Converted to machine language by a program called an assembler

  6. Machine language156C166D505630CEC000 Assembly languageLD R5, PriceLD R6, ShippingChargeADDI R0, R5 R6ST R0, TotalCostHLT Program Example

  7. Third Generation Language Turkish, German, English etc. are natural languages but programming languages are formal languages. • Uses high-level primitives • Similar to our pseudocode in Chapter 5 • Machine independent (mostly) • Examples: FORTRAN, COBOL • Each primitive corresponds to a sequence of machine language instructions • Converted to machine language by a program called a compiler

  8. Figure 6.2 The evolution of programming paradigms Programming (software development) paradigms: Alternative approaches to the programming (software development process) process. Imperative (procedural) paradigm: Programming process is the development of a sequence of commands that, when followed, manipulate data to produce the desired result (i.e. find an algorithm to solve the problem). Object-oriented paradigm Software system is a collection of units (called objects) each of which is capable of performing the actions that are related to itself and as well as requesting actions of other objects. Declarative paradigm:Asks programmer to describe the problem to be solved rather than an algorithm to be followed. Agent-oriented paradigm (?) Autonomous, proactive and social objects (a.k.a. dynamic objects). Functional paradigm: A program is constructed by connecting smaller program units (i.e. predefined functions) so that each unit’s outputs are used as inputs to another unit in such a way that the desired overall input-to-output relationship is obtained.

  9. Figure 6.3 A function for checkbook balancing constructed from simpler functions In LISP, (Find_diff (Find_sum (Old_balance Credits) Find_sum (Debits))

  10. Figure 6.4 The composition of a typical imperative program or program unit Statement categories in imperative and object-oriented languages: Declarative statements Customized terminology that is used later in the program. E.g. Names of data items. Imperative statements Description of steps in the underlying algorithms Comments Statements written into the code in any langugage in order to improve the human readability of the program.

  11. Data Types Variable: Descriptive names (rather than numeric addresses) that refer to main memory locations. Changing the values in such locations results in value changes for the variable. Data type: Type of the associated variable. It encompasses both the manner in which the data item (named by its variable) is encoded and the operations that can be performed on that data (or in general the variable). • Integer: Whole numbers • Real (float): Numbers with fractions • Character: Symbols • Boolean: True/false

  12. Variable Declarations float Length, Width; int Price, Total, Tax; char Symbol;

  13. Figure 6.5 A two-dimensional array with two rows and nine columns Data structure: A conceptual arrangement of data. Homogeneous array: A block of values of the same type such as one-dimensional list, two-dimensional list with rows and columns and higher dimensional tables. Indices: Integer values that specify rows, columns etc. of the elements of a homogeneous array.

  14. Figure 6.6 The conceptual structure of the heterogeneous array Employee Heterogeneous array: Block of data in which different elements can have different types. An example in C: struct{char Name[25]; int Age; float SkillRating;} Employee; Employee.Age = Employee.Age + 1; Employee.SkillRating = 72.5; Declaration part Imperative part

  15. Figure 6.7 The for loop structure and its representation in C++, C#, and Java Comments: provide an easy understanding of program statements. They are explanatory statements inserted within program statements. In C++, C# and Java, /* This is a comment */ // This is a comment

More Related