Results tagged “programming” from Ye Olde Rad Blog III

On Sundays I resist dawdling before my morning trip to the coffee shop. I aim to get up & get out post-haste .. cuz sometimes the Orange County Rebels (bike group) make a pitstop there (like they did last Sunday) .. creating huge lines (and forever waits).

They take all the seats and are a noisy bunch (.. ~50 of them). I'm usually half-asleep until I've had my coffee, so the noise & commotion is, uh .. not good.

I've been studying programming recently. One of the first concepts any aspiring programmer learns is the » if-then conditional statement.

Conditional statements take the form: If a particular condition is met, then » do X .. otherwise » do Y.

CrossroadsSo I'm riding my bike this morning and approach the intersection at Flower street .. where I wonder, "Did I remember to put the DVD in my hip-pack?" .. cuz I need to return it to the library.

And all of a sudden .. without any effort on my part, this whole if-then conditional statement (beautifully formatted) pops into my conscious mind. Now I'm sure I've negotiated many similar if-then scenarios before .. but never so explicitly.

So I stop the bike at the Flower intersection and peek into my hip-pack. If I have the DVD with me, I'm gonna turn left onto Flower and » take Flower down to the library and drop off the DVD.

But the library sits on a main road (noisy, lotsa traffic). I'd rather take the back roads, which are far more scenic and quiet. So otherwise (then), I continue straight and » take the backroads.

I could've dropped off the DVD after coffee (nothing bothers me after coffee), but I wanted to stop at the grocery store afterwards, and pick up a few things. And the grocery store is the opposite direction (from the library). So I'd have to drop it off now.

Anyway, it surprised me to see how quickly & easily this technological concept had superimposed itself (unrequested, no less) over my conscious life. So sharp & clear. Pronounced & pervasive. I mean, I didn't really want this formal if-then statement to invade my thinking. I'd rather keep that aspect isolated to the Programming part of my life. But I couldn't.

At the coffee shop, I shared my experience with Kurt .. who is always sitting there, programming games on his laptop at the corner table. He's a programmer who specializes in generating 3D graphics for some small Gaming company that makes games for the Nintendo Wii. "You've just decribed the last 30 years of my life," he said.

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.

Programming Feels Like Coming Home

|

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.

Wrote my first program today. Instructions for converting Fahrenheit to Celsius. Simple, but more challenging than I expected .. considering I can do the conversion in my head with ease (TCel = TFahr-32 x 5/9).

Felix the Cat & his Bag of Tricks

Here it be » (define (TFahr>TCel f) (* 5 (/ (- f 32) 9))). [We all have to start somewhere.]

Kinda glad they password-protect the solutions page. Forced me to figure it out on my own. (Cuz if they hadn't, I definitely would've peeked.)

I am enjoying learning Programming .. something that was missing from my repertoire of techno-skills (digital bag of tricks). I mean, how many geeks do you know who can't program? I just never had a compelling reason to learn.

My only frustration comes from not being able to assimilate the info faster. There's a scene in the Matrix .. where Neo & Trinity are stranded on a rooftop. Spying a chopper, Neo asks, "Can you fly that thing?"

"Not yet," she replies before whipping out her cell and calling Tank (who's sitting back at the Control Panel). "Tank, I need a program for a V-212 helicopter. Hurry!"

Her eyelids flicker for a moment before popping open. "Let's go!" she says, running toward the chopper with her newly upgraded skill-set.

As mentioned last week, here's a brief ('Radified') intro to the introductory course on Programming I've been researching » How to Design Programs (HtDP).

This entry is distilled from info contained in the Preface. If a real programmer could check my phrasing for accuracy (to ensure no glaring errors) I'd appreciate it .. cuz I'm not yet familiar with all the terminology. See here:

How to Design Programs | An Introductory Course on Programming

Everybody should learn to program! Programming teaches a variety of skills (e.g. » critical reading, analytical thinking, creative synthesis, & attention-to-detail) important to many professions.

Educators should therefore give Programming the same priority as Math or English. [ RADical statement, no? ]

The HtDP course de-emphasizes the details of programming languages in order to focus on » the design process.

Two things make this course different from other introductory courses on Programming:

  1. Explicit design guidelines (comprising a 6-step process that begins with Analyzing-the-problem and concludes with Identifying-errors-thru-testing).
  2. The DrScheme programming environment (which is able to grow with a student as they master more material).

Programming boils-down to two essential concepts:

  1. Relating one quantity to another
  2. Evaluating a relationship by substituting values for names

The Scheme programming language allows students to focus on these two basic aspects, making it the natural choice for beginners. Students are therefore able to develop complete programs during their very first session.

"Computer Science is not a science," proclaims a professor at MIT, drawing an X over the word. He's introducing an introductory course on Programming called » 'Structure & Interpretation of Computer Programs' .. aka SICP. (Watch the video yourself » HERE.)

The Wizard Book » Structure & Interpretation of Computer Programs, by Abelson & Sussman

Less than a minute into the lecture and already I'm curious. "If it's not a science," I wonder, "then...??"

"It might be engineering," he continues, as if reading my mind, "Or it might be art. We'll actually see that computer so-called 'science' actually has a lot in common with magic."

I smile at this point, having gained insight into the graphic displayed on the book's cover, understanding why some refer to it as » The Wizard Book.

Then he draws an X over the word 'Computer' and says, "It's not really about computers either." (Okay, now I'm really interested.)

"The reason we think Computer Science is about computers," he continues, "is for the same reason the ancient Egyptians thought geometry was about surveying instruments ..

.. » because, when a particular field is just getting started, and you don't really understand it very well, it's easy to confuse what you're doing with the tools you use."

So-called Computer Science (he explains) is really about formalizing intuitions & knowledge about » Process (a word he writes on the board .. he's a lefty, btw). He then clarifies himself by saying, "How to *do* things."

How to Design ProgramsBeen researching the best way to get my feet wet in the world of Programming .. and I think I might've found an answer » How to Design Programs.

More info about HtDP can be found at » Teach Scheme. It's based on the classic Structure & Interpretation of Computer Programs (SICP), which which Peter Norvig calls "probably the best introduction to computer science."

SICP was created by two professors at MIT. You can actually watch the SICP videos » HERE (very cool). Here, too.

Everything about both SICP & HtDP is free (freely downloadable) .. tho you can also purchase dead-tree versions of these texts.

HtDP, which is a watered-down version of SICP, even comes with a graphical "programming environment" called DrScheme, which offers 5 incremental language-functionality settings (to avoid overwhelming the n00b):

  1. Beginning Student
  2. Beginning Student with List Abbreviations
  3. Intermediate Student
  4. Intermediate Student with Lambda
  5. Advanced Student

Tags

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