Thursday, September 22, 2005

Ruby: Language of the Programming Übermensch?

I spent a couple of hours this evening writing my first real Ruby code for the Lexical Semantics course I am taking this fall. It's excellent. The syntax is very appealing. Tokens are strangely verbose, replacing "{" and "}" of C descent with "def" or (insert block starting token here) and "end". For the first 30 seconds after encountering this on page 1, I wasn't sure how I felt about it. It seemed verbose. But now I see that "end" is much easier to type than "}", whose presence in Java forces me to reach and twist for basic program vocabulary. Maybe it would be different if I weren't on Dvorak, but words as delimiters rather than punctuation is a definite win. And while the tokens are fat—in a good way—they are also few. The syntax is remarkably terse, but not at the peril of clarity as I feel is the case with Perl. Ruby makes me understand the power of judicious syntactic support for common tasks. String interpolation is an obvious and immediately addictive feature. Built-in regular expression literals are also a plus. And there is an elegant interplay between these syntactic features on both a functional and visual level. As syntax is concerned, Scheme has represented a year-long exile in the wilderness. The bare minimalism of S-expressions was good for me. Scheme's uniform and parsimonious syntax let me focus on concepts that are fundamental to high-level programming: recursion, higher order procedures, and data abstraction. Scheme taught me by giving me only a handful of powerful tools and then training me to use them well. Now I think that Ruby can empower me by equipping that sharpened outlook with richer facilities for the completion of the common tasks. Its assumptions are friendly to my most cherished and hard-won programming intuition, but they also cater to the harsh realities of programming in an imperative world.

Paul Graham says that languages are evolving ever-closer to Lisp, and he asks, why not skip directly to it? And I think that I finally have an answer. Perhaps the ideal programming experience is purely functional, and the mainstream's gradual adoption of purely functional features reflects this truth. But there are other truths. Tim O'Reilly presents another point. He says that as new computing paradigms emerge, new languages seem to rise with them, suggesting that from a pragmatic standpoint, a language's "goodness" is sensitively dependent on the world in which it is used and with which it must interact. Every time I have programmed functionally for practical applications, I am always keenly aware of how imperative the world outside my program really is. The operating system doesn't behave functionally, and I/O operations certainly never could. There has to be a reason why these languages are so popular, beyond the simple fact that they are easier to learn for programmers whose first language was C. My conclusion is this. In the real world of computing, one finds explicit notions of state; one finds assignment. The computing hyperscape is not (yet, perhaps) very functional. State-oriented computational objects seem a natural complement to our false intuition of objects existing in the real world as well. Nietzsche would say that there are no objects, and, indeed, there aren't even any facts. There is only "will to power". Sounds remarkably similar to me trying to explain to C programmers that there is no data, and there isn't, in fact, any need for assignment. There is only Lambda. I think Nietzsche is right and I think Steele and Sussman were right, but that truth does not mean that the illusion of objects is an utterly worthless one. If we actually cognized the outside world as consisting only of "will to power" rather than tables and chairs and people, we'd never get anything done. And perhaps, similarly, when we pretend that everything is a Lambda, we face similar difficulties in interfacing this remarkably beautiful, completely true notion with an ability to do anything about it.

These ideas, are, I guess, nothing new. Haskell's monad system, from the cursory understanding I have of it, is a formalization of them, a clean interface between the rough and tumble outside universe and the sublime purity of Haskellspace. But if I'm not going to use an airlock, maybe a clever, elegant, and even artistic bridge between functional wisdom and imperative truth will suffice. For now, Ruby seems to be a pretty decent attempt. Lambda may be vulgarized into a quirky codeblock, but in a language in which shell commands are syntactically supported, at least it exists.

Sunday, June 12, 2005

Haskell takes it up a notch

I think exotic programming languages are the best way to explore the core ideas of information science. Haskell is so god damn expressive, it's amazing. Here is the definition of the "increment" function:

inc = add 1

