Scripting and Programming C173: Unit 9 – Language Survey

9.1 Language survey

Compiled vs. interpreted languages

Many kinds of programming languages have evolved, serving different purposes. One kind is a compiled language. A program written in a compiled language is first converted by a tool (compiler) into machine code, which can run on a particular machine. Examples include C, C++, Java, and C#.

In contrast, an interpreted language (aka scripting language) is a language that is run one statement at a time by another program called an interpreter. Examples include Python, Javascript, and MATLAB.

Interpreted languages tend to be easier for new programmers, who don’t have to run a compiler. Also, an interpreted language’s program can run on any machine that has an interpreter. But compiled languages run faster.

  1. A programmer writes a high level program, known as source code.
  2. For a compiled language, the programmer runs a compiler, which converts the high level program into an executable program.
  3. Users can then run the executable.
  4. For an interpreted language, the programmer still writes a high level program. But then a user runs an interpreter to run that program.
  5. Interpreted languages are easier on the programmer and can run on any machine that has the interpreter, but may run more slowly.

Statically vs dynamically typed languages

Most compiled languages are statically typed, meaning each variable’s type must be declared and cannot change while the program runs. (“Static” means unchanging). C, C++, and Java are popular examples. In contrast, many interpreted languages are dynamically typed, meaning a variable’s type may change while a program executes, usually based on what is assigned to the variable. (“Dynamic” means changing). Python is a popular example.

Statically-typed languages are often considered safer due to reporting errors during compilation (like if assigning an integer with a string), while dynamically-typed languages are considered easier to use when types need to change, requiring less converting or fewer variables. Much debate exists.

Object-oriented languages

A large program thought of as thousands of variables and functions is hard to understand. A higher level approach is needed to organize a program in a more understandable way.

In the physical world, people are surrounded by basic items made from wood, metal, plastic, etc. But to keep the world understandable, we think at a higher level, in terms of objects like an oven. The oven allows us to perform a few specific operations, like put an item in the oven, or set the temperature.

Thinking in terms of objects can be powerful when designing programs. Suppose a program should record time and distance for various runners, such as a runner ran 1.5 miles in 500 seconds, and should compute speed. A programmer might think of an “object” called RunnerInfo. The RunnerInfo object supports operations like setting distance, setting time, and computing speed. In a program, an object consists of some internal data items plus operations that can be performed on that data.

Creating a program as a collection of objects can lead to a more understandable, manageable, and properly-executing program. An object-oriented language supports decomposing a program into objects. C++, Java, Python, and C# provide extensive object-oriented support. In fact, the “++” in C++ suggests C++ is better than C, due in large part to supporting objects. C does not. MATLAB and Javascript provide some support.

Markup languages

markup language allows a developer to describe a document’s content, desired formatting, or other features. A popular markup language is HTML. HTML (hyper-text markup language) allows a developer to describe the text, links, images, and other features of a web page. While some people refer to “HTML programming”, a markup language is not executed statement-by-statement like a programming language, and an HTML file is not a program. Rather, a web browser reads an HTML file and renders the corresponding web page. An HTML file surround text by different tags to yield different formatting.

9.2 Libraries

Library basics

library is a set of pre-written functions (and other items) that carry out common tasks, that a programmer can use to improve productivity. After including a library with a program, a programmer can make use of the library’s functions. A library’s functions typically all relate to the same purpose, like computing statistics, or like displaying graphics. A programmer may include several libraries in a single program.

9.3 Software languages and libraries summary

This chapter’s key points included:

  • Many kinds of languages exist. Compiled languages are first converted to machine code, while interpreted languages instead run on an interpreter. Statically typed languages require a programmer to declare a variable’s type, which cannot change, while dynamically typed languages let the type change as a program runs. Object-oriented languages provide substantial support for decomposing a program into objects. Markup languages don’t execute, but describe formatting and other features (like HTML, the language of web pages).
  • Programmers use libraries to improve productivity, by making use of pre-written functions.


Leave a Reply

Your email address will not be published. Required fields are marked *