COS 333: Chapter 1, Part 1
Summary
TLDRThis lecture introduces key concepts of programming languages, emphasizing their importance for understanding language features and making informed choices for projects. It covers evaluation criteria like readability, writability, reliability, and cost, and discusses trade-offs between them. The lecture also explores the significance of studying programming languages in various domains such as scientific computing, business applications, and artificial intelligence, highlighting the unique requirements and evolution of each domain.
Takeaways
- 📘 The first chapter of the textbook lays the groundwork for understanding programming languages, emphasizing its importance for the entire course and for preparing for exams and tests.
- 🔍 The chapter introduces language evaluation criteria, which are critical for discussing the pros and cons of different language features throughout the textbook and on exams.
- 🤔 The importance of studying programming languages is justified through six reasons, including enhancing idea expression, aiding in language selection for projects, and facilitating the learning of new languages.
- 📚 Studying programming languages helps in understanding lower-level implementations, which can improve the way languages are used, reduce bugs, and inform about efficiency trade-offs.
- 🛠️ The ability to simulate features from known languages in a dictated language can be beneficial when certain features are missing, as illustrated by the example of using Visual Basic without object-oriented features.
- 💡 The evolution of programming languages is influenced by a programmer's familiarity and the popularity of languages, which may not always align with the most technically advanced options.
- 🔑 Understanding language concepts allows for better use of known languages by exploiting features that may not be commonly used, such as C++'s template programming.
- 🌐 The study of programming languages contributes to the advancement of computing by enabling more informed choices in language selection for projects, potentially improving the overall standard of programming languages.
- 📈 The textbook focuses on four main evaluation criteria for programming languages: readability, writability, reliability, and cost, each with its own factors and trade-offs.
- 🔄 Trade-offs between language evaluation criteria, such as between reliability and execution cost or between readability and writability, are common and must be considered in the context of specific programming languages.
- 🌟 Different programming domains, such as scientific, business, artificial intelligence, systems programming, and web software, have specific requirements that influence the design and use of programming languages.
Q & A
Why is Chapter One of the textbook considered important for the course?
-Chapter One is important because it discusses preliminary concepts related to programming languages that are used throughout the course and are crucial for understanding the material in semester tests and the final exam.
What are language evaluation criteria?
-Language evaluation criteria are standards used to assess the features of programming languages, discussing their pros and cons, and are central to the textbook's analysis of language features.
Why is it beneficial to study general concepts of programming languages?
-Studying general concepts increases our ability to express ideas, helps choose appropriate languages for projects, makes learning new languages easier, improves understanding of lower-level implementations, allows better use of known languages, and contributes to the advancement of computing.
How does a programming language's ability to express ideas relate to cognitive sciences and linguistics?
-The concept that one cannot express what one cannot describe is related to research in cognitive sciences and linguistics, suggesting that the absence of a word for a concept makes it difficult to think about it, paralleled by the limitations programming languages impose on structures usage.
What is the significance of the trade-offs related to language evaluation criteria in high-level programming languages?
-Trade-offs are important because they often dictate the design and use of programming languages, balancing factors like readability, writability, reliability, and cost against each other to achieve an optimal language for specific applications.
Why is readability an important criterion for evaluating a programming language?
-Readability is important because it determines how easily someone can read and understand a program, affecting maintainability, error reduction, and the ability to collaborate with other programmers.
What is the relationship between a programming language's simplicity and its readability?
-A programming language's simplicity contributes to its readability by having a manageable set of features and constructs, reducing the potential for confusion and making programs easier to understand.
How does the concept of orthogonality in programming languages affect readability and writability?
-Orthogonality, where a small set of constructs can be combined in various legal ways, improves both readability and writability by making the language context-independent and reducing confusion for the reader and writer.
What factors contribute to the writability of a programming language?
-Writability is influenced by the language's simplicity and orthogonality, support for abstraction, and overall expressivity, which together determine how easily a programmer can construct a program.
How does the support for exception handling in a programming language impact its reliability?
-Exception handling mechanisms allow a programming language to intercept and recover from runtime errors, thus improving reliability by preventing crashes and unexpected behavior.
What are some of the trade-offs between different programming language evaluation criteria?
-Trade-offs can occur between reliability and execution cost, readability and writability, and flexibility versus reliability, with languages often needing to balance these factors based on their intended use and design goals.
Why is understanding the cost of using a programming language important?
-Understanding the cost is important as it includes factors like training, writing, compiling, executing, implementing, maintaining programs, and reliability, all of which affect the overall efficiency and economics of software development.
What are some additional factors that might influence the cost of maintaining programs in a programming language?
-Factors influencing the cost of maintaining programs include the language's readability, writability, reliability, and the existence of robust documentation and community support.
How do different programming domains influence the design and features of programming languages?
-Programming domains dictate the intended application area for a language, influencing its design to prioritize features beneficial for that domain, such as efficiency for systems programming or support for symbols manipulation in AI.
Outlines
📚 Introduction to Programming Language Concepts
The script begins by emphasizing the importance of understanding preliminary concepts in programming languages, as they are fundamental to the entire textbook and relevant for semester tests and exams. The lecture will cover the reasons for studying programming languages, language evaluation criteria, trade-offs related to these criteria, and the application of high-level programming languages in various domains. The first reason discussed is the enhancement of idea expression through language constructs, drawing a parallel with George Orwell's '1984' to illustrate the concept of linguistic relativity.
🔍 Choosing the Right Programming Language
This paragraph delves into the second reason for studying programming language concepts, which is to assist in selecting the appropriate language for a project. It acknowledges that programmers' choices may be limited by their familiarity with certain languages or by company requirements. The paragraph also highlights the importance of general language knowledge in making informed decisions about language features that are directly supported versus those that need to be simulated.
🚀 Accelerated Learning of New Programming Languages
The third reason for studying programming language concepts is to improve the ability to learn new languages quickly. As the field of programming is relatively young and continuously evolving, understanding general concepts helps in adapting to new languages and interpreting their features effectively. This knowledge also aids in deciding whether to adopt a new language based on its feature set.
🛠 Understanding Lower-Level Implementations
Studying programming language concepts also provides a deeper understanding of how languages are implemented at a lower level. This comprehension allows for the intended use of languages, potentially streamlining development, reducing bugs, improving debugging, and understanding efficiency trade-offs. The script mentions that while these topics are important, the course will not focus extensively on compiler construction details.
💡 Enhancing Familiar Language Usage
The fifth reason discussed is the enhancement of using programming languages that one already knows. Modern languages are complex, and programmers often only utilize a subset of features they are familiar with. Understanding additional features within a known language can lead to more effective exploitation of its capabilities, such as using templates in C++ for compile-time operations.
🌐 Advancing Computing Through Language Concepts
The final reason for studying programming language concepts is altruistic, focusing on the advancement of computing as a whole. Understanding language design issues can lead to better language choices in projects, promoting the evolution of better programming languages over time. The paragraph also introduces programming language evaluation criteria: readability, write-ability, reliability, and cost, which are central to the textbook and course.
📖 The Importance of Readability
This paragraph examines the first language evaluation criterion, readability, which is about how easily one can understand a program. It discusses factors contributing to readability, such as simplicity, minimal feature multiplicity, and operator overloading. The concept of orthogonality is introduced as a significant factor affecting readability, with examples of how it can lead to confusion if overused, as seen in ALGOL 68.
🔑 Readability Factors: Syntax and Data Types
The paragraph continues the discussion on readability, focusing on syntactic considerations such as identifier forms, special words, compound statements, and the form and meaning of syntactic features. It also touches on the importance of having an adequate set of predefined data types and structures to avoid confusion and enhance readability.
🛠️ Write-ability: Simplicity and Abstraction
The focus shifts to write-ability, the ease of constructing a program in a language. Factors such as simplicity, orthogonality, support for abstraction through sub-programs and object-oriented programming, and the expressivity of the language are discussed. The paragraph explains how these elements can make a language more writable, although there is often a trade-off with simplicity.
⚔️ Reliability: Type Checking and Exception Handling
Reliability is the third evaluation criterion, which involves the language's ability to prevent errors. The paragraph discusses the importance of compile-time type checking, support for exception handling, and the implications of aliasing through pointers or references. It also connects readability and writability to reliability, suggesting that natural expression in a language contributes to fewer errors.
💰 Cost: Training and Execution
The final evaluation criterion from the textbook, cost, is explored in this paragraph. It includes the costs associated with training programmers, writing and compiling programs, and the language implementation system. The script also invites the audience to consider how the previously discussed criteria might affect the cost of maintaining programs and to contemplate other potential cost-influencing factors.
🔄 Trade-offs and Programming Domains
The paragraph concludes the lecture by discussing trade-offs between different programming language evaluation criteria, such as reliability versus execution cost, and readability versus writability. It also introduces the concept of programming domains, explaining how different languages are designed for specific application areas like scientific computing, business applications, artificial intelligence, systems programming, and web software development.
Mindmap
Keywords
💡Programming Languages
💡Language Evaluation Criteria
💡Readability
💡Writeability
💡Reliability
💡Cost
💡Orthogonality
💡Abstraction
💡Expressivity
💡Portability
💡Programming Domains
Highlights
Chapter one emphasizes the importance of understanding preliminary concepts in programming languages for their application throughout the course and in exams.
Language evaluation criteria are crucial for discussing the pros and cons of different language features and are frequently tested.
Studying programming languages can enhance the ability to express ideas, supported by cognitive science and linguistic research.
The novel '1984' by George Orwell is used as an analogy to explain the limitation of expression without specific language constructs.
Knowledge of programming language features can allow for simulating missing features in a dictated language, as illustrated with Visual Basic.
Understanding language concepts aids in choosing the appropriate programming language for a project.
General knowledge of programming languages is beneficial for making informed choices when a programmer has language options.
Studying programming languages accelerates the learning of new languages and interpreting their literature.
A deeper understanding of language concepts improves the use of known languages and exploits their full potential.
Studying language concepts contributes to the advancement of computing by enabling better language evolution and selection.
Readability is defined by the ease of understanding a program and is influenced by language simplicity and constructs.
Orthogonality in programming languages allows for a small set of constructs to be combined legally in various ways.
Support for data types and syntactic considerations, such as identifier forms, affect a language's readability.
Writeability is the ease of creating programs and is often in opposition to readability, yet both benefit from language simplicity and orthogonality.
Reliability of a programming language is determined by type checking, exception handling, and the language's overall safety.
The cost of using a programming language includes training, writing, compiling, executing, and maintaining programs.
Trade-offs between language evaluation criteria, such as reliability versus execution cost, are common in language design.
Different programming domains, such as scientific, business, AI, systems, and web software, dictate the intended use and features of a language.
Transcripts
we'll begin with chapter one which
discusses
some preliminary concepts related to
programming languages now this chapter
is
very important and the concepts
discussed here are used throughout all
of the remaining chapters
of the textbook that we will be
discussing through this course
but are also very important for
questions that you
will see in semester tests as well as
the exam
so please pay very careful attention to
this chapter
and make sure that you understand all of
the concepts that are discussed
these are the topics that we will be
discussing through the course
of this lecture so we'll begin
with a discussion on why we are
in fact studying concepts of programming
languages
in the first place and we'll then move
on to a discussion on a number of
language evaluation criteria
and these language evaluation criteria
are used throughout the
rest of the textbook in order to discuss
language features and the pros and cons
associated with
different ways of adding these features
to high-level programming languages
now these language evaluation criteria
are probably the most important part
of the first chapter and they definitely
will come
up repeatedly within semester tests and
the exam so please pay a lot of
attention
to these language evaluation criteria
we'll then be
looking at some trade-offs related to
the language evaluation criteria that
are very often seen within
high-level programming languages and
then we'll finish off this lecture with
a discussion on programming domains
within which
high-level programming languages are
used
so to begin with i'd like you to pause
the video at this point
and consider why
you think it is important to study
general concepts
related to programming languages
so the textbook for this course
discusses
reasons for studying general concepts
related to programming languages
under six separate headings which you
can see
summarized over here so we'll be looking
at each of these reasons in some detail
in the coming slides
the first reason for studying concepts
within programming languages is that it
increases our ability to express
ideas and this is related to the concept
that one cannot express what one cannot
describe
so this is related to some fairly
interesting research within the
cognitive sciences
as well as linguistics where the idea
is that if one doesn't have a word for a
particular concept
it's very difficult to even think about
that concept
so this is illustrated relatively nicely
in the novel
1984 by george orwell in which
a totalitarian government essentially
outlaws
certain words related to standing up
against the government
and challenging it and what this results
in
is a populace that is really unable to
even
form the concept of rising up against
the
government so in a similar fashion
a programming language limits the
structures that one
can use so a fairly simple example of
this
would be a programming language that
doesn't provide
any object-oriented programming related
features
and in this case you wouldn't then be
able to use
those features to for example build
fairly complex data structures
however in certain situations the
language that one uses
is dictated so for example if you are
working for a company
and they require the use of a particular
programming language
for a certain project and so in this
case
the dictated language may then not
provide
certain features and certain structures
however if you know about how those
features
are implemented in other programming
languages it may then be possible for
you to
simulate them using the features that
are provided within the language
so for example i was
involved in a software development
project
shortly after graduating
from my undergraduate degree and in that
project
we were forced to use the visual basic
programming language now at that stage
visual basic didn't support
any object-oriented programming concepts
however because we knew about
object orientation we could use in the
structures that were provided
within visual basic to construct an
object-like
environment which then facilitated the
development
of our project
the second reason for studying
programming language concepts
is that they help us choose appropriate
programming languages
for a particular project now this of
course is
only applicable in a situation where a
programmer actually has a choice
of a programming language to use for a
project
now very often in a real-world situation
a programmer may be limited in terms of
the number of programming languages
and that they are familiar with this may
be because the programmer received
in-house
training by a company and in that case
the training would only have covered
the specific programming languages that
are used
within the company alternatively a
programmer may have been formally
trained very long time ago
and of course as time progresses new
programming languages
are developed and these languages might
be more appropriate for
a particular project than the language
that the programmer
is familiar with and so if
in this situation the programmer has a
general
knowledge of language concepts
then it will allow the programmer to
make an informed choice
in terms of which programming language
would be used for a particular
project and this is important because it
is obviously better to use
a directly supported feature than
attempting to
simulate a feature so for example if you
know that a project
is going to require complex data
structures
you would then focus the selection
of your programming language that you
would use for that
project and specifically on programming
languages that have good support
for object-oriented programming concepts
the third reason for studying
programming language concepts
is that it increases our ability to
learn
new programming languages so programming
is still a very young discipline the
very first high-level programming
language was developed
in the 1950s and this may seem like a
very long time ago but in comparison
to other sciences this is in fact a very
short
period of time so what this means
is that new programming languages are
constantly evolving
new languages are being developed every
few years
and also usage patterns of existing
programming languages constantly change
so for example when i was undergraduate
java was
the big up-and-coming language and these
days with the
rise of data science scripting languages
such as python and r
have become much more popular so
understanding then general concepts
related to programming languages will
help us
reduce the time that it will take us to
learn
a new programming language
also it will help us to interpret
literature on new programming languages
so we will be able to read about the
feature set provided by a new
programming language
and this will allow us then either to
decide to learn this programming
language or
discard the programming language because
it doesn't support features
that we are interested in
the fourth reason for studying concepts
within programming languages is that it
gives us a better understanding
of the lower level implementation of
these programming languages
so this allows us thing to understand
why programming languages work the way
that they do
and the knock-on effect of this is
that it will allow us to use programming
languages
as they were intended to be used there
are many benefits to this
for example it may streamline the
development process and make it easier
it might also cut
down on bugs that might
result from using language features in a
way that they were not
meant to be used and also allows us to
understand
low-level bugs better and obviously that
will help
us in our debugging efforts
and finally it will also help us to
understand
efficiency trade-offs so for example if
we know
that support for object-oriented
programming concepts
results in a performance hit on a
programming language
then we will be better equipped to
decide whether we should use an
object-oriented
programming language or not now
this being said we won't be focusing too
much
on lower level implementation details
and there are a number of sections and
chapters included
within the textbook that discuss these
concepts in more detail
but because this relates more to
compiler construction
we're going to be skipping over these
sections
within this course as i will be
presenting it
the second last reason for studying
programming language concepts
is that it allows us to better use the
programming languages that we
already know and are familiar with so
modern programming languages are
incredibly large
and very complex for example if we look
at c
plus the language specification is over
1
300 pages long so what this means
is that many programmers will only use
a subset of features within the
languages
that they know and those would be the
features that they
are familiar with that possibly they
were taught during their degrees
or they learned during in-house training
so if one knows then about
features within the programming language
that you are using
then it will allow you to exploit those
features
so for example in c plus
there is support for generic programming
by means of templates um
so of course if you don't know about
templates
you won't be able to use them but
knowing about template programming
allows you then
to leverage that feature and it allows
you
to construct code that can do
things at compile time which you would
not be able to do
via any other means the final reason
for studying programming language
concepts is
probably the most noble and altruistic
of the
six reasons and this is because it
doesn't
directly relate to a programmer's
day-to-day job
so understanding these concepts then
allows for the overall advancement
of computing in general
so language evolution is incredibly
complex and we'll talk about this in
more detail
within chapter two however languages
evolve from
one another they take inspiration from
other languages
some programming languages are mashups
of
a variety of different features from a
number of different programming
languages
so very often what we see
during this evolutionary process is that
language popularity
is often not very well founded
so a good example of this which we'll
discuss in more detail in chapter 2
is the language algol 60 versus
fortran so fortran was the very first
high-level programming language
algol 60 came out a little while after
fortran had been released and accepted
by most of the programming industry
and alcohol 60 introduced a large number
of
very important features which we see
in every modern programming language
today very notably for example
algol 60 was the first high-level
programming language to
introduce support for recursion
whereas fortran didn't support recursion
at that stage
however largely because fortran was
so popular to begin with and it was
used by many people within the computing
industry most of
these programmers stuck with fortran
many of them didn't understand the
features that were introduced within
algol 60. so this in effect
really held back the evolution
of programming languages and computing
in a general sense
so if people then had a better
understanding
of the underlying issues related to
programming language design
then the people in charge for example
project managers
would be able to choose better
programming languages for their projects
and so over time better and better
languages would eventually dominate
and this would result in an overall
improvement
in the standard of programming languages
that are available
so now that we have justified why we
are studying general programming
language concepts
we will move on to the programming
language evaluation criteria
so as i've previously mentioned this is
the most important part
of the first chapter and it is possible
for us to divide
define a large variety of different
evaluation criteria
however the criteria that the textbook
focuses on
are readability write-ability
reliability and cost
so the readability criterion defines
how easy it is for
someone to read and understand a
program or a program feature
writeability on the other hand is
essentially the opposite of readability
so this defines how easy it is
for a programming language or a
programming language feature
to be used in order to create a program
and what we will see is that very often
readability and writeability
are at odds with one another the third
criterion
is reliability so this specifies whether
the language or language feature
performs according to its specifications
under all conditions and then finally we
have the cost
criterion which is the ultimate total
cost
of using a language or a language
feature
now cost is not necessarily
a monetary cost although it very often
is
it may entail other kinds of costs for
example
a time cost so we will be
looking at these language evaluation
criteria in more detail
in the following slides let's first
take a look at the language evaluation
criterion
of readability so here we are talking
about
the ease with which somebody can read
and understand
a program written in a particular
language
now there are a lot of different
features that contribute to the overall
readability of a programming language
and one very important one is the
overall simplicity
of the language and its constructs so
what we want for a programming language
to be readable
is that it should have a manageable set
of features
and constructs if you have
a relatively small set of features it
means that the reader is less likely to
be
confused by a program written in that
language
we also want minimal feature
multiplicity so
this means that we want to have as few
ways as possible
of doing one particular thing within the
language
so for example if we consider languages
like c
c plus plus and java we see that
incrementing a value has a number of
different ways in which this can be
achieved so for example we can just use
a standard assignment operator
we can use a pre-increment or a post
increment
and we can use the plus equals operator
so here we have then one single
operation
incrementing a value that has a number
of different ways to achieve that
and again this will potentially lead to
greater confusion
on the part of anybody reading a program
written in this language
we also want minimal operator
overloading so we don't want to use the
same
operator to mean a number of different
things
so a good example of this is in c
plus where we have the asterisk operator
and this in one context means that we
are multiplying
two values by one another in another
context it means
that we are defining a pointer in other
words defining a memory address
and in another context it means that we
are dereferencing the points
in order to get its value so this
obviously
then increases the potential for
confusion on the part of somebody
reading a program
however we don't want too much
simplicity
because this can also be bad for
readability
and the reason for this is if a language
is too simple it has too few constructs
it means that programs then will
generally
have to become longer in order to
achieve more complex operations
and a longer program is more difficult
to understand than a shorter program
now the next contributor to the
readability of a programming language
is orthogonality and this is a very
important concept to understand
it will definitely come up several times
during
the semester tests and the exam for this
course
so when we're talking about
orthogonality
we are talking about a degree of
orthogonality there's no
such concept as a perfectly orthogonal
language
or a perfectly non-orthogonal
programming language
now for a programming language or a
feature to be
orthogonal we want a relatively small
set
of primitive constructs that can be
combined in a relatively small number of
ways
and every possible combination is legal
now the important thing to understand
here is that the focus of this
definition
is not so much on the number of
primitive constructs that we have within
a programming language
it's more focused on whether the
combinations in which these primitive
constructs can be used
are all legal so an orthogonal
programming language
feature then is also context independent
and a lack of orthogonality can be
identified by
means of exceptions within the use
of the primitive constructs in a
programming language
so a good example of this then
might be for example a multiplication
operator
if multiplication uses the
same operator for integer multiplication
as well as all of the various floating
point
multiplication operations then we have a
very
orthogonal multiplication operator
if however as was the case in very early
programming languages
and we have a different operator for
integer multiplication
versus floating point multiplication
because these operations are
fundamentally different on a machine
level
then we have a breakdown of
orthogonality
and this is because the combination of
multiplication
operators does not work in every single
case we
cannot for example multiply an integer
with a floating point value
related to exceptions if we
have for example a situation
where we have functions supported within
our programming language
and functions can return certain values
but not
other values so for example if a
function is restricted in terms
of being able to return an array
then in this case we have an exception
that occurs in terms
of what is allowed by means of the
return value of a function
and this then indicates that we have a
breakdown
of orthogonality if any value supported
within the programming language can be
returned by a function
then we have very high orthogonality
now orthogonality is not always a good
thing
if there's too much orthogonality in a
programming language then this can be
very bad for readability
now this isn't so much an issue with
modern programming languages
but if we look at alcohol 68 which we'll
speak about
in chapter 2 then we see that this
language was designed
with very high orthogonality in mind
so for example almost every single
construct in algol 68
can produce a value as a result
so what this means is it is then
possible to create
constructs within the programming
language that allow you to for example
assign to a selection statement an if
statement
now obviously due to this very high
level of orthogonality
the meaning of these kinds of
assignments
are not necessarily very clear
and this then of course leads to
potential confusion which means that the
language is then
less readable
another factor that affects the
readability of a programming language
is the support for data types within
that language
so what we want in order for a
programming language to be readable
is an adequate set of predefined data
types
and data structures and the reason for
this
is that if a type that we need within
the programming language
is missing then we need to simulate that
type
somehow so a good example of this would
be
a language that doesn't directly support
boolean types
which was the case in some of the
earliest
programming languages and in this case
in order to
simulate a boolean value you would need
to use some sort
of integer value this of course then
leads to
confusion because you now need to know
which values map to true values and
which values map to
false values and so this potentially
then
increases confusion and breaks down the
readability of the programming language
then a final factor that affects
readability
is syntactic considerations within the
programming language
so there are a variety of factors
that might be related to the readability
of syntax
first of all the form of identifiers
within the programming language so when
we're talking about
identifiers we're talking about the
names of
variables or the names of sub-programs
such as functions
or methods or routines or whatever they
are called in
the particular programming language you
are considering
so some languages then have naming
restrictions
others have very relaxed naming
restrictions or no restrictions at all
and if you of course then have a lack of
naming restrictions then this means that
you can create
very descriptive names which then of
course improves the ability
of someone to understand the program
code that you've written
so a good example of where this might
break down would be
in the early versions of fortrans and
the first released version of fortran
identify names were limited to six
characters
and in the initial specification of the
language it was even fewer characters
a maximum of two characters were allowed
per
identifier so of course these kinds of
restrictions then mean that you can't
have very descriptive
identifiers which means that you have to
use abbreviations
which might be then unreadable
next the use of special words within the
programming language can also affect
readability
so what we want here is a sensible
set of special words which will then be
more readable
so we want our special words typically
to reflect
exactly what their purpose is within the
programming language
so for example it might be argued
that a while loop construct is possibly
less readable
than something like a repeat until
or repeat while particular condition
holds
and then compound statements in other
words blocks
might also affect the readability of
a programming language so for example if
we look
at languages like c c plus plus java c
sharp and so on compound statements
are indicated by means of braces and as
i'm sure
a lot of you have experienced in
the past it becomes relatively difficult
in certain situations to match the
beginning and the end of a block
if braces simply are used some other
programming languages go for a slightly
more
verbose kind of notation so for example
we might have for an if statement and
end if which would close off the
body of the if statement and for a while
loop we might have an end
while or end loop statement arguably
these more verbose
statements then are much clearer at
indicating
where the end of a particular block is
because
they match more descriptively with the
beginning of the block
then the form and meaning of
syntactic features within a programming
language may also affect
readability so we generally want
um self-descriptive constructs and
meaningful keywords
um and we want to avoid language
constructs that have the same name
but have a different meaning depending
on the context
so a good example of this would be in c
plus where if we are considering
object-oriented
programming constructs the special word
static is used to indicate a class level
variable
however static can also be used in the
context
of a static local variable within a
function
these two uses of the keyword static in
fact mean
completely different things and
therefore this could lead
to confusion and therefore a breakdown
in the readability of programs written
in c
plus now that we've discussed
the readability evaluation criterion
we will move on to write ability of a
programming language
so here we are considering how easy it
is for a programmer to construct a
program
within the programming language under
consideration
again there are a number of factors that
can affect writability
the first of which is the general
simplicity
and orthogonality of the programming
language
so if a programming language has a
fairly small set of constructs a small
number of primitives
and then a small set of rules
for combining these various primitives
and
constructs in a uniform
context-independent manner
then we are likely to have a more
writable programming language
so what we see here then is that
simplicity and orthogonality
can improve both the readability and the
writability of
a programming language and the reason
that
it improves the writability of a
programming language
is that the programmer will be less
likely to be confused
by the operators and primitives
and constructs and how they can be
combined
which means that they can program in a
fairly natural way
meaning that the language is then more
writable
secondly we have the support for
abstraction that is provided by
a programming language or features
within the programming language
and what we're talking about here is the
ability to define
and use complex structures or operations
in ways that allow details to be ignored
so you should have realized by now
through the course of your studies that
abstraction is a fairly core
concept within programming in general
and the broadly speaking two kinds of
abstraction
that we can define firstly there's
process abstraction which is provided by
means of
sub-programs so here we have a situation
where we could
for example write a sub program in other
words a
function or a method or a procedure
that might for example sort an array of
values
once we've defined this subprogram we no
longer
need to worry about how sorting takes
place
we simply use this other program that
we've written
then secondly we have data abstraction
and this is supported by means of
object-oriented programming concepts
so things like classes and inheritance
and then to go hand-in-hand with those
we have
support for pointers and dynamic memory
management so
of course the support for object
oriented programming also allows us to
abstract details away
we can define a class and then once
we've defined that class we don't need
to worry about how the class actually
functions we just simply need to know
what the class
does then finally we have the overall
expressivity of our programming language
now expressivity is oftentimes
in opposition to simplicity
and what we're talking about when we are
discussing the expressivity of a
programming language
is that we want a set of relatively
convenient ways
of specifying operations and this
relates
to the overall strength and the
number of operators and predefined
functions that the programming language
provides
so if we have a very rich programming
language that provides a large number of
operators and different ways of
achieving
specific operations it provides a lot of
predefined functions for doing things
like creating data structures sorting
values in arrays or lists and that sort
of thing
then we have an incredibly expressive
language this allows
the programmer then to use a number of
concepts to create
a very rich program that
has a lot of power in terms of what it
can do
but of course providing a very rich set
of operators and predefined functions
is in contradiction to the overall
simplicity of the programming language
so oftentimes a high-level programming
language
needs to strike a balance between the
expressivity
and the simplicity of the programming
language in order to
achieve a high level of writability
the third language evaluation criterion
that we'll consider
is the overall reliability of a
programming language
or a feature within a programming
language again
there are a variety of different factors
that interact in order to
either increase or decrease the
reliability of a programming language
and the first and possibly one of the
most important
of these factors is the type checking
supported by
a programming language so here we're
talking about
the ability of a programming language to
test for type errors
for example in assignments checking to
see whether the value being assigned
is compatible with the type of the
variable that is being assigned
to and we'll be talking about type
checking in quite a lot of detail
in the coming lectures
however in general compile time type
checking is usually preferable to
runtime type checking
and the reason for this is that runtime
type checking can cause unpredictable
errors
while the program is executing whereas
compile time type checking will turn up
the type errors before the program is
run
secondly we have support for exception
handling within a programming language
and as you should know by now exception
handling is a mechanism provided by a
programming language in order to
intercept
areas that occur at runtime and then
take some kind of corrective action
in order to recover from these errors
obviously
good support for exception handling is
preferable in terms of reliability
because it gives
us more tools in order to recover
from errors that might occur during
execution then we have
support for aliasing within a
programming language
so here we are talking about the ability
of a programming language
to have two or more distinct referencing
names for the same
memory location now usually aliasing is
supported by means of either pointers
or references and generally speaking
aliasing is considered to be a
relatively dangerous feature if it's not
used correctly
particularly in the case of pointers in
terms
of your experience with programming
languages like c
plus you should at this stage be fairly
familiar
with issues like dangling pointers and
memory leaks
and these are all facilitated by the
support that c
plus provides for aliasing
then we also have an overall
contribution
of the programming language's
readability and writability which
can also affect the reliability of the
programming language
and this basically boils down to whether
the language supports
natural ways of expressing algorithms
written
in that language natural ways
will typically be very readable as well
as very writable
and if natural methods for expressing
these ideas are not provided by
programming language
then the programmer will be forced to
use an unnatural approach
which will then negatively affect
reliability
and because these unnatural approaches
will typically be
more error-prone
the final evaluation criterion that the
textbook focuses on
is the overall cost of using a
programming language
now of course there are many factors
that can affect this cost
some of them are listed on this slide
but it is certainly possible to come
up with other factors that might have a
cost
impact so once again as i've previously
mentioned the cost might be a monetary
cost but it might also be
something like a time based cost
so first of all we have the cost of
training programmers to use
a programming language this of course
has a time impact but it might also be
a monetary impact if you have to hire
people to train your programmers
or buy licenses for some sort of online
training program
secondly we have the cost of writing
programs
so this relates to the closeness of the
programming language to the intended
application area
so as we will see certain programming
languages are designed for certain
application
areas so for example if you have
a programming language that is designed
for business applications
it would of course then cost a lot more
time
if you were to use this programming
language to attempt to write
scientific applications so again this
relates to
using the correct tool for the job
then we have the cost of compiling
programs and the cost
of executing programs and very often
there's a trade-off
between these two costs so if you
have a very high cost
to compilation this usually means that
the execution cost of
your programs will be lower and vice
versa
we'll speak about this in some more
detail in the upcoming lecture
then we have the cost of the language
implementation system that is used
so this basically relates to the cost of
compilers
are free compilers available or are
there only proprietary compilers that
one must purchase
then we have the cost of reliability
so poor reliability obviously leads to
higher costs
if software breaks there are cost
implementations in terms
of fixing the software um there might
even be
costs related to for example court cases
that might stem
from faulty software and then finally we
have the cost
of maintaining programs within our
programming language
which may relate then also to the
reliability of the programming language
so i'd like you at this point then
to pause the video and consider which of
the programming
language evaluation criteria that we've
discussed prior to cost
would affect the cost of maintaining
our programs so
at this point i'd also like you then to
stop
for a moment and consider potential
other factors
that might maybe influence the cost of
using a programming language
and out of the factors listed on this
slide
i would like you to consider which one
or two or three of the factors
has the most impact in a modern day
context
now the previous four evaluation
criteria that we've discussed
namely readability writability
reliability and cost
are the evaluation criteria that the
textbook and this
course focus on however as i've
previously mentioned it is possible to
define
other criteria in terms of which one
could evaluate a programming language
so on this slide we have just three of
these firstly the
portability of a programming language so
this relates to how easy it is
to migrate a program from
one implementation to another for
example some languages such as java
allow you to very easily migrate a
program written for example in windows
to an apple mac without even necessarily
needing to recompile the program
other programming languages like c plus
make portability fairly
difficult and it is required to
initiate a fairly um
detailed and wide-ranging rewrite of the
software to move it to
another hardware or compiler
platform then we have the generality
of a programming language so this
relates to whether the programming
language
is applicable to a wide range of
applications
as we're going to see in chapter 2 some
programming languages are designed
for specific application areas for
example business processing or
scientific computation other programming
languages
such as c and c plus plus are very
widely applicable and you can write
programs for a lot of different domains
using the same programming language
then finally we have how well-defined
the programming language in question is
and this relates
to the official definition of the
programming language in terms of how
complete and precise that definition is
so for example if we look at early
versions of c and c
plus plus we see that the language
specifications were relatively
informal and this led to a lot of
confusion
in terms of how compilers should
implement the programming language
and how the programming language should
be
used more modern programming languages
such as java and c-sharp
for example have very detailed and
accurate
language definitions and this leads then
to
far fewer mistakes related to the
interpretation of these standards
now that we've discussed a variety of
different programming language
evaluation criteria
we can take a look at some of the
trade-offs
involved between these criteria now on
this slide we have only three examples
of trade-offs but there are many other
kinds of trade offs that may exist these
are just some fairly common ones that
you will run into in practice
so first of all a programming language
might provide a very good reliability
but this might come at the expense of
a poor cost of execution for this
programming language
so a good example of this is java in
which
all references to elements within an
array
are checked for proper indexing if you
attempt to index beyond the bounds of an
array
then java will raise some kind of
exception
now this of course increases the
execution
cost because a bounce check needs to be
performed with every single
array access a language like c
plus would not have this increased
execution cost
because it performs no balance checking
at all on array accesses
java however then is much more reliable
because
you are able to catch every situation
where an accidental case of indexing
beyond the bounds of the
array occurs whereas for example c plus
plus would have
reduced reliability because of this
and then we may also have a trade-off
between the readability and the
writability of
a programming language a good example of
this
is the programming language called apl
or
apple depending on who you ask
and we'll be talking about this language
in some more detail
when we move on to chapter two but
um apl or apple provides a
set of very powerful operators
there are operators for example that can
perform
matrix transpositions or inversions in
a single step now there are so many
operators within
this programming language that it
requires a large number of new symbols
which are actually not represented on a
standard keyboard so this then
allows for an increase in writability
because it allows us
to construct very complex programs
using very few characters the programs
written in apl are typically
fairly short however the readability is
very poor because
you have to attempt to decipher
this large set of symbols in order to
understand
what the programs do then we might
also have trade-offs between the
writeability of a programming language
in terms of its flexibility
versus the reliability of the
programming language
so a good example of this is in c plus
we know that there is support for
pointers and pointer arithmetic
so pointers are very powerful they add a
lot of flexibility to the c
plus plus programming language they
allow us
to create aliases they allow us to do
dynamic memory management
ourselves and they're very flexible
however
as i've previously mentioned pointers
are fairly dangerous to use and
therefore they negatively affect
the reliability of our programming
language
now what's important to understand here
is that
these trade-offs don't necessarily occur
in this way for every programming
language it is for example completely
possible for us to have a programming
language
that is both very readable and very
writable so it's important in terms of
questions related to trade-offs between
language evaluation criteria
to understand the context of the
question and answer appropriately based
on that context
the final issue that we'll be
considering in this lecture
is the existence of different
programming domains
so when we talk about programming domain
we're talking about
the intended application area for a
programming language
and what we'll see particularly through
the course of chapter 2 is that
different
programming languages were devised with
different intended
purposes so first of all we have
scientific application areas and this
was in for
in fact the context that the
very first high-level programming
language namely fortran
was developed for so typically
scientific applications
require very efficient floating point
computations
and also support for efficient array use
and this is because typically in a
scientific application area
you're interested in computing
statistics for values therefore you need
support for floating point
computations and you're usually working
with
lists of observations or readings or
measurements
and therefore you need support for
arrays so a good example of this
of course then is fortran the next
application area
also one of the earliest application
areas was
for business application writing
so here you are interested in the
programming language that supports
reports in other words it needs good
string and character handling
and also the use of decimal number
values now we'll talk a little bit
more about decimal number values in
upcoming lectures
however they differ from floating point
values in
that they are more accurate
representations
of specific decimal values and we would
use decimal
number representations to represent for
example
monetary values or currency exchange
rates and those kinds of things
where a high degree of accuracy
is necessary so a good example
of a language designed for business
applications
is cobalt the very first programming
language developed for this
intended purpose the third programming
domain
that we'll consider is that of
artificial
intelligence um so these days
general purpose programming languages
are very often used for artificial
intelligence
but if we look at earlier artificial
intelligence applications
and of course still work that happens
today
we would be interested in manipulating
symbols
rather than numbers where symbols
represent concepts
or ideas or objects within an
environment that we want to manipulate
and then also support four linked lists
where we would want to represent for
example
objects in an environment that are
related to each other
in some kind of way we would then use a
linked list representation which can
grow and shrink
as we add objects and remove them from
our environment
a good example of an early language that
was intended for artificial intelligence
applications
is the first functional programming
language namely
lisp but we will also see
that the prologue programming language
was also designed for artificial
intelligence
applications then we have systems
programming so what we are talking about
here
is programming languages that are
designed
for writing lower level systems such as
operating systems
or control systems so here the primary
focus is on the efficiency of the
programming language because these
systems
are typically used continuously it's no
good if an operating system for example
every time
that it needs to create
a write operation to a file locks
up the entire execution of the whole
operating system
so we need very efficient languages that
support very efficient
structures within those languages a good
example here is the c programming
language
very efficient but potentially depending
on how you use the language
fairly unreliable as well and then
finally
we have the web software programming
domain
we won't be focusing on this domain a
lot within this course
we already just mention it fairly
briefly in places
but generally here we have an eclectic
collection
of languages be they programming
languages or
markup languages so in a typical
web software context we would usually
use a combination
of a markup language such as html or
possibly xml
we may combine that with scripting
languages such as php
or python for example and we may even
include
some general purpose programming
languages such as
java by means of embedded java applets
right so that concludes the first
part of our discussion on chapter one
in the next lecture we will be finishing
off the first chapter of the textbook
in preparation for moving on to our
history lesson in terms of the evolution
of high-level programming languages
5.0 / 5 (0 votes)