Professional Documents
Culture Documents
Influences On Language Design
Influences On Language Design
There are several factors influence the basic design of programming languages. The most
important of these are computer architecture and programming design methodologies.
Computer Architecture
The fundamental design of languages has been greatly influenced by computer architecture.
design.
Most of the popular languages of the past 50 years have been designed around the prevalent
computer architecture, called the von Neumann architecture, after one of its originators,
John von Neumann (pronounced “vonNoyman”).
These languages are called imperative languages.
In a von Neumann computer, both data and programs are stored in the same memory.
The central processing unit (CPU), which executes instructions, is separate from the memory.
Therefore, instructions and data must be transmitted, or piped, from memory to the CPU.
Results of operations in the CPU must be moved back to memory.
The overall structure of a von Neumann computer is shown in Figure 1.1.
The “decode the instruction” step in the algorithm means the instruction is examined to
determine what action it specifies.
Program execution terminates when a stop instruction is encountered
Control transfers from the operating system to a user program for its execution and then back to
the operating system when the user program execution is complete.
Functional Languages:
There's another type of language called functional languages, where the main way of doing
things is by applying functions to inputs.
In functional languages, you don't use variables like you do in imperative languages, and you
don't need to give the computer step-by-step instructions.
Some computer scientists think functional languages are great because they have benefits
like simplicity and clarity.
However, because current computers are built on the von Neumann architecture, which
is better suited for imperative languages; functional languages aren't as efficient on them.
Even if functional languages were as efficient as imperative ones, some people might still
prefer imperative languages because they feel more natural to use.
Programming Design Methodologies
In the late 1960s and early 1970s, there was a big shift in how people thought about creating
software.
This was partly because computers became cheaper, so the biggest cost was no longer
buying the hardware, but paying programmers to write the software.
Also, the problems computers were solving became bigger and more complicated, like
controlling entire factories or managing worldwide airline reservations.
These were new ways of planning and organizing how software was built.
Instead of just writing code as they went along, programmers started with a big picture plan
and then broke it down into smaller, more manageable parts.
This made it easier to work on complex projects and find and fix problems.
In the late 1970s, a new approach called data-oriented design became popular.
This method focused more on organizing and managing the data that programs use, rather
than just the steps they follow.
It emphasized creating abstract data types, which are like templates for storing and working
with different kinds of information.
The first language to provide even limited support for data abstraction was SIMULA 67
4. Object-Oriented Design:
This is an even newer way of thinking about software, which started in the early 1980s.
Object-oriented design builds on data-oriented design, but also adds concepts like
inheritance and dynamic method binding.
Inheritance allows programmers to reuse existing code more easily, which can make
development faster and more efficient.
Object-oriented programming developed along with a language that supported its concepts:
Smalltalk (Goldberg and Robson, 1989).
Smalltalk never became as widely used as many other languages, support for object-oriented
programming is now part of most popular imperative languages, including Ada 95 (ARM,
1995), Java, C++, and C#.
5. Language Support:
Object-oriented concepts became especially popular and are now included in many widely-
used programming languages like Java, C++, and Python.
Even functional and logic programming languages have adopted object-oriented features.
6. Procedure-Oriented Programming:
This is a simpler approach to programming where the focus is more on the sequence of
steps to be followed rather than on the data being processed.
While data-oriented methods are now more common, procedure-oriented programming hasn't
disappeared.
Finally, the way we create software has evolved over time, with new methodologies and
programming paradigms emerging to tackle increasingly complex problems. This evolution has
led to the development of new language features and constructs to support these methodologies.
Language Categories
Language Categories: Programming languages are often grouped into four main categories:
imperative, functional, logic, and object-oriented.
3. Visual Languages: Visual languages, like those in the .NET framework, are a subset of
imperative languages. These languages allow developers to create code segments visually, often
through drag-and-drop interfaces. They're sometimes referred to as fourth-generation languages, and
they're commonly used for quickly building graphical user interfaces for programs.
4. Scripting Languages: Scripting languages (like Perl, JavaScript, and Ruby) are also treated
as separate category. However, these languages are essentially imperative languages, despite their
focus on partial or full interpretation rather than compilation.
Logic programming languages, like Prolog, operate differently from imperative and
functional languages.
In imperative languages, programmers specify the exact steps an algorithm should take,
while in logic programming languages, rules are specified without a particular order,
and the system decides how to execute them to achieve the desired result.
7.Special-Purpose Languages:
There are many languages designed for specific tasks, like generating business reports or
instructing machine tools.
These range from Report Program Generator (RPG), which is used to produce business
reports; to Automatically Programmed Tools (APT), which is used for instructing
programmable machine tools; to General Purpose Simulation System(GPSS), which is used
for systems simulation.
1. Conflicting Criteria in Language Design: When designing programming languages, there are
many factors to consider, but often these factors conflict with each other. For example, two
important criteria are reliability (how trustworthy the code is) and execution cost (how quickly the
code runs). There may be conflicts between these requirements.
Example with Java and C: Java, for instance, requires that all references to array
elements be checked to make sure they're within legal ranges. This makes Java programs
more reliable because it catches errors, but it also makes them slower to execute compared
to similar programs written in C, which doesn't have this requirement.
This requirement in Java adds to the reliability of Java programs because it catches errors
like accessing out-of-bounds array elements, preventing unexpected behavior or crashes at
runtime. However, it also adds to the cost of execution because Java needs to perform these
checks every time an array element is accessed, potentially slowing down the program. So,
Java prioritizes reliability over execution efficiency.
3. Example with APL: Another example is APL, which is known for its powerful array operators.
While this makes APL programs very concise and easy to write for tasks involving arrays, it also
makes them very difficult to read because of the large number of symbols and complex expressions.
So, APL prioritizes writability (ease of writing) over readability (ease of understanding).
+/ 1 2 3 4 5
The conflict between factors like writability and reliability is common in language
design.
For instance, C++ allows for flexible manipulation of pointers, which can lead to efficient
code but also raises reliability concerns.
In contrast, Java avoids pointers altogether to prioritize reliability over flexibility.
In C++, pointers are powerful tools that allow programmers to directly manipulate memory
addresses, providing flexibility in how data is accessed and managed.
However, this flexibility comes with a trade-off in reliability.
Mishandling pointers can lead to bugs such as memory leaks, dangling pointers, or accessing
invalid memory locations, which can cause unpredictable behavior or crashes in a program.
While C++ provides the flexibility to manipulate pointers in this way, it also requires careful
management of memory to ensure reliability.
In contrast, Java does not include pointers as part of its language design. Instead, Java uses
references, which are safer alternatives to pointers. Java's memory management is automatic
through garbage collection, which helps to mitigate common reliability issues associated with
manual memory management in languages like C++.
In Java, the language abstracts away the complexities of memory management and pointer
manipulation, prioritizing reliability by reducing the risk of common pointer-related issues seen in
languages like C++.