Tuesday, May 11, 2010

"Stringly Typed" Code

One of several programming slang terms posted on Global Nerdy:

A riff on strongly-typed. Used to describe an implementation that needlessly relies on strings when programmer- and refactor-friendly options are available.


I really hate stringly typed code. It's convenient for a while, but it grows all kinds of weird bugs over time. Almost every conceivable corner case in the format [sic] tends to be broken, because they have to be reimplemented in every bit of code that processes the string.

I usually call it out as Alan Perlis's "stark data structure", but "stringly typed code" has a much better ring to it.

Drawing a line in the sand

Australia continues to play with the idea of censoring the parts of the Internet its people can see:

Governments and organisations around the world are intently watching Australia as the Federal Government continues to peddle the proposed ISP-level Internet filter, former GetUp executive director and AccessNow founder, Brett Solomon, has revealed.


I don't know exactly how this will play out. It will be an ugly blow by blow as various parties wrest for influence over this new source of power.

The longer trend is clearer, however. There will be ever more ideas about what to filter, and only rarely will anything be taken off the list. Further, while it might initially take a large supermajority to get something on the list, eventually everyone will get used to the idea of a pervasive filter. At that point, more like a simple majority will suffice.

Whatever is being said now, there will be quite a lot of things people work to add to the filter list over time. Here are a few from the top of my head:


  • Distasteful content with no artistic merit.
  • Content felt to be harmful to children.
  • Activity of suspects in major crime.
  • Activity of people capable of committing a crime (i.e. everyone).
  • Motion of copyright-protected material such as Hollywood movies.
  • Activity deemed bad for society, such as gambling.
  • Below-quota viewing of material deemed good for society, such as acclaim for the wonders of one's own country.


There's an even worse problem than that the list tends to grow. As more and more people are needed to enforce these filters, the quality of the people involved will decline. When there are ten wire taps a year, and the court cases authorizing them are publicized, the public can scrutinize all the agents involved and hold them to a high standard. It's like the death penalty in U.S. states--every case is hyperanalyzed. However, once the filtering is routine and pervasive, it takes a small army of employees to implement it. It becomes more like the income tax service or the policy forces, where there are so many people involved that there are many bad apples.

This is a case where there's no good solution but to draw a line in the sand and stick to principles. Each extra step of filtering is okay and will have proponents saying it makes everyone better off. However, the end result is a relatively repressive regime, one where neighbors spy on each other and decide what is appropriate for each other to view. If you think that creativity, insight, and entrepreneurship are important for society, then this is an order where society is missing something vital.

The historical place we draw the line in the United States is that people have free speech. All citizens can say what they like, and other citizens can listen to whomever they like. It is not up to the government, much less to random neighbors, what material is fit for citizens to view. If I lived in Australia, I would fight for just that line. Speech over the Internet is still speech, and it should be sacrosanct.


HT James Robinson.

Saturday, May 8, 2010

Closed platforms are not illegal

I think open operating systems are good for the world. They unleash the creative energy of the world to create new applications that the core maintainers would never dream up. Wikis, blog software, web browsers, and TeX are just the tip of an iceberg of ground-breaking applications that wasn't developed, licensed, approved, or even known about by the maintainers of the operating systems they ran on.

However, quite a few closed operating systems have been good for the world, too. I dare say gaming consoles have made human life better. If that sounds too fun and not puritan enough, then think about GPS navigators. Heck, just think about consumer devices that have software. If you want to put software in a Ford, you can't just hand out memory sticks. You have to talk with Ford, and if they say no, that's that.

Additionally, closed systems are ordinary. Nobody has particularly up in arms about Sony disallowing arbitrary development for Playstations. Nobody has said that Ford is being anti-competitive to control the software on its system. So why Apple?

I can speculate about why people are upset about Apple, but there is a more important point to establish: it's their right to close their system if they want. It's difficult to predict whether the net result will be a better or worse system, but at any rate it's their system. If you think they should do something different, then try to persuade them. Let's stop shy of force, however. We shouldn't allow major government figures to just step in and rough up any company they please so long as they have a mob of people cheering them on.

