Programming for Everyone

Two nurses working at a computer in a nursing station in 1987.

So I read a post over at Jason J. Gullickson’s blog about how FOSS Isn’t Capitalism. It’s an interesting quick history of how computers have becoming far less empowering to end users and how the Free and Open Source Software movement is repeating (intentionally or not) some of the same behaviors that commercial ventures engaged in to make computers (and the web) that way.

One thing the article calls for is putting some engineering time into making programming more accessible again, so that people can make their own solutions to their computing needs rather than relying on commercial software that they might not even have access to. It mentions BASIC as a form of this, but says there’s no modern programming language that does the same thing, a statement I agree with.

Our current programming tools aren’t accessible to anyone who isn’t already very comfortable with computers, and who are able to deal with learning complex, unnatural syntax. On top of that, because operating systems don’t ship with programming tools anymore (or they’re very buried, if they are there), you also have to deal with setting up a development environment, a whole extra hurdle that I imagine turns some people off, and definitely discourages casual exploration.

With all that in mind, I started tooling around in my mind with how I would go about designing such a programming language. Two things to keep in mind: I am in no way an expert on this branch of computing, and I’m writing this off-the-cuff. It’s hardly going to a complete specification, just some noodling that might hopefully be useful to someone (maybe even myself) in the future.

Natural Language

I’d like to go with semi-natural language for this programming language. It’s not as efficient, typing-time-wise, but I think it solves several issues. It makes the syntax more-or-less human-readable, with minimal training. This reduces the barrier to entry for a first-timer, and makes it more likely they’ll be able to parse their own mistakes. It also makes programming look less like a nightmarish math problem. I think this would help to decouple math and programming as related skills. They have some overlap, but most programming uses simple arithmetic most of the time, and you just don’t need to be skilled at math to be a good programmer, and vice versa. Hell, I barely clawed my way through my required college math courses and my programming’s turned out fine.

Not to say the use of natural-sounding language is perfect. It’s fraught because it means we’re language-reliant. Assume we build the first version of this code in English, because that’s the language I’m most familiar with and (along with French), one of what I understand to be one of the current lingua francas, at least in the Western world. Our English syntax is going to make a lot of assumptions about the order of things. These assumptions might not hold true if we do a literal translation into another language. Japanese grammar is very different from English grammar, as is French grammar. Even Spanish, which has a lot of grammatical similarities to English, will have significant enough changes that porting it will require notable effort. It could also lead to grammatically-strange sentences that are hard to read, but I’d argue for a complete novice that it’s probably not any harder to read than than a variable assignment (Integer x = new Integer(4);, anyone?).

My inspirations for this approach are COBOL, Basic (If/Then!), and the Inform programming language for interactive fiction.

Sample Lines

So we’re using natural language. How would this look? I’m going to compare it to Java, because that’s what I know best right now.

Assigning Variables

I think that we should used inferred types here, again for ease-of-use on the part of the end user. Can it lead to weird errors? Absolutely. But it’s easier to learn off-the-bat than the difference between an integer, a float, and a double.

Java:

int x = 3;
x = 4;

Hypothetical Easy Coding/Computing Language Environment (HECCLE):

x is 3.
x is 4.

If/Then Blocks

More inference here. Because, I mean, who’s actually assigned variable values during an if statement?

Java:

if(x == 3){
     System.out.println("You did it!");
}

HECCLE:

If x is 3, then print "You did it!".

Note: I’m ending each line with a period now, which already gets us into “potential nightmare” territory when it comes to Proper English Grammar, but I think is fairly intuitive? The alternative I can think of is requiring a newline between each command, which would also work.

If-Then-Else

And I guess we’re using commas for “sub-statements” now. There’s no way this could go wrong in the future!

Java:

if(x == 3){
    System.out.println("You did it!");
}
else{
    System.out.println("Oh no!);    
}

HECCLE:

If x is 3, then print "You did it!", otherwise print "Oh no!".

Accepting User Input

Java:

import java.util.Scanner;

Scanner x = new Scanner(System.in);
String input;

//I realize this doesn't quite work, 
//but bear with me for example's sake.
while(x.next() != null){ 
    input += x.next();
}

System.out.println("You input: " + x);

HECCLE:

Prompt user for input.
A is input.
Print A.

Object Definition

Time to make this thing feel modern. Before, we were pretty much just doing stuff BASIC could do. I think with object-oriented programming included as a possibility, the potential uses of this expand even further. Not that such an approach should be required for a first-timer programmer who just wants to make, like, a basic calculator.

Java:

//Class definition itself with constructor
public class TerrestrialObject{

int x;
int y;

public TerrestrialObject(int a, int b){
    x = a;
    y = b;
    }
}

//Declaring a new instance of the class
TerrestrialObject mulder = new TerrestrialObject(1,2);

HECCLE:

//Definition, doesn't require an explicit constructor
TerrestrialObject is a widget.
TerrestrialObject has x and y.

//Construction of a new instance
Barry is a TerrestrialObject where x is 1 and y is 2.

Conclusion

Obviously, this is just a few sketched-out examples and isn’t complete, and hardly perfect. I hope it gets across the general direction I’d want to go in, though. Natural language, defining many things implicitly for ease-of use, and including most functionality in the core version of the language, rather than importing libraries. I think something like this would let people who don’t necessarily consider themselves “computer people” program with minimal friction. Combined with a good compiler that gave readable error information, it would (ideally) be possible for even a casual user to experiment on their own, and hopefully start feeling comfortable with the idea that they have control over how they use their machine, rather than the other way around.

This entry was posted in Technology and tagged , , , . Bookmark the permalink.

3 Responses to Programming for Everyone

Comments are closed.