April 30, 2009

The Andrew Peace Scavenger Hunt

Recently a friend [1] remarked that I can be really hard to get a hold of. I spend a lot of time working and taking walks, I rarely answer my phone, and my text message replies are often cryptic or unrelated to what was asked. If you need to find me for some reason, just follow these steps:

1. Check my Facebook status. You can often determine my location just by interpreting my most recent status. If it says something about death, guns, or sex, it's probably a Marilyn Manson lyric. That means I'm on a walk. If it rhymes or contains funny names ("Attend the tail of Sweeny Todd, his skin was pale and his eye was odd") it's a show tune. This also means walking. In general, if it makes no sense it's probably some sort of song and that means walking. If it contains funny characters or academic-sounding words, that means I've been programming but became frustrated and decided to go on Facebook for a minute and then take a walk to clear my mind.

2. I hope you're the kind of person that reads ahead, because I actually deleted my Facebook a couple days ago. I realized that the only time I use Facebook is when I want to check out the inappropriate photos that hot Northeastern girls post when they're hung over, and it kind of creeps me out. Nobody that I'm really friends with uses Facebook anymore[2].

3. Check the futon in Wabisabi (that's what I call my apartment). That's where I like to do programming. Don't give up if I'm not on the futon, just check around. It's a pretty small place but there are lots of nooks and crannies. My roommate found me sleeping in the bathtub once, and that's not a joke. You may want to try and locate my black beanie with a Google logo on the side. If it's not there, it's probably cold enough that I need to wear it while I'm walking.

4. Check the time. If it is a weekday between 7AM - 7PM I am working or riding to/from work. After 7PM is when I usually take a walk. For weekends, it is a bit different. I should be sleeping until about noon, so you're out of luck until after then. Past noon, you can start by checking Park Drive or the Fenway area in general. That's near where I live, I walk there a lot.

5. Check my Twitter. No reason, really. Just thought it would be fun.

6. Go to the Subway on Boylston and ask them if they've seen a funny-looking character who ordered a Spicy Italian with lettuce, cucumber, and spinach. If they remember me, you're on the right track. Search for a trail of cookie crumbs near the door. If you find a trail but end up loosing it, don't worry. That probably just means I've gone on an after-dinner walk.

7. If you found the Google beanie in step 3, take a picture on your cell phone and send it to me. I may interpret this as a ransom demand and set up a secret meeting time and location. The only thing is that sometimes if I'm walking I don't feel my phone vibrate, so it's 50/50.

If you've followed those steps and have come to the conclusion that I am working or on a walk, you're screwed and I probably won't be getting back to you.

Notes:

  1. Actually, a mop
  2. Don't be confused: if you are a hot Northeastern girl, you are my friend automatically

April 25, 2009

Teaching Programming

I think there is a lot of debate about how programming should be taught, and I think the debate basically centers on how to teach it to freshmen in college. I say "I think" because I don't really know anything about this. But, it's been my MO lately to talk about things I know nothing about, so eff it.

The complicated thing about this (as I perceive it) is that there don't appear to be only two sides, because there isn't only one issue. There's the issue of functional versus imperative programming style. Then there's a several-way split about historical versus newer versus popular programming languages. It seems there's even a debate about what kinds of programs to begin teaching with.

Well, here are my thoughts. Someday when I have influence we can look back on this and decide it's smart. And by then I will have changed my mind.

Some principals

Agreed: choosing a language based on its historical significance (C++) or its usage in "the field" (Java) is BS. If teaching were about practicing for the real world, high school teachers wouldn't make you read Jane Eyre and write analytical essays on it. Very few people end up actually writing analytical essays about literature for a living.

Granted, it's different in programming. Java is very widely used and lots of languages are similar to C/C++. But I think it's assumed that, if we can figure out how to teach programming well, we can either teach how to write Java/C later or we can depend on the student to pick it up when they need to.

Wait, how is that different? Anyways...

Starting out writing GUIs is ridiculous. That means no making desktop calculators until semester two. It is a waste of time to start out writing GUIs just so students can feel like they are actually doing something cool. You won't be successful in programming unless you think that figuring out how to write a tough function is cool, sorry. And anyways, the time spent writing that calculator is mostly spent learning how to use the particular GUI library you have chosen, which seems like a big waste.

Functional versus imperitive? One, then the other. And it doesn't matter the order, in my opinion. Having a good understanding of loops and having a good understanding of recursion are both really important. I think a really effective programming program (sorry, trying to refrain from saying "computer science program") stresses that recursion and iteration are both commonly-used tools, both simple once you get to know them, and both dangerous in different situations. Of course, it seems the most reasonable way to teach both is to chose one, teach it, and then teach the other with the first in mind.

On object-oriented programming: definitely leave that junk for later. Understanding object-oriented paradigms is obviously important, but for people who are trying to understand for the first time how to make computers do stuff, it's a mind fuck.

Tests on paper. I actually don't think this is debated too heavily, but it's worth saying. At Northeastern, I've realized that writing a program on paper during an exam can only be done if you have learned how to program. More on this later.

My perspective

I have a fairly unique perspective on this issue given my age and lack of time spent in the real (or academic) world. I've had the opportunity to semi-teach some material from Northeastern's CS program, which uses SCHEME and focuses on functional programming to begin with. The first time, I was teaching it to seventh graders after school. Don't ask. The second time, I was tutoring freshmen CS students at Northeastern, grading their homework, and proctoring their lab exercises.

I like Northeastern's program a lot, and it's at least tripled my skill at programming in my first two years. But I had been programming for years before going to college, so learning in SCHEME was both easy for me and really different and interesting. So, I don't know how it felt for newbies (or, how it felt for the newbies after they learned SCHEME and went to try something else).

One thing I learned from watching freshman (a full year younger than me!) and seventh graders writing SCHEME is that new programmers are good at remembering keywords. I don't know how many times I went over to help a student who had written simply (define or in the body of their function (cond (uhm, I'm sure somebody will yell at me for calling those keywords, but you know what I mean). I'm not exactly sure what this keyword-recognition ability means to a programming program, but it exists.

