chapter 5 : Programming languages

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Semantics:

The meaning of the language

What is a linker?

- A program that pulls other programs together so that they can run.

Object Oriented Languages

- A programming approach that focuses on data rather than the algorithm. - A program is divided into objects. This paradigm is based on objects and classes. - Example: Java, C++, Smalltalk, objective-C, Python, PHP, JavaScript

Procedure Oriented Languages

- It focuses on procedure/function. - An algorithm is needed to perform the derived computation .- Procedure Oriented Programming contains step by step procedure to execute. - A program is divided into modules - Example: C, Fortran, ALGOL, COBOL, and BASIC.

Good Language charateristics

1- Ease of program verification - Proof of correctness, desk checking, test - Simplicity of semantic and syntax 2- Programming environment 3- Portability of programs 4- Cost of use - Program execution - Program translation - Program creation, testing, and use - Program maintenance

There are three types of programming language:

1- Machine language (Low-level language) 2- Assembly language(Low-level language) 3-High-level language (3GL, 4GL and 5GL) Low-level languages are closer to the language used by a computer, while high-level languages are closer to human languages.

Skills of a Programmer:

1- Problem-Solving 2- Positivity 3- Time Management 4- thinking outside the box 5- Good communication skills 6-quick learning skills 7- Attention to detail

2 types of high level language

1- Procedure Oriented Languages 2- Object Oriented Languages

Good Language characteristics Software prospective

1- Reliability • Writability • Readability • Simplicity • Safety (no goto, no pointers) • Robustness (undesired events can be trapped, like arithmetic overflow, invalid inputs) 2- Maintainability • Factoring (modularity) • Locality 3- Efficiency

what are the 3 program errors ?

1- Syntax Errors: Errors in grammar of the language 2-Runtime error: When there are no syntax errors, but the program can't complete execution Divide by zero Invalid input data 3- Logical errors: The program completes execution, but delivers incorrect results Incorrect usage of parentheses

Broad concepts about Programming language help improving:

1- Your ability to develop effective algorithms. 2- Your ability to learn more programming languages. 3- Your efficient use of your existing programming language. 4- Your vocabulary of useful programming constructs.

Running Programs

1-Fetch an instruction 2-Decode (interpret) the instruction 3-Execute (perform) actual processing 4-Store the results, if needed

Programming Language :

A formal language that is intended for the expression of computer programs. Each programming language has its own syntax.

Complier

A program that converts another program from some source language (or high-level programming language / HLL) to machine language (object code). Some compilers output assembly language which is then converted to machine language by a separate assembler.

Assembly language programs are translated into machine language by a program called an ______.

Assembler

A program called an 'assembler' is required to convert the program into machine language. Thus, it takes longer to execute than a machine language program

Assembly Language

Simpler to use than machine language, though instruction codes must be memorized. It takes less time to develop programs as compared to machine language.

Assembly language

Compilation vs. Interpretation

Compilation : 1- Syntax errors caught before running the program 2- Better performance 3- Decisions made once, at compile time Interpretation: 1- Better diagnostics (error messages) 2- More flexibility. 3- Supports late binding (delaying decisions about program implementation until runtime) : Can better cope with PLs where type and size of variables depend on input. 4- Supports creation/modification of program code on the fly (e.g. Lisp, Prolog)

Why is documentation important?

Documentation is important for future reference. Other programmer may take over the operation of the program and the best way to understand a program is by studying the documentation. Trying to understand the logic of the program by looking at the source code is not a good approach. Studying the documentation is necessary when the program is subjected to enhancement or modification. Documentation is also necessary for management use as well as audit purposes

Generation of Programming Languages

First generation : • 1GL, lowl evel languages that are machine language. Second generation : 2GL, low level languages that generally consist of assembly languages. Third generation: 3GL, high level languages such as C fourth generation: 4GL, languages that consist of statement s like statement s in a human language. • Commonly used in database programming and scripts Fifth generation: 5GL, languages that contain visual tools to help develop a program such as Visual Basic.

A program called a compiler or interpreter is required to convert the program into machine language. Thus, it takes more time for a computer to execute.

High level language

Easiest to use. Takes less time to develop programs and, hence, ensures better program efficiency

High level language

Needs a lot of skill, as instructions are very lengthy and complex. Thus, it takes more time to program

Machine Language

Since it is the basic language of the computer, it does not require any translation, and hence ensures better machine efficiency. This means the programs run faster

Machine Language

Most programs are very large and consist of several____________.

Modules

Executable program

Output from linker/loader Machine language program linked with necessary libraries & other files Files usually have extension '.exe

Object program

Output from the compiler Equivalent machine language translation of the source program Files usually have extension '.obj'

Assembly Language

Programming language that has the same structure and set of commands as machine languages but allows programmers to use symbolic representations of numeric machine code.

why is programming language important ?

Programming languages are important for students in all disciplines of computing because they are the primary tools of the central activity of any science.

Source program

The form in which a computer program, written in some formal programming language, is written by the programmer. Can be compiled automatically into object code or machine code or executed by an interpreter . Pascal source programs have extension '.pas'

Interpretation

The interpreter stays around during execution • It reads and executes statements one at a time

What does a linker do?

The linker pulls everything together, makes sure that references to other parts of the program (code) are resolved.

Syntax:

The structure of strings in some language. A language's syntax is described by a grammar.

Documentation and Maintenance

When the program is thoroughly tested for a substantial period and it is consistently producing the right output, it can be documented

difference between compiler and assembler

compilers are distinguished from an assembler by the fact that each input statement, in general, correspond to more than one machine instruction.

Machine Language

is a collection of binary digits or bits that the computer reads and interprets.

Program

is a set of instructions which a computer can interpret to solve problems, make calculations, and perform tasks.

Even small programs use existing code provided by the programming environment called ________.

libraries

High Level Languages

programming languages whose instructions more closely resemble the English language which is them translated into machine language to be executed Some programming languages use a compiler to perform this translation and others use an interpreter

T or F: Machine languages are the only languages understood by computers.

true


Ensembles d'études connexes

LP 4. Disorders of the Aorta (Exam 2)

View Set

Week 4: Fundamentals Practice Questions

View Set

Chapter 16 Controlled Substances Review

View Set

Fire Prevention and Safety Practices

View Set

Leddy Professionalism Practice Questions

View Set

ch 14 sole: nervous system alterations

View Set