#52WeeksOfCode Week 25 – Factor

Week: 25

Language: Factor

IDE(s): Factor IDE

History (official):

(From the Factor Wiki)

“Factor (http://factorcode.org) is an expressive, fast and full-featured Concatenative language invented by Slava Pestov. The Factor implementation is released under a BSD license and runs on most common platforms.

Factor has been in development since September 2003, with a strong focus on practical programming all the way through; it began as a scripting language for a game. Factor has a small but friendly and vibrant community, and it is easy to learn.”

History (real):

Sayre’s Third Law of Politics states:

“Academic politics is the most vicious and bitter form of politics, because the stakes are so low.”

I was reminded of this while doing research on Factor. Apart from the project home page and a couple of YouTube videos, there is surprisingly little to find. On the way, I came across other languages that have small, but rabid fan bases.

Non-programmers don’t realize how many programming languages there are. The Internet being what it is, it didn’t take me long to find someone who wrote up a list.

There are hundreds, not even counting the dialects. In fact, they had to move the dialects of BASIC to another page. Don’t take my word for it. Go look.

Based on Internet discussions and mailing lists, it seems that the smaller the programmer community for a particular language, the more defensive the group.

Personally I don’t care what language you use. Like their spoken counterparts, programming languages are just a set of rules for getting thoughts out of your brain and into the world. If one works better for you than others, blessed be. Let a thousand flowers bloom, man.

Just…calm down, okay?


The first thing we need to do is unpack the official description of Factor because it is the opposite of ‘market-speak’. Marketers find the words that drill straight down into your id and bypass your higher brain functions to get their message across.

Programmers, on the other hand, don’t give a crap what you think. They know what all the words mean. What’s your problem?

First the easy word – expressive.

When someone refers to a programming language as ‘expressive’ they mean that the code is simple, direct and readable. For example, compare these two lines of code:

printf “Hello World!\n”  (Bash)
System.out.println(“Hello World!”); (Java)

They both do the same thing (print the phrase “Hello World!”) but the first has a simpler syntax and is more readable. In other words, it’s more expressive.

Nothing comes for free. The trade-off with expressive languages is that for more complex functionality you need to write more code. It’s easier to read but it’s more work.

What about ‘concatenative’?

That takes more explanation.

In most programming languages, commands have a similar syntax that goes

command plus argument plus parameters

Just as we expect an English language sentence to take the general form

subject plus verb plus object

A concatenative programming language takes a different approach. The code words are put in a stack (visualize the spring-loaded plate dispenser in a cafeteria) in reverse order. When the code runs, the top word is pulled off of the stack followed by the next and the next until the stack is empty and the program is done. (No code left on the stack.)

That means that if you want something to execute first you have to put it on the stack last. Printing “Hello World” in Factor looks like this:

Hello World in Factor

Hello, Factor!

The argument (“Hello World”) goes on the stack first, followed by the print command. This is sometimes referred to as Reverse Polish Notation or RPN. HP calculators use RPN (‘3 4 +’). Fans of RPN say it’s faster and more efficient. For one thing you don’t have to press the equals key on an RPN calculator.

Personally I have enough trouble thinking in the forward direction. But I’m very pragmatic and if a tool works for you but not for me…well, there are other tools for me.

For that reason I’m not going to do anything more complex than above with Factor because I’m afraid my brain will fall out of my head.


#52WeeksOfCode Week 22 – PHP

Week: 22

Language: PHP

IDE(s): TextWrangler plus MAMP

History (Official):

(From the homepage for the PHP Group)

“PHP is a popular general-purpose scripting language that is especially suited to web development.

Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.”


History (Real):

PHP is a very popular programming language and runs on over 200 million Web sites, including some very large ones like Facebook. Not bad considering PHP was not originally conceived as a programming language.

According to creator Rasmus Lerdorf in a 2012 interview with the IEEE house magazine Computer, PHP was originally just a collection of utilities he hacked together to make his web page development easier. He found he was writing the same code over and over again for his clients so like any good coder he took it upon himself to automate the process.

All well and good.

But other programmers saw what he was doing and asked for copies of Lerdorf’s toolkit. Hackers being who they are, when they found bugs they fixed them and passed the changes back. Eventually he handed off responsibility for pieces of his code to others and PHP grew in scope. Each programmer added functionality to scratch their own particular itch and contributed their code back to the community. Lerdorf mostly stayed out of any code architecture decisions, preferring to leave that to the community.

Those of you who are familiar with the open source development process may see the fundamental flaw here.

For the rest of you, let me explain. When you set out to create a programming language (or any non-trivial software project), you create a specification. This is a document that sets out the conventions that everyone has to follow in order to participate. For example, you make a list of keywords, words that have special meaning in the language. This lets others know that these words can’t be used for anything else.

With a specification document, you can have many developers working on the project and have some assurance that they won’t be stepping on each others toes.

A specification document can and does get updated but it’s usually in a way that adds features or project scope without significantly changing the basic rules.

Next, even an open source project staffed by volunteers needs someone who is the final word on changes. This could be an individual (like Linus Torvalds with Linux) or a group (like the team that manages Debian).

Without these, the software project has no real structure. Features get added and taken away without much of an explanation and some functionality may be either missing or duplicated by multiple redundant methods.

The fact that PHP is so widely used and seemingly robust is more of a testament to the heroic efforts of the community of PHP developers who are applying spit and baling wire to make this code work.

But there are always consequences.

Just for fun, I searched for ‘php sucks’ and got almost 10,000 hits. After glancing through the links, here are some of the most common complaints:

  • The code libraries are a disorganized mess
  • Unnecessary duplication of functionality
  • No coherent design
  • Messy and complex
  • Incorrect or incomplete documentation
  • Data input needlessly complex or error-prone
  • Poor code readability

These are some of the milder complaints. There are more, but you need to be a programmer to fully appreciate the horror.

I don’t blame Lerdorf. By his own admission, PHP was never meant to be a programming language. It was just a bunch of neat, useful hacks that a talented, enthusiastic community of programmers adopted as their own. In a sense, the story of PHP is a pure expression of the Hacker Ethic.

NOTE: This is not a PHP hit piece. As I’ve said, I’m not a professional programmer, just an interested bystander. I have no dog in this fight. I just have an incurable compulsion to lend perspective.


First off, we need to install PHP. This is pretty easy. You can either use one of the pre-built installers or just build it from scratch.  Mac OS X comes with free programming tools as an optional install so I already have PHP on my system.

In theory you can use PHP like any other scripting language, but since it’s designed for Web development you really need to set up a Web server that understands how to run PHP code. Fortunately some very smart people set up a software stack called LAMP (Linux-Apache-MySQL-PHP) as a free, turnkey solution for Web development. LAMP started out on Linux but variants are also available for other platforms, such as MAMP for Mac OS X or XAMMP for Windows.  What they all have in common is easy installation and setup.  I’ll be coding on my MacBook so I’ll be using MAMP.

Now I just need a text editor so TextWrangler it is. I could use something fancier like Aptana, NetBeans or Coda but I don’t plan on coding up anything terribly complex.

Since I’m not looking to do anything fancy, I created a simple form. The user is asked to input a number between 1 and 10 and press Submit.

Enter a number

Pick a number…

Then the number gets passed to another page, where a simple loop prints “Hello World!” based on the number entered by the user.

Hello World five times

This fellow is very friendly!

I felt this was an appropriate spin on the standard “Hello World!” program as PHP was originally designed to manage HTML forms.

#Review – The New Hacker’s Dictionary

bogosity /boh-go’s*-tee/ n.


  1. [orig. CMU, now very common] The degree to which something is bogus. Bogosity is measured with a bogometer; in a seminar, when a speaker says something bogus, a listener might raise his hand and say “My bogometer just triggered”. More extremely, “You just pinned my bogometer” means you just said or did something so outrageously bogus that it is off the scale, pinning the bogometer needle at the highest possible reading (one might also say “You just redlined my bogometer”). The agreed-upon unit of bogosity is the microLenat. 2. The potential field generated by a bogon flux; see quantum bogodynamics. See also bogon flux, bogon filter, bogus.”


I love words. I’m always looking for new phrases and jargon, the more evocative the better. After I read Steven Levy’s Hackers, one of the things that stuck with me was how this group had developed their own language.

Every field of expertise has its own jargon. For hackers, though, English is just another programming language, just with looser rules. It’s a system. Hackers explore and manipulate systems, either to achieve a specific goal, see what happens or just to have some fun.

The New Hacker’s Dictionary originated in 1975 at Stanford as a simple file maintained by Raphael Finkel, collecting hacker jargon from various branches of the community. Like any language, ‘hacker-speak’ has dialects. The file was copied around the community, each group adding their own entries to what was becoming a shared history of the hacker culture. Eventually it was collected and published by M.I.T. Press and that’s when I got my hands on a copy.

Normally you don’t read a dictionary for fun, but this one is different. It’s a snapshot of a period of time that transformed not only my own personal and professional life but that of the world.

Consider this. The year the Jargon File was created, the very first personal computer was offered for sale.

It was the MITS Altair.

It came with 256 bytes of memory (expandable to 64K), had no keyboard or monitor and a single data bus. You had to key in your programs in low-level assembler code by flipping switches on the front panel one word at a time.

It sold as a kit for $297 (the case was extra).

Oh, yeah, I almost forgot. Microsoft got their start licensing software for the MITS Altair.

The year the Jargon File was finally published, more email was sent than postal mail in the United States and an IBM computer named Deep Blue became the first machine to beat a chess grandmaster.

The book includes a pronunciation guide, a guide to hacker writing and speaking style, a section describing hacker folklore and a guide to ‘J. Random Hacker’, which serves as a sort of spotter’s guide.

The words and phrases themselves range from layered and complex to playful and the book includes cartoons by Guy L. Steele, co-author and noted computer scientist.

Reference: Raymond, Eric S. The new hacker’s dictionary. Eric S Raymond. M.I.T. Press, 1996.