A Modest Proposal

There needs to be a selection on every ballot that reads “None of the above”. If “None of the above” wins the election, then there is another election, only this time all the candidates that were on the previous ballot are banned from running. If we had such an option, I know how I’d be voting in November.

I won’t disrespect either candidate by sharing my opinion of them in this public forum. I don’t think either one will be the kind of president that I want leading our country. I am upset that I am being forced to vote for someone just because I believe that they are the lesser of two evils. I don’t think that this is what our founding fathers had in mind when they created our great republic.

The situation has gotten this way slowly over time. We have allowed our news channels to become more about entertainment than information. Even so, things were already bad a century ago when Mark Twain made this comment on the state of the press.

If you don’t read the newspaper, you’re uninformed. If you read the newspaper, you’re mis-informed.   — Mark Twain

Our news media have one goal, to engage our attention so that we watch the advertising so that they make money. They don’t care if they cover the important events in the world. They love the current campaign because everyone is so agitated by it that they are watching just to see what will happen next. Meanwhile the advertising dollars are rolling in.

I guess we get the politicians we deserve. The way we treat our politicians, the only people that run for office are usually criminals and/or megalomaniacs. Anyone with sense enough to be a statesman wouldn’t put up with the abuse that we put our candidates for public office through.

I’ll vote in November. I won’t let the lousy quality of the ballot disenfranchise me. But I  hope we can do better the next time we elect a president. If there is a next time.

Quickie Blog From My iPad

This is going to be short. Our internet is out tonight. It has been strangely calm around the house tonight. No TV. No internet. Just me, Pam, Belle, and Cory. It reminds me of what life used to be like. Maybe we ought to turn off the TV, put down the iPad, and read a book for a change. Oh, right. I have most of my books on my iPad. It’s still better than randomly surfing.

This blog post is brought to you by wifi tethering off my iPhone. There’s nothing like it for access to the Internet in a pinch. Now that I’ve met my commitment to blog daily, I’m going to go back to the peace and quiet of a household without cable or internet.

Of Puns and Monkey Patching

The English language is plagued by a plethora of words that have many different meanings. Often, words get twisted over time until they mean something entirely different than they originally did. I suspect this is true in most natural languages. It can be the source of many misunderstandings, quarrels, and even wars. It is no surprise then, that computer languages are also subject to these kinds of problems.

One of the first recorded instances was in the original FORTRAN implementation. It allowed the redefinition of literal values. Consequently, you could add a statement like “0 = 100” to the beginning of a program and redefine the value of 0 to be 100. This rendered all of the computation in the rest of the program suspect if not totally wrong.

Being able to redefine the meaning of words in computer languages isn’t always a source of consternation though. In some modern languages, like Ruby for instance, it is used as a mechanism for fixing software. In Ruby, functions are called methods. A method can either be anonymous, in which case it is only useful in an immediate context, for instance as an argument to another method. Or, it can be assigned as the value of a name. Then it can be executed whenever it is required by “calling” the method using its name.

Because of the way that Ruby works, you can also do something colloquially  called “monkey patching”. This works by first assigning the value of a named method to another, auxiliary  name. At this point both the original name and the auxiliary name both refer to the original method. Then, you redefine the original name. You can insert expressions before and after a call to the auxiliary method. This new method is now the new definition for the original method. Any method that called the original method will now get the newly defined method.

To give an example of how you might use this feature, suppose you wanted to print a message “Now entering myMethod” every time you called the method named myMethod. You could easily define the new method to print that message before calling the original method using the auxiliary name. Later, when you were finished using this new monkey patched method to analyze the behavior of the program, you could restore the method back to its original state by assigning the value of the auxiliary method back to the original method.

This is a feature that can easily mess up your program. But it can also let it do things that would require much more effort if done any other way. As Spider-Man’s uncle Ben is known for saying, “With great power comes great responsibility.”

There are other interesting analogies between natural languages and computer languages. We’ll discuss them more in a future blog post.