This is not to say that I see no role for law in the software world. There are plenty of basic business principles that it is tremendously helpful for the government to enforce. Contract, ownership, non-disclosure agreements, copyright -- these are all useful institutions to build and enforce. Another are that is ripe for action is open document initiatives: insist that government agencies release documentation only in open formats that are easily reimplemented and widely available.

When it comes to application platforms, however, it's premature. The area is just too dynamic. Expect a decade at the minimum for a major government to work out a reasonable system of law and enforcement for something new. Minimum. I would expect more like 20-30, and ideally there would be several approaches tried in different parts of the world before a final choice is made about how the thing should be done. For now, leave application platforms alone. If the government wants to do anything, hold up platform owner's rights to be gatekeepers for the content on them. Platform owners can opt to do otherwise, but if they don't, everything will still be fine. Once in a while, we'll even see a platform like the Wii: thoroughly closed, yet very much good for the world.

Let the flowers bloom. The iPhone is still budding, and we don't even know yet how it's going to fare once the initial fad runs out.

Saturday, April 24, 2010

SEC interested in smart contracts?

According to Jayanth Varma, the SEC is considering specifying parts of contracts using programs:

We are proposing to require that most ABS issuers file a computer program that gives effect to the flow of funds, or “waterfall,” provisions of the transaction. We are proposing that the computer program be filed on EDGAR in the form of downloadable source code in Python....


It's vindication for agoric computing!

I share the same question as Prof. Varma, however. Isn't it problematic that Python is ill-specified? It is surely convenient to write and read, but a contract needs to be especially rigorously defined. Using a program to describe a contract has the potential to be very reliable, but only if the programming language is particularly well defined.

There are much better specified alternatives. Some have suggested Java as well-specified, and I'd agree, so long as the precise libraries used are also delineated. A more tempting candidate for me would be Scheme or SML. In addition to being well-defined, functional languages lack overriding and thus yield programs that are easier to analyze. Object-oriented languages, by allowing every method to be overridden, yield tremendous power and convenience but make it harder to prove definitive statements about a program. Just imagine trying to say something about E=mc^2 when all of E, m, c, squaring, multiplication, and equality can be overridden.

Some commenters in the above blog article suggest spreadsheets as being a closer match to how financial analysts would like to work. Spreadsheets, it is claimed, would allow the analysts to examine intermediate results. That's very interesting, but are there any spreadsheet-friendly languages that are particularly well specified? All the ones I've encountered are defined by their implementation.

Thursday, April 22, 2010

ACTA released

Americans tend viciously debate every little detail of our own national policy. Yet, I've encountered very little interest in ACTA, an international trade negotiation that is just as potent as the much-maligned DMCA.

For any interested, there's a draft of ACTA now available to the public. Techdirt is underwhelmed:

Most of the language that critics have grown familiar with (making the bypassing of copy protection illegal even in cases of fair use, making copies of a large quality of content illegal even if no money is exchanged, mandating that ISPs become copyright nannies) remain at the heart of the ACTA. The agreement's central thrust continues to be to foist clearly dysfunctional, unreliable, and draconian U.S. DMCA-style copyright enforcement policies upon other countries.


I have admit, I'd rather see something with some more principles to it, rather than simply all the major content holders pulling up a chair to the table and divvying up the world. A good one to start with is that if a citizen buys and owns a copy of something, they can make further copies for personal use. I don't see how that kind of right could ever even be proposed at a gathering like ACTA.

Monday, April 12, 2010

Meta-platforms make bad apps?

John Gruber has a claim that Steve Jobs appears to endorse.

I can see two arguments here. On the one side, this rule should be good for quality. Cross-platform software toolkits have never — ever — produced top-notch native apps for Apple platforms. Not for the classic Mac OS, not for Mac OS X, and not for iPhone OS. Such apps generally have been downright crummy. On the other hand, perhaps iPhone users will be missing out on good apps that would have been released if not for this rule, but won’t now. I don’t think iPhone OS users are going to miss the sort of apps these cross-platform toolkits produce, though.