Whaaaat?
That's so fucking organic. How can that idea be encoded any more elegantly?
The trick with Haskell is that their language is designed firstly as a really clear system of notation, a higher level syntax for a system of rigorous mathematics developed in the study of algorithms and semantics. Haskell is a veneer over the lambda calculus and type theories, converting the greek letters from the theory into something that is easier to type. C is a veneer over the system's operating instructions, the mechanical arrangement of electrical impulses that results in the computation. C created a useful shorthand for the tasks that assembly code programmers found themselves doing often. Instead of writing branch statements and pushing to the stack, they wrote for loops. But their code was still very much linear, a cleaned up revision of the very linear programming model of machine instructions. And that indicates the difference between Haskell and C. Haskell is built to express meaning concisely and naturally. C is built to tell the computer what to do. But more and more of that "telling the computer what to do" is becoming redundant and unnecessary. The "higher level" languages need to be divided into two categories. "Mid level" languages are those that rely on sequencing imperatives, and are really just veneers over common patterns in assembly programming. True high level languages are expressive, and completely abstract away the technical details of how the computation occurs. The creator is left to deal just with the idea, and assume his computer will support him.

Look at this definition for quicksort:

quicksort [ ] = [ ]
quicksort (first:rest) = quicksort elsLessThanFirst ++ [first] ++ quicksort elsGreaterThanOrEqFirst
        where
                elsLessThanFirst = [ y | y <- rest, y < first]
                elsGreaterThanOrEqFirst = [ y | y <- rest, y >= first]

That says that the quicksort of an empty list is an empty list. The quicksort of the first and rest of the list is the quicksort of every element in the rest of the list that is less than the first concatenated with the list of just the first concatenated with the quicksort of elements in the rest of the list that are greater than or equal to the first.

I think the code expresses that much more clearly. In fact, Haskell programs can be compiled as documentation in the LaTeX format. The programs serve as executable documentation of programs. Hmm... deathly elegant idea eh? Just look at the quicksort in C:

qsort( a, lo, hi ) int a[], hi, lo;
{
int h, l, p, t;

if (lo < hi) {
l = lo;
h = hi;
p = a[hi];

do {
while ((l < h) && (a[l] <= p))
l = l+1;
while ((h > l) && (a[h] >= p))
h = h-1;
if (l < h) {
t = a[l];
a[l] = a[h];
a[h] = t;
}
} while (l < h);

t = a[l];
a[l] = a[hi];
a[hi] = t;

qsort( a, lo, l-1 );
qsort( a, l+1, hi );
}
}

Tell me which one you'd rather be using on a hard problem. And even adding layers of shit, as in Java, you still don't avoid the barrier to abstraction enforced by that view of programming.

Thursday, May 19, 2005

Fundamental theorem of arithmetic

Finding prime numbers is like factoring infinity.

Humans are a single life form

cams churning
darting metal bearing cascade through the tunnels
a river of metal and heat carry nutrients here and waste there
the asphalt extends its greasy grip

Wednesday, May 18, 2005

Organized Living

Man... I ended up wandering into a Southern California big box retail outlet today, but one of the yuppie ones. Organized Living. A rather apt description of the culture it represents. This store was filled with more plastic shit designed to contain and subdivide other shit than you could shake a stick at. It's like meta-materialism. But organized people are better parts of the organization... or the organism, the mechanized parasite that feeds on the children of parking attendants. Have a great day.

Wednesday, April 20, 2005

Subhuman Sprawl