Belle’s Big Adventure

Today Pam and I (and Belle) went to Logan’s Roadhouse for lunch. Pam had been craving prime rib. Belle and I were happy to humor her. This was Belle’s first time at Logan’s. She liked it from the very start. There were peanuts on the table. Belle loves peanuts. Pam took her picture eating a peanut and posted it to Facebook. Belle is used to being Facebook famous. She is, after all, the cutest service dog in the world.

Next, they brought out hot rolls and butter. Belle loves hot rolls almost as much as she likes butter. After many bites of buttered roll and a few dozen more peanuts, the entre arrived. Belle had never tried prime rib before but she made a note to be sure that we got it again sometime. She ate so much that her belly was round.

Then it was time to earn her grub. Belle is a migraine dog. She can tell when Pam is about to have a migraine. She lets her know by jumping up and licking her face. Pam and Belle go everywhere together. Belle likes to go places that smell good. She loves to smell fresh baked bread and hot pizza. We had to stop at the store on the way home and Belle dutifully trotted along next to Pam while we shopped.

When we were finished and checked out, I took our bags of groceries and went on ahead to take them to the car. Belle panicked. She was afraid I was going to leave them behind. We finally got home and put up the groceries. Belle got her new stuffed animal and settled down to gnaw it’s ears off and take a well deserved rest. Life is hard for a working dog.

If at First You Don’t Succeed…

I notice that there are all sorts of people following me on Twitter and Facebook. I don’t think I know them. I only accept friend requests from, or follow, as the case may be, people that I have at least met. I also have been known to accept friend requests from people that share an interest with me. For instance, I accepted a friend request from a ham radio operator in Italy that I  had never met before. That is primarily because I could look up his information given his ham radio call sign and verify that he is, in fact, who he says he is.

This is not so straight forward with most of the people I get friend requests from. I don’t mean to be unfriendly, but if I don’t know you or have a common interest with you, I don’t want you stalking me. I know. I have a blog site. I am pretty much “out there” on a bunch of social media sites. I am just trusting my gut to tell me how much sharing that I’m up for.

If you have sent me a friend request and I haven’t responded and you have some reason to be my friend, like you’ve met me or we share an interest or something, go ahead and send another request and tell me about what we have in common in the request. I won’t be mad or anything. I may still decide not to friend you but it doesn’t hurt to ask that second time with more details about why you think we should be friends. But two or three times is probably enough. Give it several months or a year before you try again after three strikes.

 

Madison Adventures

In previous posts I have mentioned that I am in the middle of a commitment to walk 13,000 steps per day (approximately six miles). It had rained this afternoon just prior to the time that I usually walk so I decided to go ahead and come home and get my walk in later. After dinner, I recalled that Microwave Dave and the Nukes, an excellent local blues band, were playing in the gazebo in downtown Madison, just about a mile from the apartment. I took it as a sign and headed out walking.

The grass was still damp and there were muddy spots everywhere but it was nice and cool. As I walked into downtown Madison, a train went through blowing its whistle loudly. There were young adults out hunting Pokemons with their cell phones. The train finally cleared the tracks so that I could get over to the side of the commons where the band was playing.

There was a shaved ice truck and forty or fifty folks sitting in lawn chairs. There were kids climbing on the bleachers and running around chasing each other. The band finished playing a number and I clapped loudly. The rest of the audience responded weakly. They kept playing. I realized that they weren’t through with that number after all. They came to a couple of more false finishes before the end of the number and we dutifully applauded each of them.

I was walking back and forth along the back of the audience getting my steps in. There were folks sitting on the tailgate of their truck. There was one gentleman talking on his cell phone with a little dog sitting in his lap. On stage, the band finished another number. I clapped and startled the little dog. He barked at me and his owner was forced to pause his phone call to try to calm the dog.

The Pokemon hunters came wandering through the audience. The band was just getting good and warmed up. I felt a few sprinkles of rain on my arms. I was standing under a tree. All of a sudden everyone got up and started running for their cars. Dave said, “Was it something I said?” I was already drenched with sweat so the rain didn’t bother me much. It wasn’t raining particularly hard in any case.

