Danny's Tech: Where West and East Intersect

Tuesday, November 15, 2005

Programming Primer

[I started writing this in October but sort of got left behind. I'm posting it with backdating since I have a really new posting coming right up.]

Programming for me means:
directing computer to follow a set of rules based on given input(s).
There are three ways to write programs:
  1. textual: it can be anything from raw machine code binary or assembly to C/C++ to Microsoft Excel macros. It is a "text" based (I include the so called binary executable files here) list of intructions for the computer to follow.
  2. visual: no text is required to control the computer (underneath it all it could be text based since ultimately it has to run on a computer but text has to be optional and should never be needed). All programming is done via icon and graphical elements like Stagecast, LabView or Statemate.
  3. CASE (computer aided software engineering) tools were meant to bridge the gap between visual programming and textual programming (tools like UML Rhapsody). However, no one has solved the problem of programmers wanting to tweak the computer generated code and then seeing the changes reflected back in the CASE tools. (The gen'ed code is usually nasty to work with in the first place.)
Another perspective are the "generation language" that was all the rage in the 80's:
  1. 1st GL: raw binary or toggle switches on the computer
  2. 2nd GL: assembler
  3. 3rd GL: C, Pascal, BASIC
  4. 4th GL: SQL and some may add IDE (integrated development environment) like Visual Studio or Eclipse here.
  5. 5th GL: AI (artificial intellegence) was to be the answer to all problems: with natural language processing and expert system, one was suppose to write programs in human language (any version :-) and generate perfect code. [In the 80's, there was a sense of "yellow peril" of Japan taking over the HiTech world since Japanese government declared a frontal assult on AI and 5th gen computing. This was when Japanese memory chip makers were pounding US makers (and forced companies like Intel to quit the memory business: funny how today Intel and AMD still make flash memory and Micron was started to challenge the Asian RAM memory makers). Turns out that memory chip was a commodity and now Korean makers are beating the pants off Japanese makers (Chinese will probably be next) -- here in Austin, Samsung is making memory and is planning to expand! Intel still is the biggest chip maker since they specialized in one thing that really matters: the CPU. There is a renew sense of yellow peril with Chinese buying out U.S. tech (like Lenovo buying IBM PC business) but it, too, shall pass...]
I found NASA's version but not quite what I remember. WikiPedia has another take on 4th and 5th.

Language orientation is another way to categorize programming languages:
  1. Procedural: this is the way the computers work: you have functions (procedures) and data, where the programs are procedures and you throw data at the program: Includes languages like assembly, C, Pascal, BASIC, FORTRAN, COBOL, Ada.
  2. Object-oriented: this is all the rage today. The basic idea is that you deal only with objects which combine functions (or methods) tightly tied to their data. Languages include: Smalltalk (Squeak), Java and C++
  3. Functional: treats program as almost pure math. Unlike procedural or object-oriented, there are no internally kept states, preventing any side effects common to procedural languages as well as allowing for formal proof (of correctness). Languages include (pure) Lisp, Haskell and ML.
Aspect-orientation is more of an extension to the above since is more like the ability to create new language keywords (i.e., language extension). Languages like AspectJ and AspectC++ are extensions of existing languages.

Intentional Programming is more like 4th generation programming language in a pure sense of programming levels and as much as I like a lot of concepts there, I don't think it really solves the problem of writing good code: easy to create and test and debug and maintain!