Walking into the condo complex felt strangely like entering another world, a valley walled on both sides by identical two-story buildings with blue siding and white trim that crowded an asphalt access road. A row of tiny garage doors were beneath the awkward roof lines of puzzled together floor plans, with tunnel-like paths leading to entryways off the main road. Inside, my parents were hastily unpacking cardboard boxes, and my dad asked me what I thought of the new place, telling me how much he liked it with thin, unconvincing enthusiasm. The move was the consequence of him losing his high-paying job to a corporate power play, and it had hurt him pretty badly. Looking out on a ten by ten foot patio surrounded by an eight foot wall, it was hard to respond positively. I felt strange. This place felt strange, desolate, as if no one else lived in the other condos that crowded upward around the patio, blocking out the sun. It was large on condo standards, with a fireplace and an upstairs washer and drier, three bathrooms, an office, and a guest room. But something about it seemed synthetic and thrown together. I couldn't shake uneasiness.

        After dinner, my sister and I went for a walk outside, taking a seat on the red curb that separated the access road from a narrow ravine. We stared out together at a drab office complex on the other side, ringed by an empty asphalt parking lot, a siren wailing in the distance. There seemed something inhumane about this place, something ugly. It was more than the careless, repetitive construction of the condos or our depressing view of the beige office park. It was everything, the fact that across the road behind us there was another faceless complex, and up the road another, neighbors crammed on top of each other and yet painfully alone, doors shut. It was the landscape, the numbing strip-mall homogeneity, the anonymous currents of cars. I started to cry.
        
        This was the American Dream? Sitting in this eerie place, the promise of a house for every family and a car in every garage seemed a cruel lie. To me, no matter what the square footage or how many consumer goods filled that space, living here was the definition of poverty. For an instant, I saw myself differently, a man watching his parents move into a void. My imagination unrolled all the asphalt and uninspired construction, ripping up my conception of our surroundings and replacing them with a new reality. We were in the middle of nowhere. There was no soul to this place, just buildings, thrown up at minimal expense. These condos felt degrading, like the emotional equivalent of a labor camp, carelessly crammed off the side of the freeway, just another driveway interrupting the unused sidewalk. There was no public space anywhere around us, no relief from the monotony of big box retail, condos, and office parks. None of it felt permanent. It didn't feel like a community. And if it wasn't a community, then what was it?
        
        Suburbia is the abdication of civic responsibility for the design of our living spaces to the commercial sector. Towns used to grow organically, but the post World War II building boom took a different approach, the planned community. Modern development typically divides a space into broad single-use zones. One developer gets a plot of land only for houses, the next only for shopping, the next for offices. Between these homogenous chunks of land are thousands of miles of pavement that connect it all together. And because each area is solely dedicated to only one purpose, residents have no choice but to drive for even the most basic of daily activities. The average suburban household generates 13 car trips per day, and the huge volume of traffic must be handled by multilane collector roads, which are optimized for automobile efficiency, not human use.
        
        The inevitable result is the typical American suburban area, the sprawl. Commercial establishments moved away from the urban center and transformed themselves into the ubiquitous shopping center, pulling away from the street to make room for ever-expanding parking lots and erecting massive free-standing signs to attract the attention of speeding motorists. The congestion means that motorists have little time for the multiple stops that would be possible with foot travel, and consequently, retailers must clump together around large lots in order to survive, further centralizing traffic patterns and thus further worsening traffic. The result is a vicious positive feedback loop that isolates the segregated zones even further, squeezing smaller centers that fail to offer enough variety in a single car trip.
        
        I watched this process transform Santee, the community of my childhood in east San Diego County. It's shopping centers used to be filled with family-run restaurants and local grocery store chains. It was suburban, but had a pretty strong sense of community nonetheless, at least in comparison with more crowded, apartment-dominated towns nearby. But in the early nineties, Santee began a development called Town Center, which brought its first big box store, the Home Depot. Soon after came Wal Mart, and then a K-Mart on the other end of town. As the new stores arrived, traffic patterns began to shift. The smaller centers on the periphery gradually began to cycle through one failed business after another. Another shopping center with a Target and a TJ Max later, the transformation was complete. The quiet community is now another bustling chain-store hell. The failed grocery store that I used to walk to from my house has been converted into a megachurch.
        
        The problem with zoned suburban development centered around large collector roads is that this story is the inevitable result. Once the roads are in place, the process is in motion, and the pressure from developers is constant. But after they win, locally owned businesses don't stand a chance against the high-overhead, high-volume chain stores that can attract traffic. Without local ownership, the community loses its identity to an endless stream of national brands that make it look and act like everywhere else. Welcome to Nowhere in Particular, USA.
        
        The American urban environment is losing its humanity, changing to physically to mirror the metaphoric capitalist machine attempting to maximize its production. We have places to eat, sleep, shop, and work, all scattered randomly across the ravaged landscape. But what's missing is any sense that this sprawl has a center, that it means anything. We can stay at home, where our houses and apartments and condominiums are designed with ever less regard for fostering interaction with our neighbors. Or we can get in our cars and drive, perhaps in a desperate attempt to be among other people. But drive where? To which parking lot? An office park? A shopping mall? A megaplex? None of these consumption or production oriented activities really add up to an authentic public space.
        
        Increasingly, American children are learning to associate entertainment with consumption. And why shouldn't they? Their environment offers them no other options. Empty streets greet them outside. And if they want to leave, they'll have to get a ride. Public schools are changing in design, ever more distant from the students they serve, surrounded by ever more parking, schools to which no child will ever walk. When I finally earned my driver's license, it felt like I was being let out of jail. Finally, I had the freedom to go visit my friends, to interact with the rest of my world rather than being stuck at the mercy of my parents. Yet after the novelty wore off, living in suburban culture can still feel like prison. Increasingly, we don't know or trust our neighbors, even–or perhaps especially–in the wealthiest of neighborhoods. And when we leave in search of this community, we find instead just more opportunities to consume, with all the fanfare and novelty of a parking lot and an encounter with a minimum wage worker.
        
        The dominance of the automobile is making us a sedentary culture, but worse, it's isolating us from one another and homogenizing our daily experience. And while the standard of living may be going up, look around you. I'd say that the quality of life is plunging, smothered in the soul-crushing mediocrity of seedy retail shopping centers. They say we're the middle class, but I have to wonder if we aren't just the new underclass of the highly industrialized societies. We own nothing, toil in isolated office parks, eat reheated food from bags that match the buildings of fast food chains, and live in mass produced homes that are plonked down in expanding swaths at the frontier of the advancing development. The structure of our built environment forces us into the role of super consumer, burning gasoline at all times, wearing out tires, buying Red Bull at 7-11 and towels at Linens and Things to salve the disconnection. We're free, but not from the burden of car ownership. We're brave, but not brave enough to strike up conversation in line at Starbucks. Our lukewarm lives of convenience convince us we are the luckiest citizens of the world. Meanwhile, they are robbing us of our souls

