Sunday, August 31, 2014

iOS 6 CSS Turns Futura Into Futura Condensed Extra Bold

If you're seeing this happen, no, you're not going crazy; I've seen it too, on both Chrome and Safari. (I haven't tested if it happens with other operating systems or browsers, although I may later.)

The threshold for this effect is font-weight: 500. At that weight, font-family: "Futura" will indeed produce Futura; at font-weight: 501 and above, font-family: "Futura" will actually produce Futura Condensed Extra Bold.

By the way, at any weight, font-family: "Futura Condensed Extra Bold" will produce Times New Roman. I'm not sure why; the charitable explanation is ignorance.

Tuesday, August 26, 2014

My Name Is Giles, And I Am A Panda

Reg Braithwaite occasionally chastises himself for writing about writing code, instead of just writing code. This makes an easy opportunity for those of us (like me) who enjoy trolling him.


Let's call Mr. Braithwaite's bluff. I don't think this tweet is true, but it could be. You can do this in bash:

Not the most elegant code, of course. And I only tested this with vi /etc/hosts vs. MacBook THELONIUS Air vi /etc/hosts, so it may fail on other commands. I'd expect it to have issues with output redirection, so this might actually be a superior implementation:

But this approach will give you false positives with no middle name supplied, and costs you the vital sassback feature.

If you want to become a better programmer, you could do worse than to just pick somebody like @raganwald, follow them on Twitter, and then, any time they complain about not having a particular tool or product, implement that tool or product. Of course, some complaints would be harder to resolve than others.

Despite the golden opportunity a tweet like this presents — i.e., I could look like a genius if I went off and implemented HTML5 with type-checking — I wanted to reply to it by telling Reg to go and implement this himself. Less effort, better trolling, so: pure win.

However, I decided not to troll Reg about this, since I kind of troll him too often (for instance, consider this blog post). Instead, I phrased it as general advice and got a bunch of retweets out of it.

The remark about "pop culture" is a reference to an Alan Kay interview that both Reg and I frequently reference:

...computing spread out much, much faster than educating unsophisticated people can happen...

the lack of a real computer science today, and the lack of real software engineering today, is partly due to this pop culture...

If you look at software today, through the lens of the history of engineering, it’s certainly engineering of a sort—but it’s the kind of engineering that people without the concept of the arch did...

A commercial hit record for teenagers doesn’t have to have any particular musical merits. I think a lot of the success of various programming languages is expeditious gap-filling. Perl is another example of filling a tiny, short-term need, and then being a real problem in the longer term. Basically, a lot of the problems that computing has had in the last 25 years comes from systems where the designers were trying to fix some short-term thing and didn’t think about whether the idea would scale if it were adopted. There should be a half-life on software so old software just melts away over 10 or 15 years.

(Just as an aside, the absence of this half-life is one major difference between programming languages and spoken languages. Where human languages naturally morph over time, computer languages can only morph through their formal definitions, making them weirdly immortal.)

It was a different culture in the ’60s and ’70s; the ARPA (Advanced Research Projects Agency) and PARC culture was basically a mathematical/scientific kind of culture and was interested in scaling, and of course, the Internet was an exercise in scaling. There are just two different worlds, and I don’t think it’s even that helpful for people from one world to complain about the other world—like people from a literary culture complaining about the majority of the world that doesn’t read for ideas. It’s futile.

I don’t spend time complaining about this stuff, because what happened in the last 20 years is quite normal, even though it was unfortunate. Once you have something that grows faster than education grows, you’re always going to get a pop culture.

To recap, I was saying that all you need to do is dig through the great old ideas of the earlier, more rigorous culture and you'll find pure gold. Of course, @raganwald had already got there:

This is especially relevant in any discussion of Alan Kay, because one very interesting thing about Alan Kay is that he and Steve Jobs frequently predicted that the same technologies (and the same uses of those technologies) would take over the world. But Alan Kay never seemed hugely interested in when those technologies would take over the world, while Steve Jobs was obsessed with questions like that, and that, in a nutshell, is why Alan Kay is a name known only to serious programmers, while Steve Jobs is a name known to everyone.

When the Mac first came out, Newsweek asked me what I [thought] of it. I said: Well, it’s the first personal computer worth criticizing. So at the end of the presentation, Steve came up to me and said: Is the iPhone worth criticizing? And I said: Make the screen five inches by eight inches, and you’ll rule the world. — Alan Kay

And this is as good a time as any to demystify another of my tweets:

I'm wearing a panda costume because I've joined a company called Panda Strike.

I've known the CEO, Dan Yoder, for years through the Ruby community in Los Angeles. In fact, I met him through the ruby-lang mailing list back in 2007, when I was trying to put together a Ruby users' group. And in 2008, LA Ruby got off the ground, with help from Dan's company and mine, but let's get back to the main theme here. Dan got to a particular future a little early.

Around the time Sinatra emerged, Dan had just written a web framework called Waves, which had a terse API sort of similar to Sinatra's, but was built on the foundation of a deeper understanding of the web and HTTP. (Panda Strike co-founder Matthew King also worked on Waves.) Here's a very superficial comparison of Sinatra and Waves. Both the Sinatra and Waves code examples are setting up a handler for hitting the /show URL with a GET request.

You'll notice in this example that while the on :get, :show syntax works in terms of an HTTP method and a path, which is pretty similar to Sinatra's get "/show", the object model starts with a resource, which is a thing which handles URLs. Waves had a models directory, like Rails, but it had a resources directory too, and that directory played a more central role. Waves was a resource-first framework, whereas you could think of Rails as a model-first framework, and consider Sinatra a URL-first microframework.

Waves and Sinatra both had these routing methods where you would define a URL handler by specifying first an HTTP method and next a path. Both frameworks disregarded MVC in favor of a URL-matching approach. That almost qualifies as an example of multiple discovery, the phenomenon where multiple people make the same scientific discoveries and/or inventions at roughly the same time.

Even though these APIs are only a little different, the Sinatra approach had a serious advantage in its aggressive simplicity. But it kind of skipped the whole issue of resources, and that core idea at the root of Waves, that a framework should put resources first, was ahead of its time. In recent years, it's kind of become a thing to break overly model-focused legacy Rails apps into resource-oriented services.

I think Waves was delivering a future just a little too early. But Waves is Ruby history now. Today Panda Strike (which includes several other developers and a third co-founder, devops lead Lance Lakey) runs mostly on CoffeeScript and Node.js.

Any controversy will have to wait for now.

I'll probably get into these tech choices in future blog posts, and Dan already has.

  • CoffeeScript syntax matches JavaScript semantics better than JavaScript syntax does.
  • It's great to share code between client and server.
  • It's great when your network programming APIs are based on sockets and streams.

Anybody who's read my blog in recent years has seen me growing disillusioned with Rails. I think Rails is making the wrong moves with pretty much everything Rails's creator David Heinemeier Hansson has blogged about in recent years, from client-side JavaScript to hypermedia APIs to TDD.

I think Panda Strike's taking an approach to the web which is more modern, more relevant, and more innovative, both in terms of the projects we're using, and the ones we're creating. I think we're going to deliver some futures right on time. I'm planning to blog about that some more, soon.

Thursday, August 21, 2014

Humans Need Not Apply