I used to believe this. I thought about Tcl/Tk apps, which are always fumbly and unpolished, versus native Apple and Windows apps, which at least sometimes have slick UIs. Thereofore, cross-platform toolkits are bad. It was a hasty generalization, however. Applications based on web frameworks, Java, or .Net are much better than those based on Tcl/Tk. They look just as good as native apps, and they fit the native look and feel just fine. Thus it comes down to an issue of functionality, and on functionality the native apps don't compete very well.

I spent a couple of years recently trying to use a Mac laptop and live the Apple dream of everything being compatible with everything. One by one, I grudgingly stopped using almost all of the native Apple software in favor of cross-platform software. Specifically:

  • Mail, contacts, and calendar form a trio that take good advantage of interop. However, the mail program can't thread, which I ultimately admitted is a show stopper for anyone participating on mailing lists. The calender program is okay, but I can't share events on it with other people, which again is a really important bit of functionality. I switched to web-based versions of both of these, after which the built-in contacts program had nothing to interoperate with. Thus I switched to a web-based contacts solution as well.
  • For editing documents, I tried to love the built-in NeoOffice. It's not really any better than stock builds of OpenOffice, though. Ultimately I stopped using OpenOffice, because there's no good problem for it to solve. For simple documents I used web-based tools, with their improved sharing and publishing affordances. For documents where I work harder, I use Latex.
  • For software development in Java, Intellij, Netbeans, and Eclipse are the heavy hitters. There wasn't even a native app for me to try. Apple supplies XCode, but I never really tried it. I'm not sure it even supports Java at all.
  • For all other software development, Emacs is so good I never even considered an alternative.
  • For web browsing, I initially tried to like Safari, and it's pretty good. However, I ended up wanting to use Firefox for a lot of things, for reasons I can't remember now. Ultimately, I ended up using Chrome.
  • For command-line access, I initially used the built-in Apple terminal program. I later switched to a different Apple-specific program called iTerm.


As can be seen, in almost every case, the best of breed software for Mac Laptop is built on a meta-platform--exactly the kind of meta-platform Jobs is banning from iPhones. Good thing he hasn't done so for Apple laptops, or they'd instantly become third-rate for working professionals! The native apps are okay for very basic usage, and they are sometimes prettier, but they're woefully underpowered once you try to do anything with them.

This emperor has no clothes. Anyone who currently believes that native Apple-specific software is better, ask yourself: what software do you use day to day? Is Apple-specific software really any better, or is it just cutesy demoware that is good enough if the main thing you do with a computer is show it to people?

I'm checking out of that game. If you use your computer to get work done, then you need good application software, not just a good OS. For that, you want a large pool of candidate software to draw from.

Apple trying to block choice of source language?

Much is being said about Apple's newly launched attempt to stop programmers from writing in a language they don't approve. Lambda the Ultimate is a good place to find lots of links.

This is a large grab. Apply is trying to control not only the technology used in the distributed software for an application, but also the methods used to make it. The requirements on those methods are not even that they be good methods; restricting the programming language does little to enforce good programming by itself. And the languages allowed aren't especially great for good programming.

Jobs claims--in the few terse comments Apple has made about this move--that he wants to prevent the iPhone from being commodotized. This is a standard lock-in kind of approach to doing well in business, but it's slightly odd given Apple's reputation for distributing quality software. One thing we can be sure of: if programmers aren't allowed to use good tools, they aren't going to make good software.

It's unclear whether this will be enforceable. Among other reasons, practically all software makes some use of its non-primary language, but presumably Apple doesn't want to ban all software from their market. Any configuration language is a programming language. The expression language of a spreadsheet is a programming language. If you do a web search for "cell phones -iphone", you're writing the query in a programming language. Heck, if the developers use use ant or make or Maven to build the program, they're writing their build rules in a programming language.

Little languages are just part of how software is written.