|Quotes • Headscratchers • Playing With • Useful Notes • Analysis • Image Links • Haiku • Laconic|
"C isn't that hard: void (*(*f)())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void"
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, Windows and Mac OS 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" that may tell a computer what to do, there are defining points between them all.
- A programming language, according to The Other Wiki, describes... "programs". These can either compute something, change the behavior of the machine directly, or offer a form of human-readable communication from the machine.
- Scripting languages describe actions of a program as a supplement. In other words, they typically control programs.
- Markup languages such as HTML and XML describe how a document should look. Akin to "marking up" a paper in editing before finalizing it.
A programming language has four basic elements to it:
- Symbols to hold data.
- Operators that modify the data.
- Conditional statements that control the flow of the program.
- 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 the source file, the compiler, assembler, or interpreter will complain until it's fixed.
Low Level Languages
Low level languages are hardware specific languages and talk directly to the hardware. A programmer can write a low level source code in two ways:
- Machine code: This is literally writing the binary values that the processor will take, decode, and run. In other words, the 0's and 1's (or hex values). Each statement generally contains two portions; one is the instruction (or opcode), and one is the data the instruction is acting upon.
- Assembly code: Each instruction is given a human readable mnemonic, but it's still very rudimentary, kept to four letter commands at most.
The 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 tradeoff is that it's very easy to write code that breaks the system in software and a lack of portability.
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. Some languages 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 sacrifice performance and (arguably) flexibility for a human-friendly language. For example, you could write "x = 2" instead of "MOV x, 2". Along with the human readability, it also allows for portability as long as a compiler or interpreter exists for the platform.
Source files written in high level languages are either compiled, which forms an executable to be run, or interpreted, which is translated into intermediate "bytecode" and executed on the fly by another software platform. Compiling allows programs to be code dense and thus perform well, but the source needs to be compiled for a different platform. Interpreting allows the source to be executed directly, but performance generally suffers.
Programming can be thought of as making a recipe for a dish. For instance, making a cake:
- Preheat the oven to 400F
- Put flower, eggs, sugar and milk into a bowl.
- Mix the ingredients for a batter.
- Put the batter into a pan.
- Bake for 30 minutes.
- Take the pan out and poke it with a toothpick. Does it come out clean?
- If not, put the pan back in the oven for five minutes and test again.
- If so, take the pan out and leave to cool for 10 minutes.
- You now have delicious cake to serve!
A program could look like this
SET oven temperature TO 400F
SET bowl TO flour + eggs + sugar + milk
CALL mix ingredients WITH bowl
CALL pour WITH bowl, pan
CALL bake WITH pan, 30 minutes
CALL toothpick test
WHILE toothpick IS NOT clean
CALL bake WITH pan, 5 minutes
CALL toothpick test
CALL cool WITH pan, 10 minutes
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 the exotic "cout" (C++). 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.
Popular Languages 
- BASIC (Beginner's All-purpose Symbolic Instruction Code): A family of languages and many of the descendants of the original 1964 language bear no obvious resemblance to it, or to each other. Historically used in many home computers. Today, it's mostly used in programmable calculators, as well as Microsoft's flavor known as Visual Basic, whose current incarnation, Visual Basic .NET, is based on the Common Language Infrastructure like C# and runs using .NET on Windows and is supported by Mono on other operating systems.
- C: The most widely used language in the world due to a compiler being available for nearly every modern hardware platform known to man. Originally used to write the UNIX OS, but also used in Windows NT (which includes XP to 7), Linux, and Mac OS. Allows for a lot of Mind Screwy tricks and easily shooting yourself in the foot, which is why it's often jokingly referred to as a "high-level assembler".
- C++: An extension of C which adds object oriented programming and differing syntax for some operations. C++ is (mostly) compatible with C functions. C++ is used in many places that would help in a C program, mostly in video games and operating system components. It has greatly grown in complexity since its inception, which brought it a fair share of criticism.
- C#: Jokingly referred to as Microsoft's version of Java. C# mainly used in the development of Windows applications, Zune and Windows Phone 7 apps, and Xbox Live games. Like Java, it runs on a set of libraries called the Common Language Infrastructure, which on Windows is the .NET Framework, elsewhere it's Mono. It is just-in-time (JIT) compiled, as opposed to interpreted or precompiled, allowing for speed of execution generally comparable to compiled code with some portability from platform to platform.
- Java: Developed by Sun in the 90s as an interpreted language, but later extended to be JIT-compiled. It mostly started in web applications, but soon expanded to many platforms that could run the virtual machine. It's still widely used in web applications but also found itself as the platform for Android OS applications.
- Objective-C: Apple's (originally NeXT's) cross between C and Smalltalk. Originated in NeXTstep, but is now used mainly for Mac and iOS apps.
- Python: Another interpreted language, used notably on UNIX and UNIX-like systems, which aims to be readable. Version 3 made several changes to the language that are often incompatible with older code, so for running older code version 2.7 is also maintained by the organization responsible for the official interpreter, the Python Software Foundation.
- FORTRAN: The very first high-level language in existence, though some call its early incarnations little more than a symbolic assembler, as a lot of features that modern programmers now take for granted simply weren't yet invented back then. Developed by IBM's John Backus in 1954 for scientific calculations and is still used to this day for the very same goal. Recent versions are actually closer to C than to the original language.
- Lisp: Originally LISP, as in LISt Processor. Another early language, this time much higher level that the industry was ready to. Created by John McCarthy in 1955 as a research tool in the abstract algebra field and later found its use in AI development. Another Long Runner, which, although not as popular per se, influenced basically all modern programming languages, especially scripting ones like Python. Is known for several rather hard-to-bend-the-brain-around concepts like first order functions and closures, as well as for its idiosyncratic (or, as many say, non-existing) syntax that consists entirely of parentheses. Has evolved greatly with time. Popular dialects are Common Lisp and Scheme.
An ordered list of the fifty 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).
Languages made mostly for fun. Some of them are often to test the limits of a programmer.
- Wikipedia has a list.
- Brainfuck. Exactly What It Says on the Tin for many a programmer. A pointer based language that only accepts 8 characters as valid commands.
- LOLCODE. Imagine BASIC meets LOLcats.
- Whitespace. A programming language made entirely of spaces, tabs, and newlines.
- ↑ Please keep this list as is.