1. Home
  2. Explore
  3. Computer Science
  4. Introduction to Programming Languages

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Programming Languages

Speaker 1Speaker 2

Introduction to Programming Languages

8:36
0:00-8:36
  1. Anna

    Welcome back to Everything Computerised. Today we’re answering three questions: What is a programming language, why do we need one, and what are the major types and generations of programming languages?

  2. Michael

    Let’s begin with the basic idea. When people communicate, they use a language such as English. In the same way, when we communicate with a computer or another digital device, we use a programming language.

  3. Anna

    So a programming language is a way for humans to give instructions to machines. Computers cannot work on their own; they need instructions that tell them how to perform a particular task.

  4. Michael

    And those instructions have rules, just as spoken and written languages have grammar. In a programming language, the rules are connected with algorithms, which are sequences of instructions or rules used to perform a specific task.

  5. Anna

    There are two important parts to understand here: syntax and semantics. Syntax is the structure used to express something—for example, how a command is written, including its punctuation and arrangement.

  6. Michael

    Semantics is the meaning of that correctly structured command. In other words, syntax concerns how the instruction is written, while semantics concerns what that instruction means to the computer.

  7. Anna

    A useful definition is this: a programming language is a vocabulary and a set of grammatical rules for instructing a computer or computing device to perform a specific task. Each language has its own keywords and special syntax for organizing program instructions.

  8. Michael

    Before looking at the generations of languages, we need to know what computers directly understand. Computers are electronic devices, so they work with electrical signals.

  9. Anna

    A high electrical signal is represented as 1, and a low electrical signal is represented as 0. These two symbols are called binary digits, or bits. Different combinations of zeroes and ones can represent instructions.

  10. Michael

    The programming language made from those binary combinations is called machine language. It is directly understood by the computer, so programs written in machine language do not require a translator.

  11. Anna

    Machine language is the first generation of programming languages. It was used from about 1940 to 1959, especially with first-generation vacuum-tube computers and early transistor computers.

  12. Michael

    Its main advantage was speed. Because the computer understood the binary instructions directly, machine-language programs could run very quickly without translation.

  13. Anna

    But programming in binary was extremely difficult. Even a simple task required a long sequence of zeroes and ones, which made programs lengthy, complex, and difficult for people to understand.

  14. Michael

    Machine language was also time-consuming to write and not portable. A program written for one machine generally could not run on another because different machines had different hardware and different machine codes.

  15. Anna

    That meant programmers often had to write separate code for each computer. To make programming easier, the second generation was developed: assembly language.

  16. Michael

    Assembly language was used around 1959 to 1965. Instead of writing only binary digits, programmers used mnemonics—symbolic representations for machine instructions.

  17. Anna

    Those symbols made programs easier to write and understand. They also reduced the chance of errors and saved programming time compared with writing directly in machine language.

  18. Michael

    However, a computer could not understand assembly language directly. An assembler was required to translate the assembly source code into machine language, also called object code, before the processor could execute it.

  19. Anna

    That translation added time compared with running machine code directly. Assembly language also remained machine-dependent, so code written for one computer generally could not run on another without changes.

  20. Michael

    The first and second generations are therefore called low-level languages. They are close to the hardware, but they are difficult to learn, difficult to implement, and not portable.

  21. Anna

    The limitations of machine language and assembly language created the need for a more portable and programmer-friendly approach. That led to the third generation of programming languages, developed in 1965 and still used today.

  22. Michael

    Third-generation languages are machine-independent, meaning a program written for one computer can generally run on another with no changes or only small modifications. They use English words for variables, commands, and programming structures.

  23. Anna

    They also support structured programming. A large program can be divided into smaller sections, with each section performing a particular task. This makes programs easier to write and organize.

  24. Michael

    Because of these advantages, third-generation languages are called high-level or programmer-friendly languages. Early examples include FORTRAN, ALGOL, and COBOL. Modern examples mentioned here include C, C++, C-sharp, and Java.

  25. Anna

    There is still one important limitation: the computer understands machine language, not high-level source code. So a translator is needed, and translating the code can add time before the program executes.

  26. Michael

    The fourth generation moved even closer to ordinary human language. These languages use common English-like syntax and phrases, and they can let one command perform several common operations.

  27. Anna

    Fourth-generation languages are designed to be especially programmer-friendly and accessible to people without formal programming training. They work with large collections of information rather than focusing only on individual bits and bytes.

  28. Michael

    That made them useful for database management, report generation, mathematical optimization, graphical user-interface development, and web development. Examples include SQL, NATURAL, M-POWER, and LANSA.

  29. Anna

    Fourth-generation languages are non-procedural. The programmer states what task should be carried out, while the language determines how to carry it out.

  30. Michael

    That makes programming easier, but it reduces the programmer’s control over the program and its resources. Fourth-generation language packages can also be lengthy and may require more disk space and memory.

  31. Anna

    The fifth generation was introduced as a concept in Japan in the early 1990s. Its goal is for computers to solve particular problems with minimal help from the programmer.

  32. Michael

    With a fifth-generation language, the user focuses on the problem to solve and the conditions that must be met, rather than explaining every routine or algorithm needed to solve it.

  33. Anna

    These languages are used mainly in artificial-intelligence research. Examples include OPS5 and MERCURY.

  34. Michael

    The trade-off is complexity. Because fifth-generation languages use automated systems, their development and maintenance are more complicated and require more resources to work efficiently.

  35. Anna

    Let’s compare the generations directly. The first and second generations—machine language and assembly language—are low-level and machine-dependent. They use binary digits or mnemonic symbols, are difficult to learn, and can interact directly with hardware.

  36. Michael

    The third, fourth, and fifth generations are high-level languages. They use English words or phrases, are easier to learn and implement, and are generally machine-independent and portable.

  37. Anna

    The important contrast is that high-level programs cannot interact with hardware as directly as low-level programs. They are easier for people to use, while low-level languages provide a closer connection to the machine.

  38. Michael

    That brings us to language translators. Since computers understand machine language, translators convert source code written in assembly or a high-level language into machine code, also called object code, so the computer can execute it.

  39. Anna

    There are three main types of translators: assemblers, compilers, and interpreters. We’ve already met the assembler—it converts assembly-language code into machine language.

  40. Michael

    A compiler translates source code, generally from a high-level language, into machine code as a complete program. It scans and translates the entire program before execution.

  41. Anna

    An interpreter also converts source code into machine language, but it works statement by statement. Because translation happens during execution, the overall execution time is increased compared with a compiled program.

  42. Michael

    Their error handling is different too. A compiler reports errors after scanning the whole program. An interpreter translates until it reaches the first error, then stops execution at that point.

  43. Anna

    In the examples from this lesson, C and C++ use compilers, while Python and Ruby use interpreters. So the complete picture is: programming languages let people communicate instructions to computers, and translators make many of those languages usable by converting them into machine code.

  44. Michael

    From binary machine language, to symbolic assembly, to portable high-level languages, and finally to languages designed around human-friendly commands and artificial-intelligence problem solving, each generation addressed limitations of the previous one.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent