MrSchmid.com

How Programming Works and Programming Languages

Posted On: Fri, 2008-03-14 12:58 by mrschmid
how programming works title


How a program works-

A computer will not do anything without being told to. Just like you. Programming is simply giving the computer extremely specific instructions in order to accomplish your task. There are only two ways to get the instructions (a program) to accomplish a specific task. 1) write the program yourself (or modify someone else’s) or 2) buy or acquire a program that someone else has made to accomplish the same task. A program works by taking input, manipulating it, and spitting it back out (output). Here are some common programs and the input and output they deal with.
Click Read More to see the rest of the article

Word Processor

Typing

Formatting, spelling

Displays and prints text

 

Game

Keystrokes or joystick

Calculates how to move the on-screen character

Moves the character on the screen

Stock-Market predictor

Current and past stock prices

Recognizes trends

Predicts the future of a stock

Missile guidance program

Current location

Makes the missile and the target meet

Corrects trajectory

OCR (optical character recognition)

Scanned documents

Recognizes characters

changes an image into editable text

Web browser

HTML

Changes html into text and graphics

Displays a web page

Programming Languages:
Why so many different languages?

Each language serves a different purpose, and is meant for a specific application. At the fundamental level, computers only understand one language, called machine language. Machine language consists only of zeros and ones. A program might look like this:

0110 1110 1010 1111

1011 1001 1100 0001

Machine language
It is not friendly for a programmer. A single typo (changing a 1 to a 0) could totally change the program. It also takes a very long time to create, or figure out what’s happening.

Assembly language
Uses short, easy to remember phrases to represent machine code. This makes it easy to write, read, and modify later. Programs are constantly being improved because they never seem to work correctly the first time (or ever if it’s a Microsoft product) Computers cannot read assembly language, so programmers created assemblers that convert the assembly language into machine language.
Positives- Easier to read, easier to write.
Negatives- run slower and use more space, can’t transfer easily to another type of computer, tedious, time consuming and complex.
The easier it is to read and write, the slower it runs and the more space it takes up.

C
Offered the ease of languages such as FORTRAN and COBOL, but also allowed the access to hardware. It was based off of another language, B (but there never was an A language)
C looks like real words, but runs even slower than assembly language. It is also results in larger file sizes. C must be converted into assembly language, then into machine language. This results in less efficient code, at the cost of being more friendly to programmers. C’s three main goals were: 1) to be easier to read and write than assembly language, 2) to access all parts of the computer just like in assembly language, and 3) to create a language that can be transferred, or ported from one computer to another.
In order to port a program, it must be converted through the use of a compiler. The compiler changes the C code into machine language. A similar example would be like translating a novel from French to English. The less complicated the words, the easier the translation will be. A translation of a children’s book would be easier than a mathematical theory. C is more complicated to translate than assembly code. C compilers are found for just about every type of computer, so a program written in C can be compiled to run on most computers.
C quickly became one of the most popular languages. The majority of programs are written in C or a derivative of C, like C++, Java, Perl, Python and C#. (C++ is named because ++ is the way to add 1 to a number in C, hence it’s C+1). Some programs written in C or C++ are Microsoft Word, Windows XP, Linux and Quicken, just to name a few.
C does create larger and slower programs. It also gives programmers the dangerous ability to manipulate hardware.

High-level programming languages
They are languages that look like human languages, such as FORTRAN, COBOL, BASIC, Pascal or Ada. FORTRAN was one of the first (its name stands for FORmula TRANslator). It was used for calculus. COBOL (Common Business Oriented Language) was used for data processing. BASIC (Beginners All-purpose Symbolic Instruction Code) was made to allow normal people to program. C was a little too complex for a beginner to learn. BASIC uses easy and straight to the point terms to accomplish tasks.
Pascal is another language designed for beginners, but it focuses on structuring the programming so you will be able to easy read it at a later time. BASIC is not structured, so following a program can become quite difficult. Pascal requires you to plan the program before you write it.
BASIC became so popular that people tried to bring the structure of Pascal into BASIC. Liberty BASIC is structured.
High-level programs are slower than C, Assembly or Machine code. High-level programs also protect the computer by hiding dangerous access to hardware. Compilers are also more difficult to write for high-level languages, thus restricting the amount of different computers your program can run on.<
There are advantages for high-level programs. Programming is much faster. The learning curve is less steep. You are protected from really messing your computer up. Reading and modifying is much easier. Programs can be ported (if the other computer has a complier)

Rapid Application Development (RAD) programming languages
Allows you to design the way you want your program to look, then add the functionality through a language to the program. Some examples are Real Basic, Delphi, Kylix, Visual C++, Jbuilder.
Benefits:

1) Graphical user interfaces are created much faster.

2) Simplifies the process by eliminating the interface portion

3) You may already know the language
Drawbacks:

1) Not port-able

2) Larger and slower than in the original language.

 

Database programming languages

Examples: Filemaker and Access, SQL.

Benefits:

1) skips the data base storage portion so you can get right to manipulating data

2) Needed by industry. Big bucks.

Drawbacks:

1) limited to computers that can run the database software

2) only good for databases (no games or anything else, really)

Scripting programming languages

Allows you to use an existing program to make it do what you want.

Examples: Visual Basic for Applications (VBA) or AppleScript

Benefits:

1) modifies an existing program

2) easy to learn

Drawbacks:

1) tied to specific program

2) limits user base (must have the original software)

3) less flexible

Web-page programming languages

HTML was made for text and graphics, Java for interactivity. HTML resembles a billboard, while java can be made to behave like a game or look like a paper.

Benefits:

1) interactive sites encourage the user to stay longer

2) easy to learn, anyone on the Internet can use the program

Drawbacks:

1) Not supported by all browsers

2) Slow loading times

3) Only available on the internet (except for Java)

Best language?

No one best, but C++ is used very widely. The advice is to learn a database language (like SQL) and C++, and you should be able to work just about anywhere.

how to program to display hello world in different languages.

 

Take the quiz . Remember, the answers will be emailed to me, so be sure of your answers before hitting submit. Many questions require you to research outside of the article.

( categories: | )

Poll