Skip to main content
SWStudyWalks Search

High-Level Programming Languages

The narration between entries paraphrases; it never reads an entry aloud before the entry plays. Every entry in this lecture plays exactly as it does on its own page — same file, same speed, nothing laid over it.

What you can do after this

  1. Say what separates a primitive type from a composite one, and why the same concept differs across languages
  2. Say what a reference variable holds, and why it has to
  3. Say what a type cast costs when it goes the wrong direction
  4. Name the three properties that measure how object-oriented a language is
  5. Say what bytecode buys, and what delaying translation to runtime buys

What it covers

32 entries in 10 topics. Each number links to that entry on its own.

  1. 1. High-level, and how to judge one

  2. 2. Four languages, early

  3. 3. Types, primitive and composite

  4. 4. Typing discipline

  5. 5. The cast that dropped four bytes

  6. 6. Expressions, flow, scope, failure

  7. 7. Objects, three properties

  8. 8. Concurrency, in the language

  9. 9. Translation, four ways

  10. 10. The capstone

Check yourself

What separates a primitive type from a composite one?

A primitive relates directly to the hardware, with a bit pattern the registers recognise. A composite is built from primitives. And the same concept can be composite in one language and a first-class type in another — the standing changes, not the concept.

What does a reference variable hold, and why?

A memory address sized to the machine's word, rather than a value. It holds an address because a composite value has no fixed size that could be stored in place — the indirection is forced by the type.

What does a type cast cost going downward?

Truncation. Bytes are dropped, and the retained bytes hold the value's exact remainder within the smaller type's range. The result is predictable and the program reports nothing wrong, which is what makes it dangerous.

What three properties measure how object-oriented a language is?

Encapsulation, inheritance and polymorphism. A language conforms to them by degree, so the question is how object-oriented it is rather than whether it is.

What does bytecode buy, and what does delaying translation buy?

Bytecode is machine-independent output aimed at a virtual machine, so one compiled artefact runs anywhere that machine exists. Delaying translation until runtime lets the compiler use sound assumptions about actual behaviour, producing faster code than deciding in advance could.

Lecture transcript

The narration as recorded, in order. Where an entry plays, the transcript links to it rather than reprinting it — the entry plays from its own file, unaltered, and says the same thing on its own page.

This is Unit Seven of Computer Science: high-level languages. Unit Four established that a language choice never changes what is computable. This unit is about what it does change — which is nearly everything else. How long the work takes, which errors are possible at all, and where a program can run. A large part of the unit is about types, and one idea inside that is worth arriving prepared for. The same concept can hold different standings in different languages — a character string is built one way in one language and is a first-class type in another. The concept did not change. Its standing did. There is an error entry about conversions, and the procedure that follows it shows the failure as arithmetic rather than as a warning. Bytes get dropped, and which bytes survive is entirely predictable. And the unit closes on translation — including an arrangement where the compiler deliberately produces output for a machine that does not exist. By the end you will be able to do five things. One: say what separates primitive types from composite ones. Two: say what a reference variable holds, and why it has to. Three: say what a cast costs going the wrong direction. Four: name the three properties measuring object orientation. Five: say what bytecode buys, and what delaying translation buys.

Three entries opening the unit. What high-level actually means, the property that lets one source file run in more than one place, and the criteria a language gets evaluated against — which are about people, not machines.

The definition.

CS 0351 The High-Level Language

Designed to be readable and writable by people, abstracting the hardware away. Every high-level feature is a concession to the human doing the writing.

Running in more than one place.

CS 0352 Cross-Platform Compatibility

A language's ability to run across different operating systems and devices from one source. It is a property of the language and its tooling rather than of the program.

How they are judged.

CS 0353 Judging a Language

Evaluated by criteria with readability, writability and reliability among the leaders — grounded in characteristics the language actually has. Notice that none of the leading criteria is speed.

Four entries on the languages that arrived first, and each one exists because of a purpose. The first compiler, a language built for business, one built for beginners, and two built at nearly the same moment for building structured programs.

The first compiler.

CS 0354 Fortran, the First Compiler

Created at IBM in the early nineteen-fifties, the first high-level language using a compiler — software converting source into what the machine runs.

For business.

CS 0355 COBOL, the Business Tongue

A high-level language developed for business use and standardised early, which is a large part of why code written in it is still running.

For beginners.

CS 0356 BASIC to Visual Basic

Developed in nineteen seventy-one with deliberately easy syntax, and later carried forward into a visual form. Ease of learning was the design goal rather than a side effect.

Two at once.

CS 0357 Pascal and C, the Block Builders

Invented at approximately the same time and both procedural and imperative — the pair that established how structured programs get built.

Five entries, and the middle one carries the idea worth keeping. A character string is a composite type in one language and a first-class type in another — the same concept holding two different standings depending on where you are standing.

The first kind.

CS 0359 The Primitive Type

A type relating directly to the hardware, with a bit pattern the registers and arithmetic units recognise. The machine knows what to do with it without help.

The second.

CS 0360 The Composite Type

Multiple primitive types used as building blocks, with the array being the strict case — same type throughout, fixed arrangement.

And a comparison.

CS 0361 One String, Two Standings

The same concept holds different standings across languages — character strings assembled from parts in one language and provided as a type in another. Nothing about the concept changed. Its standing did.

What a variable is.

CS 0362 The Variable as Name-Value Pair

A container holding a value, as a name paired with what it holds — with primitive types storing the actual value in place.

