ENG 213.1 · Computer Programming for Engineers
Our notes
2 min readLevels of language
| Level | Description | Example |
|---|---|---|
| Machine language | binary instructions the CPU runs directly | 10110000 01100001 |
| Assembly language | short mnemonics for machine instructions | MOV AL, 61h |
| High-level languages | close to human and mathematical notation; machine independent | Fortran, C, Python, MATLAB, Java |
High-level languages are easier to write, read and move between computers; they must be translated.
Translators
- Compiler: translates the whole program into machine code once, then the program runs fast (Fortran, C).
- Interpreter: translates and runs one statement at a time (classic BASIC, Python): easy to test, usually slower.
- Assembler: translates assembly language.
Building a Fortran program
- Edit: type the source code into a file, for example area.f90.
- Compile: the compiler checks the syntax and makes an object file. Syntax errors are reported here.
- Link: joins the object file with library routines (sqrt, sin, input/output) into an executable.
- Run: the executable reads input and gives output. Run-time and logic errors appear here.
With gfortran the compile and link steps are one command:
gfortran area.f90 -o area
then run ./area (or area.exe on Windows).
Fortran versions
- FORTRAN 66 and 77: fixed format (statements in columns 7-72, comments with C in column 1, often in capitals).
- Fortran 90/95: free format, modules, array operations, IMPLICIT NONE, DO WHILE, SELECT CASE.
- Fortran 2003, 2008, 2018 and later: object-oriented features, parallel programming (coarrays).
These notes use free-form Fortran 90 and later, saved in files ending .f90.
Other languages engineers meet
- C and C++: systems programs, microcontrollers, fast simulation.
- Python: data analysis, scripting, with NumPy and SciPy.
- MATLAB / Octave: matrices, control, signal processing.
- PLC languages (ladder logic) for industrial control.
Exams usually ask
- Distinguish machine, assembly and high-level languages.
- Compare a compiler with an interpreter.
- Describe the steps from writing to running a program.
Common mistake
Saying a program that compiles is correct. Compiling only shows the syntax is right; the logic can still be wrong.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Introduction to Computer Science, 7.4 Programming Language Implementation
(opens openstax.org in a new tab)
OpenStax, Introduction to Computer Science, 7.4 Programming Language Implementation, CC BY-NC-SA 4.0 · licence
-
Programming language
(opens en.wikipedia.org in a new tab)
Wikipedia, Programming language, CC BY-SA 4.0 · licence
-
Compiler
(opens en.wikipedia.org in a new tab)
Wikipedia, Compiler, CC BY-SA 4.0 · licence
-
OpenStax, Introduction to Computer Science (whole free textbook)
The whole book, free to read online or download as a PDF (the PDF is large: Wi-Fi).
(opens openstax.org in a new tab)
OpenStax, OpenStax, Introduction to Computer Science (whole free textbook), CC BY-NC-SA 4.0 · licence
Watch
-
FORTRAN in 100 Seconds
3 min · ≈ 14 MB · about ₦8
(opens youtube.com in a new tab)
-
The Untold Story of FORTRAN
12 min · ≈ 54 MB · about ₦30
(opens youtube.com in a new tab)
-
The Generations of Programming Languages | Computer Science History
13 min · ≈ 59 MB · about ₦33
(opens youtube.com in a new tab)
-
FORTRAN in 7 Minutes ⚡ The Language That Still Powers Supercomputers
7 min · ≈ 32 MB · about ₦18
(opens youtube.com in a new tab)
-
How They Created - Fortran | World's First Programming Language |
2 min · ≈ 9 MB · about ₦5
(opens youtube.com in a new tab)
-
Archival Adventures - Episode 69: "Twenty-Five Years of FORTRAN" IBM Exhibit Collection from 1982
2 h 10 min · ≈ 585 MB · about ₦328
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.