programming: August 2009 Archives

Two concepts introduced early-on in the career of any aspiring programmer are » syntax & semantics. Syntax refers to the structure (or form) of code that a programming language specifies. Semantics refer to the meaning .. assigned to symbols, characters & words.

Arabic numeral threeI first became familiar with the notion of syntax while studying Cascading Style Sheets. CSS syntax employs the following form » selector {property:value}. Simple enough, no?

This form/structure allows you to style your web pages with 'rules' such as » p {color:green} .. which will change the color ('property') of text in a paragraph ('p' = selector) to (a 'value' of) » green.

While CSS might not be an official programming language, it does contain aspects that (in some ways) resemble them. And all programming languages employ syntactic rules. BTW - here's a good CSS book.

A professor once told me that the standard form (syntax) of a sentence in the English language is » Noun-Verb-Direct Object. In other words » 'Bill hit the ball.' Or, 'Mary ran up the the hill.' ( "This does that to the other." )

Most English-speaking people would agree that this format tends to work best (to convey ideas). But it is not a hard-n-fast rule. You can easily say » 'Up the hill ran Mary,' or 'Mary up the hill ran.' People might think you weird, but they'll know what you mean.

In English, we say "black beans." But the Spanish-speaking Mexicans here in Southern California put the adjective AFTER the noun » "Frijoles negros." (Can't believe frijoles negros has its own dang Wikipedia entry.) I'm chowing on a bowl of some frijoles negros & rice right now.

Programming languages (on the other hand) have little sense of humor. Break one of their structural rules and they will not only protest, but boycott your program outright. Obviously there are reasons for this strict precision. There can be no misunderstanding.

It's possible to learn to drive a car without ever understanding how one works. (e.g. » what the pistons do, the crankshaft, transmission, differential, etc.) And many drivers do just that. No problem. But I like to know how things work. This includes my study of Programming.

Diamond Head, WaikikiMy degree-path specified one "sciencey" Computer Science class. So naturally, that's all I took.

The first half covered the various components of a computer and their functions (» the processor, memory, hard drive, etc.). The second delved into programming (with Pascal) on a rudimentary level.

Our instructor seemed more interested in the girls in the class than teaching. In fact, the hottie (red-head) who I studied with in the hours immediately prior to the Final exam, told me she'd spent the night at his place. (Her hair was messed & she referred to him by his first name.)

Based on the material she suggested we review, I did not doubt her claim. Because it quickly became clear, soon as the Final was handed out, that her suggestions mirrored the material contained therein. (Much of this material was never covered in class.)

I basically got an 'A' in that course cuz that girl spent the night at the instructor's place .. cuz many of those questions I'd never seen before. But that's ancient history now.

I have however, been delving into HOW programming languages work (crankshaft, pistons). I forget how I stumbled upon it, but there's an online version of this book: Programming Language Pragmatics .. located » HERE (Google books).

Actually, the online version is 2nd edition (2006), while the one for sale at Amazon is the 3rd (2009). But I doubt there's much difference .. that would matter to a rookie like me, anyway.

One of the concepts that keeps popping up in my study of Programming languages is » expressiveness. Loosely defined, expressiveness is » the ability to say a lot with a little (my own definition).

ShakespeareWhere Programming languages are concerned, expressiveness might be the ability to DO a lot with a little.

Related terms » Meaningful. Concise. Simplicity (as it applies to the elimination of unnecessary complexity). Elegance. Efficiency.

No doubt, you know an 'expressive' person or two. But sheer volume of words does not an expressive person make.

Some people can talk for hours without really saying anything (.. at least not anything meaningful). While others can speak volumes with a simple glance.

In programming, the notion of expressiveness is often touted as a plus, associated with "higher level" languages. I could be wrong, but the idea I get is » the more expressive (a language is) the better. Notice the statement that begins the second paragraph here:

"My contention is that expressive power is the absolutely most important property to focus on right now."

This from a developer with an admitted "unhealthy interest in programming languages," who's currently developing his own. Since the learning process often involves relating new information to things we already know, that's what I've been doing.

As chance would have it, I was watching Hamlet last night (the Kenneth Branagh version). Didn't take long to realize much of what was being said wasn't getting thru. ( "Say what?" )

So I enabled English subtitles and started vigorously working the pause button .. in order to read & digest the Elizabethan chatter. Much better.

Saying Much with Little

Note how the phrase » 'To be or not to be' is exceedingly simple. Yet it carries much meaning beneath the surface (.. especially that 'not-to-be' part).

The ability to "say much with few words" is a primary reason cited when discussing Shakespeare's literary prowess. In other words, it's not just what he says, but the way in which he says it .. that makes his writing so .. descriptive, enchanting.

The SICP course, hailed by many as the single-best introduction to Computer Science, focuses on » methods to 'control complexity.'

Structure & Interpretation of Computer Programs The MIT professors who designed the course (Abelson & Sussman) both come from a background in Electrical Engineering, which obviously influenced their conceptualization of the course.

In other words, it seems they applied the techniques associated with Computer Science to a conceptual framework designed to teach Electrical Engineering (.. a familiar paradigm).

The course focuses on solving the problems associated with building "very large" (complex) computer programs by expounding on the following 2-step process:

  1. Simple things (such as numbers, symbols, $variables, data, procedures) are combined to build complex things.

  2. These complex things (typically data & procedures) are then wrapped in a "black-box" in order to 'simplify' them .. so they can be used as components in building even-more complex things.

The technique of 'abstracting' complex things so they can be used as components in building something even more-complex is termed » "Black-Box Abstraction."

Consider how a microwave oven (or fridge or stove) is used as a component in building a kitchen (which is part of a house, which is part of a neighborhood, which is part of a city, which is .. part of something ever more-complex).

Notice how the electronics (inside the microwave) are hidden from view. All you know is » cold-food in, hot-food out. (Simple.) That's the principle behind 'abstraction' » hiding complexity.

I'm learning programming. Not a specific language, such as Javascript or Ruby. Rather, the concepts of programming .. that can be applied to ALL programming languages.

[ By the way, I've completed my study of the Unix shell. You can retrace my CLI steps » here. ]

Structure & Interpretation of Computer ProgramsMy particular style of learning emphasizes nailing down foundational concepts .. those primarily presented at the beginning of a course.

While this approach can be frustrating initially, because it slows progress at the outset, while foundational concepts are digested on an emotional level .. it allows me to crank thru with confidence (at an accelerated pace) once the foundation is set. [ See note #1 for an example. ]

Like any good geek, I've previously sought entrée into the world of Programming, but always settled for a cursory review of specific languages. (Most recently » Javascript.) Never found that global entrée I was seeking .. until recently.

The approach that is working for me .. is a combination of studying the HtDP text and watching the SICP videos (found » here).

  • SICP = Structure & Interpretation of Computer Programs (based on Lisp)
  • HtDP = How to Design Programs (uses Scheme)
  • Both languages are similar. So the two courses complement one another nicely.
  • The SICP videos and the HtDP text are freely available online, along with the SICP text.

The SICP course is legendary in the world of Computer Science. More people refer to it as the single best course on Programming .. than any other.

It was designed and presented by two professors at MIT (.. arguably the world's finest institution of geekdom). Moreover, it was recorded and the videos posted online, where they remain available for download & viewing (free).

I admit, I need to view each video multiple times before feeling comfortable enough to move on to the next lesson. But I *am* getting it .. and enjoying it.

The HtDP course is a simplified version based on the concepts presented in the SICP course.

Neither the SICP videos by themselves, nor the HtDP text alone works for me. But .. combining both courses really makes things click. I get it. I see what's happening .. how things work. It makes sense. And I look forward to learning more.

About this Archive

This page is a archive of entries in the programming category from August 2009.

programming: February 2009 is the previous archive.

programming: September 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.