I made my way over to the Old Black Bear Taproom without getting too much wetter. I sat at the bar and ordered a beer. The guy next to me asked if I had been playing across the street. I do bear a slight resemblance to Dave Gallaher if you don’t know either of us very well. We are both stout men with gray hair and beard and we were both wearing black hats. Mine was a Panama Jack hat, Dave’s was a newsboy cap. I could have had a free beer if I hadn’t been so honest. I laughed and told a story of being mistaken for Dave on another occasion.

I finished my beer and walked home. I was still twelve hundred steps shy of my goal but I finished them up walking in place in front of the television set. It was an eventful evening in Madison, at least for me. I would have enjoyed listening to more music but it was just not to be.

A Brief Survey of Dynamic Programming Languages

A lot has been written about static languages lately. I am going to focus on dynamic languages. Dynamic languages allow the programmer to develop software by interacting with a “live” language system. The system accepts input and gives feedback about that input immediately as it is entered and evaluated. This encourages an experimental approach to programming. What happens when I do this? Just do it and find out immediately.

I talked at some length about the oldest dynamic language, Lisp, last time. As such, it provides an example of many of the features of subsequent languages. It is classified as a multi-paradigm language. This means that it supports many different styles of programming. You have probably heard of object-oriented programming. Lisp has a very flexible object system called CLOS (Common Lisp Object System). You may have heard of functional programming. Without going into great detail about the details of what functional programming is, Lisp was one of the first languages to treat functions as directly manipulable elements. Lisp also supports rule-based programming, aspect oriented programming, and many other programming paradigms. It has been said that most new languages are just adding features that were pioneered by Lisp.

What other dynamic languages are there? Another venerable and influential dynamic language is Smalltalk. It was developed by researchers at Xerox’s Palo Alto Research Center (PARC). It was the first language to treat every element in the langage as an object. It also was a complete system including editors, code browsers, and a host of other tools, all written in Smalltalk. The system is programmed by interactively defining new objects that are immediately available for use as soon as they are defined. The entire system is graphically oriented. Many of the concepts of modern graphical systems were first introduced by Smalltalk. Unsurprisingly, there are a number of implementations of Smalltalk in use today.

Another dynamic language that has been around for a long time is Forth. Forth is another language that inspires strong opinions. Programmers either love it or hate it. It has been described as write only. It is based on the idea of using a temporary data structure called the stack to temporarily store operands to be used in subsequent computations. The stack is a mechanism where the programmer can “push” values onto the stack and later “pop” the last item pushed. All operations are done on the latest item pushed. This allows an arbitrary number of temporary values to be readily accessible. It also requires the programmer to keep track of exactly what has been pushed onto the stack at any point in the execution of their program. Hence, the “write only” label.

Forth allows the programmer to define new functions interactively through the use of a REPL (Read, Eval, Print, Loop). This is a key feature of dynamic languages and goes a long way toward making up for the cognitive load of keeping track of the contents of the stack.

One of the more recent dynamic language to gain popularity is Ruby. Ruby was inspired by Lisp but adopts the Smalltalk stance that everything is an object. It first gained widespread notice because of a popular web framework written in Ruby called Ruby on Rails. Many of the best practices of modern programming have originated in the Ruby community.

The last dynamic language that I’m going to talk about in this post has had a rather profound impact on computing in the last couple of years. I’m talking of course about Python. Python is an interesting language. Noted for the use of indentation to indicate the start and end of computing blocks and the ease of using code libraries written in other static languages, it has captured the hearts of scientists and educators alike. It is the lingua franca of the popular inexpensive computer the Raspberry Pi. It has carved out a place for itself as probably the most popular modern dynamic language.

In future posts, I’ll talk more about each of these languages and even show some examples of what programs written in them looks like.

Static Vs. Dynamic Computer Languages

