Think Outside the Box

Sunday, January 18th, 2009

There hasn’t been a paradigm shift in software development for quite some time.  I think the main reason for this is because of our myopic tendency to assume software development can only happen with programming languages based off some lexical syntax.  Visual Basic and the following rapid application development (RAD) IDE’s have shown us this is not true for some aspects of code.

I wish to explore Intentional Programming and talk about some of the new ideas it presents.  You can read the link for more details but basically Intentional Programming gets rid of the lexical code portion and allows the programmer or user direct access to the parse tree.  Lisp allows you to program the parse tree directly but Intentional Programming is a little bit different.  It says, yes, the program is eventually a parse tree but give the end user or programmer tools to build the parse tree for each particular problem domain.  Often times the “intention” of the programmer is easier expressed graphically, or maybe by recording a macro, or maybe by drawing lines between objects representing data objects.  For example, if you needed to read 5 columns from a database table, it would make much more sense to pop up that table in a GUI and then just click on each column.  From there it would store that “intention” in the parse tree.  Only the data and the intention would be stored.  The intention can be thought of as a function that operates on the data.  So instead of writing everything using code in a text editor, you use a lot of small tools to construct a parse tree in the most natural and intuitive means possible for each and every problem domain.

Why is it that we are only using text in such a limited fashion?  We are not using color, size or position to represent any additional syntatic meaning.  This makes for inefficient communication between the programmer and the computer.  It would be easier to read code if color, size, or position could be used to represent more.  This is readily seen when using color syntax highlighting in an editor.  It is much easier to scan code to understand the meaning.  The human brain can spot things quicker that it would have otherwise skipped over.

Why are we using only text and not graphics to represent our code?  The compiler takes some kind of input and translates that into machine code.  Why does it always have to be text.  Why can’t we use something that is easier to read and write code in?  I’m not exactly sure what this might be.  Perhaps it could be some kind of flow chart, or it could be wiring objects together like Legos.

I don’t claim to have all answers to these questions.  I am throwing them out there in the hopes that it triggers imagination in others.  I intend to share my thoughts on these questions as I have insights.

Programming in it’s essential nature is breaking down a problem and then specifying the solution to that problem in a way that a computer can repeat.  Why do we always use the same language most of the time?  We tend to have our favorite languages and we use them to solve our problems.  This greatly limits our ability to think about the problem.  We break the problem down into the components of the particular language we want to use.  This goes back to the saying, if all you have is a hammer, everything looks like a nail.  Programmers are often unaware there is a better way of solving their problem because they think they only have the tools the language provides them.

I think a better way to go about solving problems is to have a generic framework for building our solutions and then builidng the language to suit the problem.  This goes back to intentional programming.  A programmer should not just use what is in front of him to solve a problem but build the tools he needs to solve the problem as well.  This is top-down and bottom-up development at the same time.

Frequently programmers develop the same kinds of things over and over.  It is to the advantage of the programmer to learn more about building tools, especially about building his own small languages to express a problem in a manner that is concise and without needless syntatical artifacts.

I recommend programmers take a look into tools like ANTLR to get a better idea of what I am talking about and to expand their minds.

ANTLR in and of itself will not allow you to combine multiple languages together.  This is why I said some kind of general universal framework is needed.  I think intentional programming has a lot of ideas that can help advance us in that direction.

I will attepmt to cover these ideas more in future posts.  I apologize if my writing is difficult to follow or lacking in clarity or explanation.  This is my first time trying to write my thoughts down in any serious manner.  Hopefully, my writing will improve with each post.

The Digital Divide

Sunday, January 4th, 2009

In the last few years I have become increasingly aware of a chasm between programmers and computer scientists.  It seems like the two have nothing in common when in fact they should be one and the same.  To be a truly great programmer you must also be a great computer scientist.  Why is it that so many programmers have no concept of computer science?

This chasm has been there all the time, but has been made more apparent the more I study computer science.  What is the difference between a programmer and a computer scientist you ask?

This post stereotypes the programmer and computer scientist.  I exaggerate the weaknesses in each to illustrate a point.  Obviously, this is not necessarily the case and this post should not be viewed as a rant or an attack on the two types of individuals mentioned here.

The Programmer

The typical programmer is someone who writes code on a daily basis.  They are familiar with a few programming languages and their API’s.  The vast majority of programmers are only aware of the C family of languages (C, Javascript, Java, PHP, Actionscript, etc) as opposed to functional languages (LISP, Scheme, Erlang) or concatenative languages (Forth, Factor).  They typically write the same type of code over and over and never think they can abstract it out to make their work easier and less repetitive.  Their thinking, and hence their ability to solve a problem, is constrained by the tools they use.  Even after doing something over and over they never have the thought, “There must be an easier way to do this”.

The Computer Scientist

The computer scientist is someone who knows a lot of theory, is well versed in math, and understands how computers work at a fundamental level.  They see the computer as an abstract system of computation.  They are usually more involved with academia rather than day to day programming.  When confronted with a problem they break it down into its fundamental parts and then build a model to solve it.

In short, the computer scientist is someone who sees a problem and builds a tool to solve it.  The programmer is someone who is familiar with a few tools (languages / API’s) and uses them to solve his problem.

The Problem

The problem is the programmer is constrained by his tools.  You may have heard the saying, “If all you have is a hammer, everything looks like a nail”.  The programmer will eventually get the job done but not necessarily in the most elegant or efficient manner.

