A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://tvtropes.org/pmwiki/pmwiki.php/MediaNotes/ProgrammingLanguage below:

Website Navigation


MediaNotes / Programming Language

"C++ is a write-only language; one can write programs in C++, but I can't read any of them"

—Programmer joke

Computers, for the most part, are dumb. If you were to take computer hardware that was freshly built off the assembly line, put the components together into a fully assembled device, and tried to turn it on, it wouldn't do anything useful (if anything at all). Yes, Microsoft Windows and macOS don't magically appear in the computer right from the factory. But if you give them something to do, they'll be able to do it really fast! But how do you tell a machine what to do? Here comes the programming language. As the name implies, it's the language you use to program the computer to do what you want.

While there are other languages in computer science, the defining characteristic of a programming language is that it's used to implement algorithms. Where it does this provides further distinction such as higher-level scripting languages. One type of computer language that's not a programming one is markup languages, which are limited in scope to defining how something should look, or at the very least, how data is organized. They may provide hints on how the data should be interpreted, but they don't describe how to compute something.

Concepts

A programming language has four basic elements to it:

  1. Symbols to hold data.
  2. Operators that modify the data.
  3. Conditional statements that control the flow of the program.
  4. The ability to jump around in the program at will.

Programs are written into source files, which can be compiled or assembled for later execution, or interpreted for execution right away. If there's something immediately wrong with the source file, the compiler, assembler, or interpreter will complain until it's fixed.

It should also be noted that a computer is more or less a Literal Genie. It's very, very rare a computer makes a mistake because it actually made a mistake. It "makes mistakes" because of how the program was written, which is entirely up to the human who wrote the code. However, the way someone writes code can make knowing how the program is supposed to function either easier or harder, so there's also an artistic side to programming.

Instruction Set Architecture (ISA)

Originally computers when they were first built were an array of

logic gates

that had to be hand-wired for the operations needed. As parts of computers evolved from hand-wired logic gate circuits to full on integrated circuits, a standard way of telling the chip what to do had to be made. Especially since now they could be mass produced. This is where the Instruction Set Architecture, or ISA, comes in and where the first step of building a program in modern computers starts.

The ISA in simple terms provides the interface for how the software talks with the hardware, with the software acting like the hand-wiring that used to be done. So if the ISA says feeding the binary sequence "1011111011101111" to the hardware invokes a move operation, then the software feeding the same binary sequence should do the same. There are several philosophies on how to design and implement ISAs, which is explained in Central Processing Unit. ISAs is what separates compatibility with different types of CPU.

Low-Level Languages

At its heart, a computer is simply a giant calculator that computes arithmetic billions of times per second. Each of its constituent parts, from memory to modem to monitor to mouse, has an alphanumerical address associated with it. The computer uses these addresses to route data throughout itself. Hence, the earliest computer languages evolved to reflect how computers fundamentally worked. An extraordinarily simple instruction might be "Take the number stored at memory address X and subtract it from the number stored at memory address Y, then send it to the printer located at hardware address Z".

Low level languages

use hardware-specific instructions to talk directly to the computer this way.

A programmer can write a low-level source code in two ways:

The primary reason for using low-level languages is for maximum performance and maximum flexibility. The code that's written is directly talking to hardware and the programmer has full access (barring specific security features) to the hardware. The trade-off is that it's very easy to write code that breaks the system in software and a lack of portability. Another reason may be, especially for older or simpler systems, assembly language is easier to work with. Especially when running something like a C program, which has some overhead in setting up the system in order to run it which can eat into program space.note A reason why C can't be used as a low-level language replacement is that a typical C program expects three things to be available: memory space for a stack, memory space for a heap (where dynamically allocated memory gets stored), and memory space set aside for variables that are meant to last the life of the program, in addition to being initialized. Assembly is needed to set all of this up before the C program can take over.