I’ve talked about the history of computer languages some in previous blog posts. In particular, I’ve talked about the difference between compiled languages and interpreted languages. Now I’d like to make a further distinction. Some languages are static and others are dynamic. More specifically, static languages are reduced to executable instructions ahead of time during a compilation phase where dynamic languages are processed interactively as the programmer explores the solution space defined by her program.

Static languages can more easily be made to run fast and can more readily be analyzed for correctness. Dynamic languages support organic exploration of the problem and its solution. Dynamic languages can, and have, been made to run fast and analyze themselves for correctness. It’s just typically more difficult to do so.

The surprising thing, to me anyway, is that we have had examples of both kinds of languages pretty much since the first higher level languages were written. FORTRAN was a static language written for engineers to automate the solution of numeric problems. Lisp was a dynamic language to explore the potential for computers to do things other than just numeric computation.

Engineers and Managers liked FORTRAN and its descendants. The applications that were written in them were immediately practical and it was easy to measure how much work the programmers had done. Initially this was measured in Source Lines Of Code or SLOCs. This was all well and good until the programmers realized that a more complicated solution requiring more source lines made them look better to the managers that were measuring their performance.

Over time, we learned a lot about how to write programs in static languages until finally, in recent years, most “serious” programming is done in static languages like C++ and Java. This is a sad situation. Static languages are good for many things but there are a lot of problems that are better served by dynamic languages.

Lisp has a bad reputation among many engineers including many computer scientists. This is often because they were forced to write a project using Lisp in a Computer Languages course by an instructor that didn’t understand Lisp themself. But, to be fair, Lisp does require a little bit of a different mind set from most static languages.

There are also a bunch of myths about Lisp that may have had some basis in fact at one point but over time, Lisp has improved and the hardware that all languages run on have improved, and the myths are, for the most part no longer valid. For instance, it was initially said that Lisp wasn’t any good for doing numerical computing. That was initially true, largely because the authors of Lisp language systems were interested in exploring the non-numerical aspects of programming and consequently made little effort to make the language handle numbers efficiently. This was remedied in the early seventies but Lisp retains a reputation for being bad with numbers in some circles.

The main thing that Lisp is better at than its static conterparts is allowing the programmer to interactively explore a problem space. In a static language, one typically has to write a substantial amount of code before you get to the point where you can run it and see how it behaves. If it doesn’t do what you intend, which is typical for the first couple of attempts, you have to go back to the source and change it, recompile the program, and rerun it to see if you’ve fixed the problem.

With Lisp, one types expressions directly to the interpreter using what is called a Read Eval Print Loop or REPL. The REPL reads a line of code, interprets it and prints the resulting value. Then it repeats the process (hence the Loop). This allows the programmer to explore the problem and potential solutions interactively, getting feedback from the computer after each line. It is amazing how much faster correct programs are developed using this approach.

I’ll talk more about dynamic languages in another post soon. There is much that I want to say about them. And Lisp may have been the first dynamic language but it certainly wasn’t the last. I’ll have more to say about other members of the dynamic language family. I’ll also have something to say about ways that we can realize the best aspects of both of these styles of language by combining them into hybrid languages.

A Plea for Compassion

I don’t know what to think any more. Everything that I was taught about decency and honesty and fair play seem to have been thrown out. I hesitate  to post this because I’m sure there will be people that will use this as an excuse to try to advance their pet theories and or candidates. I don’t want to hear it. I just want people to be decent and respectful of others. You don’t have to agree with someone to be nice to them.

Everyone doesn’t have to believe the same things or have the same goals. The world would be a much poorer place if that was the case. We used to be able to have civil discussions about our differences but it seems that lately no one wants to listen to anything that anyone else says. And when you do listen, more often than not all that any says are personal attacks. Things like “How could you be so stupid to think that?” There is no discussion of facts or even agreement to peacefully disagree.

