What is a programming language?
This is a notation for describing algorithms and data structures. It is also a medium for communicating procedural actions to an interpreting agent or machine. It is a mental tool for;
- Solving procedural problems.
- Representing algorithms.
- Reasoning about algorithms.
Reasons for studying programming languages
- To understand the connection between languages and the problem-solving process; that is how it conditions our thinking.
- To suggest designs for language suited to needs of problem-solving and software production.
- To permit a better choice of programming language for a particular problem.
- To understand the meaning of one language by comparison with others. This is through development of semantic description tools.
- To understand how languages and features are implemented.
- To make it easier to learn new languages.
Importance of programming
Programs are descriptions of values, properties, methods, problems and solutions. The role of the machine is to speed up the manipulation of these descriptions and to provide descriptions to particular problems.
A programming language is a convention for writing descriptions which can be evaluated.
Historically programming languages have had a limited role. they have mainly been used to write executable programs (.exe) .
As programs have grown in complexity this role alone has proved insufficient. Many design and analysis techniques have risen to support memory.
The programmer has to do several things simultaneously, mainly;
- Describe what is computed.
- Organize computation sequencing into smaller steps.
- Organise memory management during the computation.
The primary purpose of any language is communication. A specification is communication from one person to another entity for a task to be fulfilled.
At the lowest level, the task to be fulfilled is execution of a program by a computer.
At the next level, it is the compilation of a program by a compiler.
Then at higher-level specifications, you are the one to communicate to other people what is to be accomplished by their programming task.
When the computer is carrying out instructions at the lower level instructions must be precisely executed.
At higher levels, understanding is important as human intelligence is involved.
Abstraction which facilitates understanding and precision are both important qualities of high-level specifications. Abstraction involves creating the right model for a problem and devising the appropriate mechanizable techniques to solve the problem.
In this sense abstraction implies simplification. In other words it is the replacement of a complex and detailed real-world situation by an understandable model in which we can solve the problem.
What knowledge should the programmer have?
Knowledge about computer programming covers the following three categories;
- Programming language knowledge; the syntax and semantics of some certain languages.
- Program knowledge; knowledge about a specific program.
- Programming knowledge; how to construct programs from abstract concepts within the programming paradigm in use. For example having the use of variables and iteration in procedural programming.
- For a programmer the most important type of knowledge is programming knowledge.
The study of programming languages is primarily concerned with the following questions;
- What are good ways to program (what are effective ways of specifying computational processes)?
- What are the best ways to express programming items?
- How does one precisely describe and implement the various features of programming languages?
Historical background of programming languages
This is the batch environment through the early 60s and 70s. During this time, programs were submitted to operators as a pile of punch cards and were run overnight.
Interactive environments which included multiple teletypes and crts were locked up to a single mainframe. Time sharing operating systems gave users time slices in which they were supposed to do their work. This led to compilers with read-print loops.
Personal computing era
These were small, cheap and Powerful. They supported the single uses and single threaded operating system. The windows interface replaced line input commands. It also became widely available which led to inter-computer communications and distributed systems.
These spread the use of local area networks for printing, file and application sharing.
This also led to a global network which was first called ARPANET and is now called the internet. The internet is composed of a collection of protocols for example FTP, email (SMTP), http (HTML) and URL.
Basic features of a good programming language
A feature of a programming language is some piece of its syntax, together with the semantics of that syntax and understanding of the parts of a language, and their interactions which are necessary for their proper use as well as of the language design itself.
- Simplicity; few clear constructs each with a unique meaning.
- Orthogonality; every combination of features is meaningful.
- Rich data structures; this allows the programmer to naturally model a problem.
- Clear syntax design; the constructs should suggest functionality.
- Support for abstraction; the program data reflects the problem being solved and allows the programmer to safely work locally.
- Expressiveness; it should be very concise.
- It should have very flexible control constructs.
- It should have good programming architecture independence and portability.
- It should be very reliable in terms of type checking and exception handling.
Paradigms of programming
There are several several ways to think about computation;
- It could be a set of instructions to be followed.
- It could be a set of expressions to be evaluated.
- It can be a set of rules to be applied.
- It can be a set of objects to be rearranged.
- It can also be a set of messages to be sent and received.
Declarative vs imperative languages
Declarative languages specify what is to be computed. They let you specify what you want to happen rather than how it should happen.
Imperative languages on the other hand specify how the problem is to be computed.
The Imperative Paradigm
These are those languages that facilitate computation by means of state changes. By state I mean the condition of the computer’s RAM (random access memory).
When a program is entered, associated data exists in a certain condition for example an unsorted list offline. It is the programmers job to specify a sequence of changes to the store that will produce the desired final state: e.g assorted list.
Key features of the imperative paradigm include;
- How of control
The block structured paradigm
Fortran; this was the first language with program blocks partitions. These partitions represented subroutines and problem data. The term block structure now refers to nested blocks.
The state represents a stack with the reference to the procedure block currently active on top. In block structured languages, the procedure is the principal building block of programs. Some examples of those include; ALGOL 60, Pascal, ALGOL 68, C, BASIC and FORTRAN.
The Object Based Paradigm
This describes languages that support interacting objects. An object is a group of procedures that share a state since data is also part of a state.
The data and all the procedures or functions that apply to it can be captured in a single object.
Some examples include;
- Ada where objects are called packages.
- Modular where they are called modules.
- Small talk where they’re called objects.
- C++ where they are referred to as objects.
- Java where they are also referred to as objects.
The Distributed Programming Paradigm
Concurrent programming has been divided into two broad categories; loosely or tightly coupled systems.
The term distributed refers to languages which are used in loosely coupled systems. They support a group of programmers working on a particular program simultaneously and communicating through message passing over a communications channel.
In a loosely coupled distributed system, a language does not need to support simultaneous memory sharing.
A tightly coupled system allows more than one running process to access the same memory location.
Associated languages must synchronise the memory sharing so that only one process rights to a shared variable at a time. An example of this would be Ada where two or more procedures execute independently.
The Declarative Paradigm
A declarative language is one in which a program specifies a relation or function. When programming in the declarative side, we make no assignments to program variables. The interpreter or compiler for the particular language manages the memory.
A logic baser program consists of a series of facts, rules of inference and a theorem or query to be proved.
The output is true if the facts support the query and falls otherwise. The programs are sets of basic rules for decomposing problems for example in PROLOG.
In this case programs are written as functions that take arguments and return value. The arguments and returned values may be functions. Programming consists of building the function that computes the answer for example in LISP (list processing), scheme, ML and Haskell.
The Genesis of High-Level Languages
In the early days, computers were programmed using instructions that the hardware understood directly (machine language.
They were more convenient because they were written in a human readable version of machine code (assembly language) that was automatically translated to machine language by an assembler.
Machine and assembly languages are sometimes referred to as the first two generations.
The Third Generation Programming Languages
In the 1950s and 1960s programmers began to realise that assembly language programs were very low level, tedious to write and only usable on a specific type of computer.
This led to the rise of the third generation of languages which are also referred to as high-level languages. The main advancement was to abstract away the details of the hardware and hence become portable to more than one type of hardware.
High-level languages require some form of compiler or interpreter to map the language.
Compilation translates instructions into a form suitable for some other (lower level machines) during execution. That machine maintains program state information.
This may involve some translation. The interpreter maintains program state.
What are some of the trade-offs?
Compilation is an extra step which may make a higher level languages to run a little bit slower than lower level programs.
It may also be very expensive to support a compiler.
Interpretation gives more ability unto the machine to perform diagnostics at runtime for example: BASIC, UNIX shells and LISP.
What is the difference between a compiled program and an interpreted program?
Which is better and why?
A compiled program is already in object code and does not have to be recompiled while an interpreted program is converted to machine language one line at a time. Compiled programs are better because they are faster.
To summarise this whole topic of Paradigm in programming languages. The best choice of which paradigm to use depends on how humans best think about the problem. It all depends on considerations such as; efficiency and compatibility with the existing code.
This can be properly seen in the current situation in America where the government is giving small business loans to people who can not afford to pay their current bills and employee wages. Right now the government websites that are supporting these applications are crashing because of the high volume of applications they are receiving daily.
It is interesting to note that most of these government websites still run on the old type of programming languages and more specifically COBOL (which stands for common business-oriented language).
While it may sound like it is easy to migrate these old platforms to new ones; it is not as easy to convince politicians and especially dealing with government and all the bureaucracies associated with it. These systems need to be created in the modern high-level languages from scratch which will require a lot of time and money which the American government may not be willing to allocate in the current situation.
Private organisations have already upgraded their systems for example Zoom is currently handling about 200 million users daily and has not yet reported of any critical crashes on the platform.
Follow the link below to discover a lot more ;