The other thing I learned, as I mentioned before, is that on-paper quizzes and tests are great for teaching programming. Programming homework assignments and projects is supposedly good practice, so fine. But college students cheat. You simply can't write a program down if you don't know how to program. On another level, even for students who don't cheat on homework, getting a program on paper is a different experience than coding it on your computer where you can get in the habit of testing it every fifteen seconds. Paper doesn't compile code (yet).

The Language

I think it's Python.

I swear it's not because it's trendy! It's just the language that best fits how I think programming should be taught.

For one, you can easily teach iteration and recursion in it. Both the functional and imperative programming style come very easily in Python. In fact, I would have chosen Perl were it not for the fact that in Perl you can't pass functions by their exact name. There's no funky syntax involved in Python.

Again, I loved learning SCHEME at Northeastern. But aside from the iteration thing, here's my main beef.

I think that students can pick up programming faster if the syntax they are using is just right. There are too many parenthesis in SCHEME. Sure, it's beautiful to me. But to a first-time programmer, I think it helps to see some colons, some equals signs, and some keywords. Like return, for example.

Python programs can really look any way you want. If you want to start by teaching functional style, do it. If you want to start by teaching iteration, start writing loops. The only thing that Python forces on you is good indentation practices, and I don't think anyone's complaining about that. What better way is there for freshman to learn good style than to program in the most inheritly stylish language out there?