It is hard to live in a world where I’m afraid to voice my opinions because of the hateful personal attacks they might arouse from strangers. This is no way to live. This is not freedom. This is not democracy. Look deep in your heart and find some compassion. Think about how the other person feels about a situation. Hold a rational discussion based on facts. You might learn something. So might they. You will both feel better about each other.

Contemplating How We Create

Some days when I sit down to write, I just want to get my words down as quickly as possible so that I can get on with the things that I have planned for the day. Today, I am in less of a hurry. It is paradoxical that since I’m not in a hurry, I am able to express my thoughts more quickly and clearly than I usually can. I think it is, in part, giving myself permission to think about what I have to say. This may entail periodic pauses to think about the next thing that I want to say. So long as I don’t get lost in thought, that’s okay.

Actually, depending on whether or not I am productively daydreaming, it is even okay if I get lost in thought. Sometimes that’s how new ideas percolate up to the conscious level of our minds. We just have to carefully pay attention as it emerges. My ideas often come as snippets of images. I’m also very influenced by music and other sounds in my environment. I am sometimes distracted by them so there is a constant tension between inspiration and distraction. That is probably the case all of the time. Who is to say when a distraction may become the focus of the inspiration? It has happened to me as  often as not.

Being able to recognize those inspirations and experiment with them dynamically is what Brett is talking about in so many of his presentations. I want to use the tools that he demonstrates in his presentations. They illustrate an exciting approach to thinking about things. At one point Brett made a distinction between two styles of programming, engineering vs. authoring. I have always though of what I did as authoring.

I have always been concerned about writing programs that communicate with others. It is interesting that Brett is more concerned with building tools for people to communicate their ideas. It is a different approach to using the computer. He does have thoughts on how to program as well. It is a strange fractal idea, communicating ideas about the tools that you are using to communicate.

I’ve always felt that thinking was a fractal activity. I think that is why artificial intelligence is such a hard thing to achieve. I use the term artificial intelligence here with what I consider to be its typical connotation. Without the ability to think about the way you think and to modify the way you think dynamically, you aren’t really intelligent, are you?

I have experienced the pleasure of exploring a system interactively. It is patently obvious to people that approach programming from that direction that immediate reflection of the consequences of your changes is essential to productive development.

When you are creating, you often don’t really know where you are going with an idea. You start off in some direction and see what happens. The journey informs the destination. As you get to one place, the next place suggests itself. This happens whether you are writing a song or a novel, solving a packing problem or creating an algorithm to sort a multidimensional array.

Another aspect of creating is that it is rarely about manipulating symbols. Even writers work from inspiration that is something other than the words they write. They imagine something in terms of images or sounds or other sensations. They translate those experiences into words that attempt to communicate them to the reader. Words often fall short. Pictures are usually more expressive.

And then, there is the dynamic experience. It may be a picture that you can change by clicking on it or a song that you can affect by waving your hands in a particular way. There is often a computer involved but it isn’t absolutely necessary. A Rubic’s cube teaches you a lot about mechanical geometric transformations. A musical instrument teaches you a lot about music. These are all examples of dynamic media for creating dynamic experiences.

The main reason that we overlook the dynamic nature of computers is that we are stuck in a pen and paper mind set for solving problems and expressing the solutions. This is a truth that has been laying under the surface of my consciousness for decades and I  have only just been able to understand it, thanks to the work of Brett Victor. I need to reflect more on how to incorporate it into my daily work. I need to keep my eyes open for insights that will inform my choice of a principle to champion.

I haven’t said anything about that yet. It is probably best left to someone else who has discovered their principle to explain it. I just know that deep solutions are not focused on a particular problem but rather on how we go about solving all problems.

I sometimes think that the best of my blog posts are channeled instead of being written. I’m not sure where they come from but it is more like reading something that someone else is writing than writing it myself. This post has been an imperfect rehash of a lot of the ideas that I have learned from watching the Brett Victor videos online. It is interesting to note that although the principle that he walks away with is uniquely his own, many of the ideas that he bases his work on are from other visionary pioneers. He credits them in his work.