It's unusual these days to write assembly code by hand, because compilers have gotten so good at optimizing slightly higher-level languages like C. So languages are sometimes termed "low-level" because they give you a lot of control over how the assembly code turns out. In addition, many modern compilers actually allow programmers to create assembler "inserts" in the high-level source code. Some languages (such as Forth) are "multi-level" and allow both low-level and high-level coding to be done in the same syntax, and sometimes the same program.

High-Level Languages

High-level languages build on top of assembly languages by providing more human-readable ways of writing a program. For example, you could write "x = 2" instead of "MOV x, 2"; or "for(5: Array)" instead of manually looping through instructions. However, this sacrifices performance and, depending on the language, flexibility because the computer must parse the instructions and translate them into machine code. In addition, the language is typically computer agnostic, so the part that translates the code may not be able to find a 1:1 operation and has to find a way to emulate it or provide an output that makes sense.

More abstracted high-level languages go further, replacing, say, "x = 2" with "x is 2". Complex languages are written in earlier ones, "standing on the shoulders of giants"; a compiler is essentially a text parser that goes through source code for a given language and translates it into whatever lower-level language the compiler was written in. Later versions commonly use the process known as "bootstrapping", meaning that the compiler is written in the same language it compiles— and itself compiled by a previous version. Along with readability, high-level languages also allow for "portability" as long as a compiler or interpreter exists for the platform.

An important distinction with high-level languages is their intended target for what kind of programs they'll be used to program. Programs intended to talk to and manipulate hardware directly are dubbed system programs, and programming languages designed for them tend to not hide details about the intimate parts of the computer. For instance, some systems programming languages allow you to manipulate things via memory addresses directly, including modifying which address you want to pull data from or write to. Programs that primarily provide some service to the user are called applications programs. Programming languages designed for applications hide the nitty and gritty parts of a computer, allowing the programmer to worry more about the features of the program rather than the lower-level details of it. Languages designed for system programs can be used to write applications (and have been for the better part of half-a-century), but programming languages meant for applications typically can't be used to write system programs.

Source files can be executed in three different ways:

Programming can be thought of as making a recipe for a dish. For instance, making a cake:

  1. Preheat the oven to 400F
  2. Put flour, eggs, sugar and milk into a bowl.
  3. Mix the ingredients for a batter.
  4. Put the batter into a pan.
  5. Bake for 30 minutes.
  6. Take the pan out and poke it with a toothpick. Does it come out clean?
  7. You now have delicious cake to serve!

A program equivalent could look like this:

import kitchen
import toothpick

oven.temperature = 400
ingredients = [flour, eggs, sugar, milk]
batter = mix(ingredients)
cake = pour(batter)
oven.bake(cake, 30)
toothpick.poke(cake)
while not toothpick.clean:
    oven.bake(cake, 5)
    toothpick.poke(cake)
cool(cake, 10)
serve(cake)

A quirk with different programming languages is that, like natural language, different "words" have different meanings, or no meaning at all. If you wanted to display something on your monitor, you may have to type out "Print", "Display" or even C++'s exotic sounding "cout" (for character output, and pronounced "see-out"). There are also different paradigms to how to structure code. For example, procedural programming involves breaking up tasks into subroutines to make things legible. Another one, object-oriented programming, groups variables and tasks into "objects". With so many different ways to write a program or routine, a programming language can be thought of as any natural language you may learn. Thus, it's important to practice it, if you want to get good at it.

Want to gain in-depth knowledge of these languages; what they do and how to use them? W3Schools.com has you covered!For which?HTML, CSS, JavaScript, SQL, Python, PHP, C, C++, C#, MySQL, XML, R, Go, Kotlin

Examples of Programming Languages

    open/close all folders 

    Historical Languages 

    Popular Languages 

These languages are ones you'll like find on some Top 10 "most used" languages list or are a common sight in job postings. An ordered list of the 50 most popular programming languages (updated monthly) may be found

here

. This measures popularity based on search engine results, so it may not line up with other definitions (e.g. there may be bias towards languages for which people currently need resources, rather than those being used for production code).

    Esoteric Languages 

Languages made mostly for fun. Some of them are for testing the limits of a programmer.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4