I feel like if my Northeastern professors read this they would probably beat me with a keyboard for not sharing their obsession with SCHEME, and that's fine. They have a great program and I think it's okay for them to defend it (as I've seen several do in heated conversations). All I'm saying is that I think some of my classmates and I could be even better programmers right now if we had begun learning in Python and had learned iteration early on.

Then again, I know nothing about this.

April 24, 2009

The problem with Linux

A few months ago I mentioned to my non-techy roommate that I was downloading Windows 7 Beta for a friend. His response was: "Sweet! Illegally?" Of course, he didn't know that Windows 7 Beta was a limited-time free (uh, beta) release.

Then last night I mentioned to my roommate that I was downloading Ubuntu 9.0 (or, as I referred to it for his sake, "a new Linux"). His response again: "Sweet! Illegally?"

Normal people do not realize that Linux is free. Because I was so miffed I didn't go into a discussion with him, but I bet my roomate did not realize that, in fact, everything I use on my computer I use without paying for. Of course he is aware of Firefox and programs like Pidgin, but has he been thinking all this time that I edit Office documents on a paid-for Linux office suite? Does he think I bought multimedia tools and quality disc-burning software? When he sees me working, does he think that Gedit and Eclipse are Microsoft products? What must he think when he sees me creating graphics in GIMP??

I am aghast because I am like every other geek. I didn't understand that normal people don't understand. No wonder people get pissed when I can't help them un-crash their Vista machines! They don't get that this is different.

Why Linux is only for geeks

Windows and Mac users will never know that Linux is bomb because they will never use it. They will never use it because the idea of installing a second OS does not fit into their minds. I don't mean to say they're stupid. What I mean is that, to most people who use computers, new things run as programs. Linux is a new thing to most people, so in their minds it must be a program that they can uninstall from Control Panel if they want. That's how normal people think, and that's fine. We just need to realize it.

We need to get normal people using Linux somehow. They will be generally unimpressed by the operating system itself. After all, normal people don't care about being able to write shell scripts or easily set up web servers. They will, however, be into all the free stuff. My guess is that they would also be impressed by the package managers included with most Linux distributions, with a little work. More on that later.

The problem is that Linux is an operating system, not a program, so they will never be able to see this neat stuff. At this point, the real geeks out there are screaming at me that Wubi is the solution. For those who don't know, Wubi allows you to install Ubuntu on Windows, as a program. If this is your solution, you are missing the point.

The issue is not that Linux cannot be a program, but that it is not really a program and is an operating system. There is a barrier. People won't start using an operating system within an operating system that already satisfies them.

Fixing it

Faster, sleeker, slimmer. This is why Firefox is slowly gaining market share with normal people. When I say to normal people, "Ah, I see you're using Firefox" the number one response is "Yeah, it's a lot faster". What they mean is, "Yeah, it's a lot faster than Internet Explorer" or more importantly, "Yeah, it's a lot faster than the built-in way to do the same thing with Windows".

One thing normal people certainly do understand is doing something different if it is faster, sleeker, and slimmer. This has been proven by Firefox (beats IE), Facebook (beat MySpace), Gmail (beat HotMail), and a myriad of others. I think Linux already has a pretty good leg up on this one. I could trick anyone into thinking that my junky laptop has 4GB of RAM because of the performance I get from Ubuntu. When I'm on my XP partition, it's as if there is no RAM at all. (I have 2GB, I believe).

The Linux community is smart, and geeks can push it to the limit. If we want Linux to be noticed for its speed, it's got to have some sort of speed. I say, keep it up.

Programs! Find, install, uninstall! Of course, Linux already does this very well. However, programs like Synaptic package manager need some changes to appeal to the normies.

First of all, there needs to be a version that gives less information. Normies don't want to know which dependencies have just been resolved. Ubuntu (and maybe other distros, I don't know) has been doing this for a while with the Add/Remove application off the Applications menu. It's Synaptic manager except more easily browsable, and it's an incredible start.

But it needs to be more. I'm thinking something along the lines of the Android apps market, which is extremely addicting. It's very graphical and there are thousands of options. Like iTunes for programs. We need to go there.

Free is cheaper than whatever the price of Windows is. Why is there not a popular company that is willing to market low-end laptops that come with Linux? And by market I don't mean Dell selling machines on linux.dell.com. I mean commercials on TV where they say, "Hey, this laptop is only $600 and it does all the cool stuff you want, and it's fine even though it's not Windows. See?"

