ReportWire

Tag: machine readable

  • Programming in Assembly Is Brutal, Beautiful, and Maybe Even a Path to Better AI

    [ad_1]

    Rollercoaster Tycoon wasn’t the most fashionable computer game out there in 1999. But if you took a look beneath the pixels—the rickety rides, the crowds of hungry, thirsty, barfing people (and the janitors mopping in their wake)—deep down at the level of the code, you saw craftsmanship so obsessive that it bordered on insane. Chris Sawyer, the game’s sole developer, wrote the whole thing in assembly.

    Certain programming languages, like Python or Go or C++, are called “high-level” because they work sort of like human language, written in commands and idioms that might fit in at a poetry slam. Generally speaking, a piece of software like a compiler transforms this into what the machine really reads: blocks of 1s and 0s (or maybe hex) that tell actual transistors how to behave. Assembly, the lowest of the “low-level” languages, has a near one-to-one correspondence with the machine’s native tongue. It’s coding straight to metal. To build a complex computer game from assembly is like weaving a tapestry from shedded cat fur.

    Why would anyone do this? I recently asked Sawyer, who lives in his native Scotland. He told me that efficiency was one reason. In the 1990s, the tools for high-level programming weren’t all there. Compilers were terribly slow. Debuggers sucked. Sawyer could avoid them by doing his own thing in x86 assembly, the lingua franca of Intel chips.

    We both knew that wasn’t the real reason, though. The real reason was love. Before turning to roller coasters, Sawyer had written another game in assembly, Transport Tycoon. It puts players in charge of a city’s roads, rail stations, runways, and ports. I imagined Sawyer as a model-train hobbyist—laying each stretch of track, hand-sewing artificial turf, each detail a choice and a chore. To move these carefully crafted pixels from bitmaps to display, Sawyer had to coax out the chip’s full potential. “RollerCoaster Tycoon only came about because I was familiar with the limits of what was possible,” he told me.

    Working within the limits? A foreign idea, perhaps, in this age of digital abundance, when calling a single function in an AI training algorithm can engage a million GPUs. With assembly, you get one thing and one thing only, and it is the thing you ask for—even, as many a coder has learned the hard way, if it is wrong. Assembly is brutal and beautiful that way. It requires you to say exactly what you mean.

    I’ve done assembly’s creators a disservice. They wanted things to be easier, not harder. I imagine they were tired of loading up punchcards and flipping switches on their steampunk leviathans. Perhaps they dreamed of a world like ours, where computers can do so much with such minimal guidance.

    [ad_2]

    Gregory Barber

    Source link

  • Attention, Spoiled Software Engineers: Take a Lesson from Google’s Programming Language

    Attention, Spoiled Software Engineers: Take a Lesson from Google’s Programming Language

    [ad_1]

    Many of today’s programmers—excuse me, software engineers—consider themselves “creatives.” Artists of a sort. They are given to ostentatious personal websites with cleverly hidden Easter eggs and parallax scrolling; they confer upon themselves multihyphenate job titles (“ex-Amazon-engineer-investor-author”) and crowd their laptops with identity-signaling vinyl stickers. Some regard themselves as literary sophisticates. Consider the references smashed into certain product names: Apache Kafka, ScyllaDB, Claude 3.5 Sonnet.

    Much of that, I admit, applies to me. The difference is I’m a tad short on talents to hyphenate, and my toy projects—with names like “Nabokov” (I know, I know)—are better off staying on my laptop. I entered this world pretty much the moment software engineering overtook banking as the most reviled profession. There’s a lot of hatred, and self-hatred, to contend with.

    Perhaps this is why I see the ethos behind the programming language Go as both a rebuke and a potential corrective to my generation of strivers. Its creators hail from an era when programmers had smaller egos and fewer commercial ambitions, and it is, for my money, the premier general-purpose language of the new millennium—not the best at any one thing, but nearly the best at nearly everything. A model for our flashy times.

    If I were to categorize programming languages like art movements, there would be mid-century utilitarianism (Fortran, COBOL), high-theory formalism (Haskell, Agda), Americorporate pragmatism (C#, Java), grassroots communitarianism (Python, Ruby), and esoteric hedonism (Befunge, Brainfuck). And I’d say Go, often described as “C for the 21st century,” represents neoclassicism: not so much a revolution as a throwback.

    Back in 2007, three programmers at Google came together around the shared sense that standard languages like C++ and Java had become hard to use and poorly adapted to the current, more cloud-oriented computing environment. One was Ken Thompson, formerly of Bell Labs and a recipient of the Turing Award for his work on Unix, the mitochondrial Eve of operating systems. (These days, OS people don’t mess with programming languages—doing both is akin to an Olympic high jumper also qualifying for the marathon.) Joining him was Rob Pike, another Bell Labs alum who, along with Thompson, created the Unicode encoding standard UTF-8. You can thank them for your emoji.

    Watching these doyens of programming create Go was like seeing Scorsese, De Niro, and Pesci reunite for The Irishman. Even its flippantly SEO-unfriendly name could be forgiven. I mean, the sheer chutzpah of it. A move only the reigning search engine king would dare.

    The language quickly gained traction. The prestige of Google must’ve helped, but I assume there was an unmet hunger for novelty. By 2009, the year of Go’s debut, the youngest of mainstream languages were mostly still from 1995—a true annus mirabilis, when Ruby, PHP, Java, and JavaScript all came out.

    It wasn’t that advancements in programming language design had stalled. Language designers are a magnificently brainy bunch, many with a reformist zeal for dislodging the status quo. But what they end up building can sometimes resemble a starchitect’s high-design marvel that turns out to have drainage problems. Most new languages never overcome basic performance issues.

    But from the get-go, Go was (sorry) ready to go. I once wrote a small search engine in Python for sifting through my notes and documents, but it was unusably sluggish. Rewritten in Go, my pitiful serpent grew wings and took off, running 30 times faster. As some astute readers might have guessed, this program was my “Nabokov.”

    [ad_2]

    Sheon Han

    Source link

  • Inside the Cult of the Haskell Programmer

    Inside the Cult of the Haskell Programmer

    [ad_1]

    At the same time, I understood almost immediately why Haskell was—and still is—considered a language more admired than used. Even one of its most basic concepts, that of the “monad,” has spawned a cottage industry of explainers, analogies, and videos. A notoriously unhelpful explanation, famous enough to be autocompleted by Google, goes: “A monad is just a monoid in the category of endofunctors.”

    The language is also more despised than explored. Steve Yegge, a popular curmudgeon blogger of yesteryear, once wrote a satirical post about how, at long last, the Haskell community had managed to find the one “industry programmer who gives a shit about Haskell.” For programmers like Yegge, Haskell is a byword for a kind of overintellectualized, impractical language with little industry applicability.

    What Yegge didn’t understand, however, is that using Haskell is rarely a pragmatic decision. It is an intellectual, even aesthetic, one. In its essence, Haskell has more in common with the films of Charlie Kaufman than other programming languages: highly cerebral, charmingly offbeat, and oddly tasteful; appreciated by those in the know and judged by outsiders as pretentious. Haskell is, one might say, a cult classic.

    That Haskell never gained widespread adoption exemplifies a paradoxical truth in software engineering: Great programming languages aren’t always great for programming.

    Haskell is not inherently more difficult to learn than something like C, but the two languages pose different challenges. Writing in C is akin to precision engineering, requiring the kind of attention demanded of a skilled horologist. But Haskell code is, really, code-shaped mathematical expressions. C is a quintessential engineer’s language. Haskell is a pure mathematician’s.

    A good engineer’s and a good mathematician’s aptitudes don’t always overlap. The industry’s not-so-well-kept secret is that most programmers aren’t as good at math or logic as you might think. This is mostly fine. After all, many doctors would make poor molecular biologists, few lawyers are legal philosophers, and the great majority of MBAs know zilch about econometrics. But this means few programmers can really master Haskell. This includes me, of course, whose legs weaken at the sight of such expressions as “F-coalgebra” and “typeclass metaprogramming.”

    Still, when I think about Haskell, a line about Martin Amis’ prose comes to mind: “the primacy he gives to style over matter.” Haskell programmers are style supremacists, and it’s nothing to apologize for. In an industry often fixated on utility and expediency, the Haskell community should not feel obligated to summon evidence of its usefulness. Instead, it should simply retort: What’s the problem with useless intellectual exercises?

    Because the thing about useless exercises is they don’t stay useless for long. Even when “industry programmers” shunned Haskell, language designers took note. In recent years, a Haskell-style paradigm has come into vogue because of the treasury of benefits it offers: rendering certain categories of bugs impossible by design, making a program’s correctness more provable, and enabling easy parallel computation. Some of the most anticipated updates featured in new versions of imperative languages are those inspired by functional programming. In the end, Backus’ anti–von Neumann plea was heard. Programming has been liberated.

    [ad_2]

    Sheon Han

    Source link