HTML Blox

Providing the building blox of the web.

  • HTML Blox Home
  • Blog
    • Design
    • Flash
    • General
    • HTML
    • Javascript
    • PHP
    • Programming
    • Web Servers
  • Forums
  • Where to Start?
  • Lessons
    • CSS
    • Design
    • HTML
    • Javascript
    • Programming
  • References
    • HTML
  • Resources
  • About
  • Contact
  • Go Green!

Programming Lessons

  1. Lesson 1: The Basics
  2. Lesson 2: A Brief History of Computers
  3. Lesson 3: The Workings of Computers
  4. Lesson 4: A Brief History of Programming
  5. Lesson 5: High-Level vs. Low-Level
  6. Lesson 6: Compiled vs. Interpreted
  7. Lesson 7: Variables
  8. Lesson 8.1: Arithmetic and Operators - Decimal
  9. Lesson 8.2: Arithmetic and Operators - Integer and Boolean
  10. Lesson 9.1: Conditional Statements - The Basics
  11. Lesson 9.2: Conditional Statements - Branching Conditionals
  12. Lesson 10.1: Loops - The Basics
  13. Lesson 10.2: Types of Loop
  14. Lesson 11: Functions
  15. Lesson 12: Strings
  16. Lesson 13: Procedural vs. Object-Oriented

Programming Reference

  1. No reference yet.

Links

  • W3C HTML 4.01 Strict Compliant
  • W3C CSS 2.1 Compliant
  • Web Standards Group Member
  • Follow us on Twitter
  • Number Overflow - Free Advanced Scripts and Tutorials
  • Azure Ronin Web Design - Professional Web Design and Development
  • XML Sitemap
  • U Comment, I Follow

Feeds

  • RSS 2.0 Feed
  • RDF/RSS 1.0 Feed
  • RSS 0.9 Feed
  • Atom Feed

Lesson 5: High-Level vs. Low-Level

del.icio.us Digg Blinklist reddit

In our last lesson we took a brief overview of the history of programming. In that lesson we briefly mentioned high-level and low-level programming. In this lesson, we’ll expand on this a bit more.

What Level?

When we talk about high-level or low-level programming languages, we are referring to the level of abstraction from a computer’s native binary language. The lower the level, the closer it is to the computer’s native language, and the more component specific you must be. The higher the level, the more abstracted it is from the compilers native language and the more generalized it becomes.

Lowest-Level

The lowest of low-level programming languages is binary, the series of 0s and 1s that the computer actually processes. It is actually possible to program a machine in binary, though you probably wouldn’t enjoy the process.

A perk of programming in the computers native language is that there is no translation needed. It’s just like if your native language is English (your low-level language) and you also know Japanese (your high-level language). If someone speaks to you in English you can chat much quicker because there is no translation required. If someone speaks to you in Japanese, it is a bit slower because you probably have to translate it to English in your head, then translate your response back into Japanese.

This delay (or lack of) is known as the abstraction penalty. The more abstracted the language becomes, the more translation that is needed, so the slower it becomes.

You would only want to use binary on very simple machines where computational power is at a premium. A simple digital watch is likely programmed in binary, but it would take you an excruciating amount of time to program a word processing application in binary.

With binary languages, you pretty much can only write a program for a single device. On a different device, it is unlikely that it will work the same. So, you could say with binary programming, one program for one device.

A Step Up

The next step up from the binary language is assembly languages. Assembly languages are sometimes considered second generation languages (2GL), with binary being the first generation.

Assembly languages are still low-level, but they provide some abstraction to over the native language. However, you still have to be aware of minor caveats of the specific device you are working on, so that means you can’t write one program and expect it to work on all devices.

The language also looks a bit more like something we could read, with lines of code such as “ADD 5, X”, instead of “0011101010110011000″ (no, that isn’t a translation). So, it becomes a bit easier to program in.

For assembly languages, you can say that one program for a few similar devices.

Another Step

Another step up and you finally reach the low-end of the high-level programming languages. These languages are well abstracted from the underlying hardware. These languages can be referred to as third-generation language (or higher). Examples of these languages are Javascript and PHP, as well as languages like COBOL, FORTRAN, Ada, Ruby, ASP, C, C++, Java, Lua, and the list goes on.

Programming languages often have syntax that is easily read by humans (well, at least programmers), often using English words and various symbols such as brackets and parentheses. Some languages like Visual Basic use lots of English words and few symbols. Here is a short example:

Visual Basic Code

Public Function total(a ByVal As Integer, b ByVal As Integer) As Integer
    Return a+b
End Function

This function takes two parameters (named a and b) which are both integers (whole numbers), and returns their sum. We’ll learn more about functions and variables in later lessons. This snippets are just for comparison. As you can see, the only symbols we have here are parentheses and a plus sign. Everything else is English words. You could read this as a sentence:

Public function total, takes variable “a” by value as an integer and variable “b” by value as an integer, and the function acts as an integer. Return a plus b. End the function.

Some of those are still special terms we use in programming, such as return, which we’ll discuss later. However, you can still see that it reads not that unlike English.

The other style that languages like C, PHP, and Javascript use has more symbols in place of words. Here is the same code in Javascript:

Javascript Code

function total(a, b) {
    return a+b;
}

As you can see, these languages look a bit more different then English, but once you learn to read them it becomes just as easy. Javascript doesn’t have variable types (like integer), so we don’t have to mention that, but everything else is essentially the same. Here is how you could read it:

The function named total takes parameter a and b. Returns the sum of a plus b.

Also, because of high-level languages amount of abstraction, you can write one program and it can often run on many (or nearly all) platforms. So, you can consider high-level languages to be one program for many devices. It achieves this one to many with the use of compilers or interpreters, which we’ll discuss in our next lesson.


In this lesson we discussed low-level and high-level programming languages and some of the difference between the two. Nowadays, it is rare to use a low-level programming language on a computer itself. You will almost always use a high-level language for our modern computers (meaning, the computers such as those running Windows, Mac, or Linux).

You may however use a low-level language if you ever get into device programming such as creating the code to power a video card, mp3 player, or the like. These will sometimes still use assembly language.

In our next lesson we’ll take a look at the differences between compiled and interpreted (and translated) high-level programming languages.

This entry was posted on Tuesday, December 2nd, 2008 at 12:01 pm and is filed under Programming Lessons. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Please Login or Register or fill out the following to leave a reply:

If you haven't posted an approved comment before, your comment will not show up until approved.

  • HTML Blox Home
  • Blog
  • Design Blog
  • Flash Blog
  • General Blog
  • HTML Blog
  • Javascript Blog
  • PHP Blog
  • Programming Blog
  • Web Servers Blog
  • Forums
  • Where to Start?
  • Lessons
  • CSS Lessons
  • Design Lessons
  • HTML Lessons
  • Javascript Lessons
  • Programming Lessons
  • References
  • HTMLReferences
  • About
  • Resources
  • Contact
  • Go Green!
  • Sitemap

Copyright © 2008 HTML Blox

Unless otherwise noted, all images created and copyright HTML Blox.

Operated by Azure Ronin Web Design