I suppose this is not exactly a problem with the Linux community, but more a problem of markets. But still, it's not like we have no resources. People can get their startup Web 2.0 sites funded, so why can't someone start selling Linux machines? Like speed, price is a game-changer for normal people. Obviously, Linux has the price issue down pat. The only reason that's not recognized is that companies don't sell hardware with Linux on it.

Additional thought: there is enterprise-level software that runs on Linux. Enterprises use that stuff. They also like cutting costs. Where are the people going, "Hey, enterprises/businesses, buy hundreds of really cheap computers that easily integrate with all your other stuff and perform all your business functions!"

A start

I think a good start to all of this is as simple as me clicking "Publish Post" and starting that conversation with my roommate. I'm a geek, but all geeks are semi-normal on some level, and we retain the power to connect with other humans (most of us do). Until some things start to come together for Linux, the best thing to do as I see it is to keep the conversation up.

Normies?

I just realized that at some point in this post I started using the phrase "normies" to describe normal people. Normies?

Actually, I like it.

Shwoops

In regards to my last post, I just realized Paul Graham has said the same thing, but much more eloquently...and in 2001.

Java's Cover by Paul Graham.

A lot of the people I know using Java are using it because they feel they have to. Either it's something they felt they had to do to get funded, or something they thought customers would want, or something they were told to do by management. These are smart people; if the technology was good, they'd have used it voluntarily.

So, I'm outdated. But not crazy!

April 22, 2009

Pseudocode

This is probably old news, but I've decided that Java MVC architectures are really over valued. Lots of classes and generic interfaces and abstractions make the business people feel like they are professional and scalable, and that is why Java is used in business.

I think one of the motivating factors is that somewhere in the back of the mind of the CEO running the Java-based company is the thought that the code written there will someday have to be presented to other business types as part of a buyout or investment process, and that these investors will really be looking closely to see if everything is as abstract as is humanly possible. That's fine, but I'd rather spend five minutes writing concise code in a flexible language than spend fifteen writing rigid Java code.

As an experiment, I wrote a partially-complete program for a killing robot in Python (my recent favorite, after JavaScript) and in Java. Which code would you rather have your dev team/minions writing? (The actual slaying/maiming functionality has been left out)[1]

Python. killingRobot.py:

#! /usr/bin/env python3

import sys

def slay(victim):
    """Slays the given victim"""
    print('Slaying '+victim)
    # system calls
    
def maim(victim):
    """Maims the given victim"""
    print('Maiming '+victim)
    #system calls

def slayAll(filename, action=slay):
    """Applies the given action to all victims in the given file"""
    try:
        f = open(filename, 'r')
        for victim in f:
            action(victim.rstrip())
        f.close()
    except:
        print('Unable to open file')

# slay or maim all victims based on user input
if __name__ == '__main__':
    if len(sys.argv) > 2:
        action = sys.argv[1];
        filename = sys.argv[2];
        if action.lower() == 'slay':
            slayAll(filename, slay)
        elif action.lower() == 'maim':
            slayAll(filename, maim)
        else:
            print('Invalid action: use slay or maim')
    else:
        print('Give an action and a file name')

Now Java. We'll begin with the interface and implementing classes. personAction.java:

public interface personAction
{
    //applies some kind of action to some given victim
    public void doAction(String victim);
}

slayAction.java:

public class slayAction implements personAction
{
    //slays the given victim
    public void doAction(String victim)
    {
        System.out.println("Slaying "+victim);
    }
}

maimAction.java:

public class maimAction implements personAction
{
    //maims the given victim
    public void doAction(String victim)
    {
        System.out.println("Maiming "+victim);
    }
}

Finally, the program. killingRobot.java:

import java.io.*;

public class killingRobot
{
    //slay or maim all victims based on user input
    public static void main(String[] args)
    {
        if(args.length > 1)
        {
            String action = args[0];
            String filename = args[1];
            personAction pAction;
            
            if(action.equals("slay"))
                pAction = new slayAction();
            else if(action.equals("maim"))
                pAction = new maimAction();
            else
            {
                System.out.println("Invalid action: use slay or maim");
                return;
            }
            
            slayAll(filename, pAction);
        }
        else
            System.out.println("Give an action and a file name");
    }
    