Sunday, April 10, 2005

Microsoft is a Major Problem

Microsoft is one of the worst organizations in the history of the planet. I don't think people get it. They look back at dens of snakes like Standard Oil or The Steel Trust and they think... now those were companies that did some damage. Microsoft? No, they're just annoying. They're not grinding up worm ridden meat and rats into the dinner sausage, now are they? And in some ways, these people are correct. Microsoft isn't exactly a weapons company. But the damage that they are inflicting may turn out to be far more costly, on some measures.

They are trying to own the experience of computing. Everything. If Microsoft could embed itself into every last nook and cranny of information technology and bill us for it for the rest of time, they would. Their threat is not just one of monopoly, but of the keys to the machines that are becoming ever central in almost every aspect of our culture.

Bill Gates is a megalomanic. He postures himself as this revolutionary figure, the innovative pioneer, President and Chief Software Architect of the Microsoft Corporation. Puke. Anyone who knows anything about software knows that Bill Gates is no towering genius. It somehow seems that Gates has become the new Horatio Alger symbol of the digital era, but only for the uninformed. The rest of us know he's a power grubber, and a few of us know that he comes from one of the wealthiest families in the Pacific Northwest.

He has all sorts of plans up his architect sleeves to screw society out of freedom for the sake of his profits, and there's a silent movement that's attempting resistance. It's one of the most unnoticed wars I think humanity has ever fought. Thousands of programmers across the world have been battling, pouring out their sweat and tears, in a race against the spread of Microsoft's power. If you've heard of GNU/Linux, that's them–some of them. There's also Apache and Firefox, two free software projects that have been struggling for some time against Microsoft's push to own the Internet.

Typical tactics Microsoft employs? They find a developing set of agreements between members of technological communities, and they use their overwhelming market volume to absorb that standard, pumping out a product that comes bundled with their other products so that their sea of clueless customers can join the community too. But they don't just copy the system. They break it. They add extra features and twists and quirks, negligible things, so that software that abides by the agreements of the community no longer functions correctly. As soon as the standard no longer matters, Microsoft has control. They then add proprietary features and integrations with other products, entrenching their hold on the market and locking out competitors: for-profit and non-profit alike.