And the other case.

CS 0363 The Reference Variable

A variable holding a memory address rather than a value, sized to the machine's word — because a composite value has no fixed size to store in place. The indirection is forced by the type, not chosen.

Three entries on how strictly a language holds you to a type. One direction of conversion is free and legal. The other direction is neither — and the error entry is about people treating it as though it were.

Held to the type.

CS 0364 Strong Typing

Restricting a variable to values of the type it was defined with. It is a characteristic of the language rather than a discipline the programmer supplies.

Two conversions.

CS 0365 Coercion and the Type Cast

A smaller type's value fits legally into a larger one with no announcement. The reverse requires an explicit instruction, because it cannot be done without loss.

And the error.

CS 0366 "The Cast Is Free"

Forcing a large value into a smaller type truncates — bytes are dropped. Treating the conversion as costless is how a value silently becomes a different value while the program reports nothing wrong.

One procedure, and it makes the previous error entry concrete. Truncation is not corruption and it is not random — the surviving bytes hold an exact arithmetic remainder, and the procedure works out which one.

Watch four bytes get dropped.

CS 0371 The Cast That Dropped Four Bytes

Truncation follows exact arithmetic, with the retained bytes keeping the value's remainder within the smaller type's range. Predictable enough to calculate in advance — which is what makes it dangerous rather than reassuring.

Four constructs every language provides in some form. Two are familiar, one decides what a name means at any given point in a program, and the fourth divides failures into the ones software can recover from and the ones it cannot.

Evaluating.

CS 0367 The Expression

A construct that evaluates to a value, built from operators taking one, two, or three operands. Everything a program computes passes through this shape.

Order.

CS 0368 Flow of Control

The order in which statements execute — and whether they execute at all. Sequential by default, and every departure from that is deliberate.

Where a name means something.

CS 0369 The Scope

Controlling a variable's visibility and lifetime — a variable local to a function existing and being visible only there. One name can mean different things in different places, legitimately.

Two categories of failure.

CS 0370 Runtime Error or Exception

Modern languages divide failures by category — a runtime error too serious for software to handle, and an exception the software is expected to catch and respond to. The division is a design decision made in advance.

Four entries, and the last one is the useful move. Object orientation is not something a language either has or lacks — it is a measure, and a language conforms to the three properties to a degree.

The first property.

CS 0373 Encapsulation

A class's attributes and behaviours made self-contained, travelling with the object through its whole lifetime. What belongs together stays together.

The second.

CS 0374 Inheritance

Objects taking specified attributes from their ancestors — a dog inheriting from an animal. Shared structure written once and used repeatedly.

The third.

CS 0375 Polymorphism

Inherited behaviours performing differently by context — an animal makes a noise, and which noise depends on what the animal is.

And the measure.

CS 0376 Degrees of Object-Orientation

How closely a language conforms to those three properties measures how object-oriented it is. Some languages conform fully, others partly — and the useful question is how much rather than whether.

Three entries connecting back to Unit Six. The thread the operating system managed is exposed to the programmer as an abstraction of a processor — and one small block of code carries all the risk.

The abstraction.

CS 0377 Concurrency in the Language

A language treats the thread as an abstraction of a physical processor, so the code is written the same way regardless of how many processors are actually there.

Where it matters.

CS 0378 The Critical Section

A block of code where timing can change the results — the specific region needing protection. Naming it narrows Unit Six's race condition to a place you can point at.

One family of languages.

CS 0379 The Scripting Language

Descending from shell scripting — stringing commands together to perform tasks on an operating system, and grown considerably past that origin.

Four entries closing the unit, and the third one is the one to notice. A compiler can deliberately produce output for a machine that does not physically exist — which is how one program comes to run everywhere.

Two strategies.

CS 0381 Compiler and Interpreter, Contrasted

One scans and translates the whole source in advance, spending the time up front. The other translates a line at a time as it runs. Each pays the same cost at a different moment.

Inside one of them.

CS 0382 The Three-Stage Compiler

A front end deconstructing the source, a middle end optimising for time and memory, and a back end producing the output. Three stages, three separate jobs.

Output for no machine.

CS 0383 Bytecode and the Virtual Machine

A back end can generate machine-independent instructions for a virtual machine instead of a real one — so one compiled artefact runs anywhere that machine has been implemented. Cross-platform compatibility, mechanised.

And a delay.

CS 0384 Just-in-Time Compilation

Delaying translation of intermediate code until the program is running, where sound assumptions about actual behaviour make the result faster than deciding in advance could.

One capstone, and it runs the unit backwards. Instead of describing what languages are, it picks one for a real project — and every criterion the unit named has to be argued rather than assumed.

The capstone. One choice, defended.

CS 0389 Choosing the Language, Receipts Attached

Choosing a language for a real project is this unit run in reverse — criteria, typing discipline, paradigms, concurrency and translation strategy all becoming reasons rather than descriptions.

Five things you can now do. You can say what separates primitive types from composite ones — the hardware recognises the first directly — and that the same concept can hold different standings in different languages. You can say what a reference variable holds and why: an address, because a composite value has no fixed size to sit in place. You can say what a downward cast costs — dropped bytes, an exact remainder, and a program that reports nothing wrong. You can name the three properties measuring object orientation, and say that conformance is a degree rather than a yes or a no. And you can say what bytecode buys — one artefact running wherever the virtual machine exists — and what delaying translation to runtime buys.

This is free, and stays free. If it helped, here is what keeps it running.