    //applies the given action to all victims in the given file
    public static void slayAll(String filename, personAction action)
    {
        try
        {
            FileInputStream f = new FileInputStream(filename);
            DataInputStream d = new DataInputStream(f);
            InputStreamReader i = new InputStreamReader(d);
            BufferedReader b = new BufferedReader(i);
            String victim;
            
            while((victim = b.readLine()) != null)
            {
                action.doAction(victim);
            }
            
            i.close();
        }
        catch(Exception e)
        {
            System.out.println("Unable to open file");
        }
    }
}

I won't bother comparing line counts since both of these programs could probably be shortened by better coders. The point is that Java annoys me. And what super-annoys me are these crazy attempts to make everything generic so it can supposedly work better and be scaled more easily. It's not easier or better, it's Java-er. Blech.[2].

Notes:

  1. System calls for slaying and maiming only available in Windows ME and 7 Beta
  2. Announcing the first ever Killing Robot Programming Contest. Write the most concise (fully-functional) killing robot program. Losing entries will be slain by the winning entry's killing robot program. Go ahead. Do it in Java. I dare you.

April 19, 2009

Twittiquette

The following rules of Twitter etiquette need to be made law:

  1. Tweets must be somewhat novel and interesting[1]
  2. Follow people that you think have interesting tweets, not everyone who follows you.[2]
  3. English grammar applies to tweets. Fragment sentences are okay, obviously
  4. One URL per tweet, and it should be after the rest of the text
  5. Drunk tweeting is not cool like drunk Facebook wall-posting is[3]
  6. @ reply only once per topic. Direct messages are for conversations
  7. Creating/following fake accounts for cartoon characters is officially okay, because that's fun. But it's not okay to do that for other non-human entities or famous people that don't actually use Twitter[4]
  8. Sad/depressed/angry/satanic Tweets should be used sparingly
  9. No complaining about people who Tweet too much. That's the point. It's fun

That's my take on things. Will somebody with influence keep an eye on Oprah and Ashton Kutcher?

Notes:

  1. That means don't tweet every time you walk into a shop, eat something, or talk to your boss
  2. Ahem, Mr. President
  3. And that's only cool if you're in college and don't do it that often
  4. Doug Funnie, cool. George Bush, lame

I think I'm special

Lately, I have been obsessed with AI. For some reason, the Loebner Prize came into [1] my brain and I decided to check out the most recent contest results. This is a transcript from the best chat bot last year, Elbot:

Human: o ha you
Elbot: How about talking about yourself a bit. That's what human beings like best.
Human: do you know where are you ?
Elbot: Please tell me your inclination to talking robots first.
Human: Do you know where are you now ?
Elbot: I see your point. My own thoughts on this have lead to the conclusion that talking robots could set a good example for other robots.
Human: Do you know where are you now ?
Elbot: Didn't I just answer that question?

Are these people serious? Elbot was determined to be the most human-like chat bot at that year's competition.

I have an idea for a different kind of AI system, not based on a logic engine. It's actually more of a natural speech processor, but also kind of not. I think I will keep the lid on that one for a while, though, until I can determine if it will work. Watch your back, Elbot.

That said, I will probably never finish programming it. I started something in Python a week ago, but I recently decided to wipe it and restart. I suck. Is Python still cool, by the way? I don't care, I like it.

I tend to become obsessed with things for about three months and then forget about it. Over the past year, I have done serious programming work in the following areas:

  • Academic plagiarism detection
  • Detecting sexual predators in online chat rooms
  • Tracking UFO sightings
  • Host-to-host database synchronisation and merging
  • A CMS system for AndrewPeace.com
  • Community-run online newspapers
  • Valentine's day (don't ask)

All unfinished. Maybe I will get around to them someday. For now, it's AI.

I think I'm special.

Notes:

  1. Have you ever looked up the definition of "into" on Google? It's interesting. I always wonder if I should say "into" or "in to". Hm.