Microsoft publicly states that it aims to "embrace and extend" popular preexisting standards. Many have a term for this strategy: "Embrace, Extend, Extinguish."

The most glaring example is their hijacking of the World Wide Web, which was originally an academic project by a community of laboratory scientists. It has been mired in so much Microsoft filth and propreitism that the average website developer spends countless hours learning to make their work display properly across Microsoft's broken system and the standard honored by the rest of the community. But it's happened throughout the computing landscape. They go after programming languages, networking protocols... they even employed this strategy with the PC itself, wresting control away from IBM by supporting clones of their hardware with a slightly altered copy of the operating system they licensed to IBM.

And in case you think that it doesn't effect you, consider their plans for "Trusted Computing", with which they plan to embed a mechanism to make a PC obey the orders of Microsoft over the orders of its owner, in the name of security. This from a company that produces an operating system so full of design flaws that it has to release fixes for it on a weekly basis. Their products are notorious for their poor workmanship, brittle with the contortion and conglomeration of a thousand strategic maneuvers disguised as functional code. What happens when this system runs your bank? Because in Microsoft's vision of the world, it will.

The hope the Internet gives us at breaking out of this corporate mass-media-swamped Fox News mess relies on it being free. They're trying to take that away. And they've only met their first real obstacle with the Internet. See many more revolutionary technologies out there? Nope... It's all robotic soldiers from here. So while it may be true that the revolution will not be televised, lets just try and make sure that it isn't embraced and extended.

"Non co-operation with evil is as much a duty as co-operation with good." -- Mahatma Ghandi

Thursday, March 03, 2005

Eben Moglen has posted a friend of the court briefing in the MGM vs. Grokster case, currently under review by the US Supreme Court. I've only read the first few pages but having never read a formal legal document, I'm finding it quite interesting.

Thursday, February 17, 2005

Resist the Slide

Hi, I'm Nathan.

I hate Microsoft PowerPoint. If I had the sociological evidence I would say it is ruining our entire academic system, but I can say this: It's played a big role in ruining my education. As the slides click by and the class's eyes glaze over, I can't help but wonder, "Is this progress?" I guess the professors use it because they think it makes teaching easier. They can explain the inner workings of a complex idea without having to draw it on the chalkboard. Their notes are displayed for all to see, so that everyone can follow along and download the slides after class... no more note-taking. But for me, this is missing the point. In illustrating an idea on the blackboard, the professor's mind must fully reenact every idea expressed; they must construct a logical flow, one idea following another, with each image they draw and idea they articulate related to the next. It's a difficult task. It takes a lot of preparation, and writing on the blackboard is slow, so figures and examples must be carefully chosen and explained. Yet the difficulties of these "analog" activities are not due to a lack of technology, but to limitations inherent in the learning process itself. The bottleneck is not in the speed at which information can be scrawled on the board but the speed at which that information can be absorbed by students. Do we actually believe that students can learn faster than the experts that are teaching them can write? The articulation of raw data into knowledge, the presentation of ideas in a form optimized for human reception, is the essence of lecture. There's never been a shortage of the resources provided in these slideshows, of graphs and diagrams and laundry-listed theorems. Just open any textbook and you will find endless pages of such information, formatted and explained far more professionally than any amateur slide presentation. But it's all static. You can't follow along as these theorems are proven step by step. Inflating this same static information to fill a classroom wall and pointing at it with a laser beam doesn't solve this problem. With the illusion of structure provided by the ordering of slides, it's easy for the professor to believe that real material is being covered, but an idea displayed all too often fails to result in an idea relayed. The mechanized torrent gives my lectures a rapid pace but a strangely shallow quality, like skimming a novel the night before it's due. They become lifeless and painfully boring, further intensifying the disconnect. It may run counter to our buzzword-enamored academic culture, but this is one beleaguered college senior with a desperate appeal: Get technology out of the classroom. Next time I want to learn by reading, I prefer to turn the pages myself.