The computer scientist doesn’t really spend much time in the trenches, so to speak, to know the problems facing the average programmer.  They are more concerned with solving purely intellectual problems.  As a result the computer scientist doesn’t build the tools the programmer needs or does so in a way that is not very useful, convenient or easy to use for the programmer.

So, computer scientists don’t actually use the tools they create or know what tools need to be created and programmers only know about the typical tools other programmers are familiar with.  Programmers don’t spend much time researching to see what other tools are out there or bother to create their own tools.

The Reason

There are some reasons why these situations exist.

The programmer usually writes code for other people.  They are charged with getting a job done and they are only interested in getting that job done as quickly as possible.  When confronted with a problem they look at their tools they have in front of them and then set out to work on the problem.  As soon as they get the job done there is more work for them to do.   As a result the programmer typically has little time to learn new languages, environments or API’s.

Not having a solid background or interest in computer science the programmer often does not know there is a better way of doing things.  They have learned from other programmers that is all there is.  They are not accustomed to taking a step back, abstracting out what they are doing, and developing a system that allows them to get the job done faster in the future.

Building tools takes time.  If it takes 30 minutes to get a task done and it looks like it would take a full day to create a system to do the same job in 30 seconds the typical programmer is not going to want to spend their time working on it.  They are not going to want to explain to their boss why what previously took 30 minutes is now taking 8 hours.  If there are other programmers around, they don’t want to look like an incompetent idiot while their fellow programmers are, at that moment, finishing much more work.

There is also a break even point.  If it takes 30 minutes to solve the problem and the problem only comes up a few times a year it would be counter-productive for the programmer to spend 8 hours coming up with a system to let him solve it in 30 seconds in the future.  If on the other hand, it is something the programmer does on a daily basis, that same 8 hours is going to pay for itself in less than a month.

That’s a 6000% ROI in a month.  How would you like to make that in the stock market?  Unfortunately, the typical boss is even less aware of a better way of doing things or is in the same situation where he is reporting to someone else and doesn’t want to have to explain why it is taking longer than normal.

Typically you are not going to see 60 times increase from creating a tool.  But you may see 5 times the increase and that’s nothing to ignore.

As mentioned before, the computer scientist lives in the world of academia.  They typically don’t work on the same things a programmer would on a daily basis.  As a result the problems they solve are a little grander in scale and do not always have direct application.  Again, this is a generalization to illustrate a point.  Academia has provided enormous value to modern programming.

The Solution

I have attempted to illustrate the weaknesses of strong polarization to only one side.  The obvious solution is to move towards the middle.  The programmer should learn more about computer science and theory.  The computer scientist should spend more time working on real world projects.

For programmers, I recommend the books The Pragmatic Programmer and Code Generation.  Study other programming languages, especially those that are radically different from what you are used to.  LISP, Ruby, and Factor are all good candidates I would recommend.  Look at open source projects, especially frameworks and see how they do things.  They will expand your mind as to what is possible and make you much more efficient.


Saturday, January 3rd, 2009

Code Innovator is dedicated to innovating how code is written. This a copy of what I wrote on the about page.


For quite some time I have had this nagging feeling that the way we currently write code is woefully inefficient. I feel this sense of vision and calling that compels me to say “There is a better way”. At the time of this writing I only have a few scattered ideas and vague concepts of what we can do better. But, part of me just knows there is a better way. It’s almost clairvoyant in nature. It’s like it’s on the tip of my tongue and I’m struggling to communicate it. I can’t describe it. This site will document what I am able to communicate at the moment and my odyssey to further manifest this vision.

By researching and studying other programming languages I will learn new programming idioms that will change the way I program and teach me to better use the languages I already know. When a writer expands their vocabulary they are able to express their thoughts more eloquently. They are able to use less words to communicate the same idea and they are familiar with more concepts. It is my hope that increasing my “vocabulary” of programming idioms will allow me to design a better language.

Unanswered Questions

Programming languages haven’t really changed in the last 30 years. It seemed like in the beginning, when people first started writing software, there were all kinds of innovations. What happened? Why has it almost completely stopped?

Why is it that we can explain to a programmer exactly what we want in a few minutes and yet it will take that same programmer hours, if not days, to write it? Sometimes it is because computers are just not capable of understanding what we want. Other times the computer may lack the neccesary domain knowledge to solve the problem. Frequently though, this is not the case, or at least it doesn’t need to be the case. Often, it is because there is an insufficient level of abstraction. Closing the gap between intention and implementation will be one of the main topics of focus.

The Plan

I intend to take a structured approach to solving this problem.

  • define the problem / pain
  • define the possible goals
  • research other languages and development methodologies to discover the general characteristics of their strengths and weaknesses
  • implement ideas
  • experiment and test the ideas with real world applications
  • report
  • refine / repeat process

I will cover this in another post.

About the Author


My name is Brennan Cheung and I have been programming for a little over 20 years. I started programming computers at the age of 7 on the Commodore 64. My primary interest at that time was to learn how to write video games. I started off with Basic and them assembly on the C64. Later I moved onto the IBM PC, C, x86 assembly, Java, and then a whole bunch of other languages after that.

I started off with video game programming, then in high school I started to gain interest in operating systems. Right now the bulk of my programming is web based programming to one degree or another. Improving this area is my primary intent.

I am currently employed full time as a programmer. I enjoy spending my free time learning about compilers and different languages. I also enjoy glamour photography and have had my work published in various magazines, web sites, and calendars.