Functional programming looks at programming like a function in mathematics. The program receives "input", together with some information, and uses this information to create "output". It will not have a state in between, and it will also not change things that are not related to the computation.
Procedural programs specify or describe sets of steps or state changes.
Stack based languages look at some of the program's memory like a stack of cards. There are very few things that can be done with a stack. A data item can be put on the top of the stack. This operation is generally called "push". A data item can be removed from the top of the stack. This is called a "pop". You can look at the item at the top of the stack without removing it. This is called a "peek".
If a program is written as "push 5; push 3; add; pop;" it will put 5 on the top of the stack, put 3 on top of the 5, add the top two values (3 + 5 = 8), replace the 3 and 5 with the 8, and print the top (8). Examples for programming languages that are stack-based are the languages Postscript and Forth.
Object-oriented programming languages place data and "functions" that change data into a single unit. This unit is called an "object". Objects can interact with each other and change another object's data. This is usually called encapsulation or information hiding. Most modern programming languages are object-oriented, or at least allow this style of programming. Examples of this are Java, Python, Ruby, C++, C# and other C languages.
Flow oriented programming sees programming as connecting different components. These components send messages back and forth. A single component can be part of different "programs", without the need to be changed internally.
Some of the languages above can be used for scientific computing. For example, C++ and Python are also used in this way. On the other hand, there are some languages that has scientific computing as their main purpose. The following are some examples:
LaTeX and SATySFi are programming languages which helps document creation.
Every programming language has rules about what it can and can not do. These include:
Most languages have official standards that define the rules of how to write the source code. Some programming languages have two or more standards. This can happen when a new standard replaces an old one. For example, the Perl 5 standard replaced Perl 4 in 1993. It can happen because two people made two standards at the same time. For example, there are several standards for APL.
Object-Oriented Programming (sometimes shortened to OOP) is a form of programming where all parts of the program are objects. Objects are pieces of memory with the same structure that can be used again and again. A bank account, bitmap, or hero from a video game could all be objects within a program. Objects are made up of properties (pieces of information the object stores) and methods which are things the object can do. A Dog object might have properties like height and hairColor. Its methods might include bark() and wagTail().
All objects are created from templates called classes. You can think of a class as a mold from which objects are made. The class defines all the properties and methods that its objects will have. Objects created from a class are called instances of the class. A class can "extend" another class, which means that it takes all the properties and methods of the class but can add its own.
Here is an example of what a class might look like in a programming language:
Notice that the Dog class extends the Mammal class, so all dogs will have the properties of a mammal, like hairLength, and methods, like eat() or sleep().
Object-oriented programming is used in many of today's most popular programming languages, such as Java, C#, Objective-C, C++, Python, Ruby, Javascript, and ActionScript.
Here is a simple program written in Visual Basic (a language made by Microsoft):
This program asks the user his or her age and responds based on what the user typed. If the user typed something that is not a number, the program says so. If the user typed a number less than zero, the program says so. If the user says he or she is older than 100 years old, the program says "That's old!" If the user typed a correct age the program says back to the user how old he or she is.
Here is a program that does the same thing as the program above, but in Python:
The same thing as the program above, but in C#:
using System;
public class Hello
The same thing again, but in Haskell:
import Text.Read
main = do
Visual Basic
Visual Basic (VB) is a programming language developed by Microsoft for their operating system Windows. The BASIC language is said to be easier to read than other languages.
"Visual Basic" is a widely understood high-level programming language, written using simple English-like words and syntax. It is an interpreted language, code can be run immediately after being written.
Having an interpreter makes it simpler to use, as there is no need for the computer to compile the code, possibly finding errors to fix, before the compiled version can be run. Once the code is working, it can be compiled into an .exe file so that it will run on all modern Windows computers, whether VB is installed or not. The language allows a beginning programmer to produce professional-looking Windows applications, as it includes drawing tools to create normal Windows forms. VB also includes advanced features - concepts and structures which allow programs to be adapted for use with the Internet. "Visual Basic" will not run on operating systems other than Windows and on machines with non-Intel compatible processors.
Though the program has received criticism for its faults, Visual Basic was a runaway commercial success since its release for version 3 in the summer of 1993. Many companies offered third party controls greatly extending its functionality.
Dim MyInput
MyInput = InputBox("How old are you?")
If Not IsNumeric(MyInput) Then
ElseIf MyInput < 0 Then
ElseIf MyInput > 100 Then
Else
End If
Private Sub Form_Load()
End Sub
VB 1.0 was introduced in 1991. The drag and drop design for creating the user interface is derived from a prototype form generator developed by Alan Cooper and his company called "Tripod". Microsoft contracted with Cooper and his associates to develop Tripod into a programmable form system for Windows 3.0, under the code name "Ruby" (no relation to the Ruby programming language). Tripod did not include a programming language at all. Microsoft decided to combine Ruby with the Basic language to create Visual Basic. The Ruby interface generator provided the "visual" part of Visual Basic and this was combined with the "EB" Embedded BASIC engine designed for Microsoft's abandoned "Omega" database system. Ruby also provided the ability to load dynamic link libraries containing additional controls (then called "gizmos"), which later became the Visual Basic Extension (VBX) interface. Versions of Visual Basic are listed below:
Visual Basic .NET is the next series of products in Microsoft's successful "Visual Basic" range of products. It makes creating programs easier because it is possible to drag-and-drop controls into the program. It runs on the .NET Framework and features another long line of programs (see Visual Basic .NET#Editions).
This is a scripting language used in Microsoft Office and a few other programs. It is based on Visual Basic 6.0, and can change data in an office application, write it to a file, and do other actions.