Computer Programming

A Language Agnostic Introduction

Gerald Senarclens de Grancy

Computer Programming

Expressing Ideas in a Machine-Readable Way

  • ... is the art of expressing solutions to problems as source code
  • ... comprises designing, writing, testing, debugging, and maintaining the source code of computer programs

Wikipedia – Computer programming

To do this, we need programming languages

  • Artificial languages designed to communicate instructions to a machine
  • A notation for writing programs, which are implementations of a computation or algorithm
  • Tools for experimentation
  • Occassionally, a means of communication among programmers
  • Markup languages like HTML, troff or XML, which define structured data, are generally not considered programming languages

Wikipedia – Programming language

There are 1000s of programming languages and dialects

  • Interpreted and compiled languages
  • Syntax and semantics
  • Static versus dynamic typing
  • Standard library

Wikipedia – History of programming languages

Wikipedia – Timeline of programming languages

Selection of Historic Programming Languages

Fortran

  • "Formula Translation"
  • Especially suited to numeric computation and scientific computing
  • Main versions are II, IV, 77, 90, 95, 03

COBOL

  • "COmmon Business-Oriented Language"
  • Emphasis on data manipulation

"It was hoped/claimed that COBOL was so close to 'business English' that managers could program and programmers would soon become redundant. That is a hope we have heard frequently repeated over the years by managers keen on cutting the cost of programming. It has never been even remotely true." – Bjarne Stroustrup

Lisp

  • "LISt Processing"
  • Interpreted language
  • Mainstay of artificial intelligence research

ALGOL 60

  • "ALGOrithmic Language"
  • Ancestor to many modern programming languages

Simula

  • "Simulation programming languages" (I and 67)
  • Simula 67 is considered the root of modern
    object-oriented programming

Pascal

  • Said to be named in honor of Blaise Pascal
  • Teaching language

Ada

Selection of Modern Programming Languages

C

  • First appeared 1972
  • For implementing operating system
  • Very close to the fundamental aspects of hardware
  • 1978 K&R C, 1989/90 ANSI C, C99, C11, C17, C23

C++

  • Better C
    • With data abstraction
    • Supporting object-oriented
    • Functional and
    • Generic programming
  • C++98, C++03, C++11, C++14, C++17, C++20, C++23

Go

  • First appeared in November 2009
  • Syntactically similar to C, but also has
    • Memory safety
    • Garbage collection
    • Excellent support for concurrency (goroutines)

Haskell

  • Purely functional programming language
  • Haskell 98, Haskell 2010

Java

  • Compiled to bytecode
  • Programs require a Java Virtual Machine (JVM) to run
  • Java 21 (as of September 2023)

JavaScript (ECMAScript) (and TypeScript)

  • Behavior in web-based user interfaces
  • Dialects provide scripting for PDF documents, desktop widgets, Qt applications, LibreOffice, ...
  • Node.js allows creating modern full stack applications
  • Electron (et al.) can be used to build cross-platform desktop applications
  • React Native is used to create native apps for Android and iOS
  • First edition appeared in 1997
  • ECMAScript 6 (ES6), 2015: added significant new syntax for writing complex applications
  • Yearly releases, currently ECMAScript 2023 (ES2023)

PHP

  • "PHP: Hypertext Preprocessor"
  • Produces dynamic Web pages
  • Major version have breaking changes from previous versions
  • PHP 5, PHP 7 and PHP 8

Python

  • "Monty Python's Flying Circus"
  • Fun to use
  • General-purpose, interpreted high-level programming language
  • Also used for scripting various programs including LibreOffice
  • Commonly used in artificial intelligence and data analytics projects
  • MicroPython allows applications on micro controllers
  • Python 3 (December 3rd, 2008) had breaking changes from Python 2
  • As of November 2022, Python 3.11 is the stable release

Programming Languages Features

What properties in a programming language do we consider desirable?

  • Portability/ platform independence
  • High performance
  • Ability to concisely express ideas
  • Anything that eases debugging
  • Anything that eases testing
  • Stability over decades
  • Prompt improvements if required
  • Ease of learning
  • Support for popular programming styles
  • Whatever helps analysis of programs
  • Lots of facilities (e.g. libraries)
  • Supported by a large community
  • Supportive of novices (students, learners)
  • Comprehensive facilities for experts
  • Lots of software development tools available
  • Supported by an open software community

Stroustrup (2009), p. 772f

Terminology

Operating system
Shell, terminal
Shells usually provide command-line interfaces (CLI)
E.g. Bash, COMMAND.COM, PowerShell, Python shell, Zsh, ...
Terminal windows allow users access to applications such as shells
Source code
Plain text written by a programmer in a programming language
In principle readable by any other programmer
Wikipedia – Source code
Interpreter
Directly executes instructions written in a scripting language
Compiler
Translates code written in one language into another language
Script
Text file containing source code of an interpreted language
Text editor
Program used for creating and editing plain text files
No formatting
Good editors assist programmers
E.g.: GNU Emacs, Kate, micro, Vim, VSCodium, ...
Integrated development Environment (IDE)
Eclipse (focus on Java, but many extensions like PyDev available)
KDevelop (C and C++, with kdev-python also Python)
Spyder (Python only)
VSCodium (can be considered an IDE when using multiple extensions)
...
Development environment
Collection of tools
Requires experience in order to be used efficiently
Either provide proper training
Or to allow developers to pick their choice of tools/ environment
And create an independent build process
User interface
Text based, graphical, web based

Questions
and feedback...

Literature

Paul Barry and David Griffiths Head First Programming O'Reilly (2009) buy on Amazon
Mark Pilgrim Dive Into Python 3 (2nd edition) Apress (October 23, 2009) buy on Amazon
Python Software Foundation Python Documentation http://docs.python.org/3/
Bjarne Stroustrup Programming – Principles and Practice Using C++ Addison Wesley (December 15, 2008) buy on Amazon