355 500 произведений, 25 200 авторов.

Электронная библиотека книг » Vikram Chandra » Geek Sublime: The Beauty of Code, the Code of Beauty » Текст книги (страница 8)
Geek Sublime: The Beauty of Code, the Code of Beauty
  • Текст добавлен: 17 октября 2016, 01:34

Текст книги "Geek Sublime: The Beauty of Code, the Code of Beauty"


Автор книги: Vikram Chandra



сообщить о нарушении

Текущая страница: 8 (всего у книги 15 страниц)

You may have to use a dozen tools and websites to handle the various logistical aspects of software development, and soon the triumph starts to wear a little thin. Add another dozen software libraries and frameworks that you may use internally in your programs – again, each one comes bristling with its own eccentricities, bugs, and books – and weariness sets in. Each tool and preconstructed library solves a problem that you must otherwise solve yourself, but each solution is a separate body of knowledge you must maintain. A user named jdietrich wrote in a discussion on Hacker News:

My biggest gripe with modern programming is the sheer volume of arbitrary stuff I need to know. My current project has so far required me to know about Python, Django, Google App Engine and its datastore, XHTML, CSS, JQuery, Javascript, JSON, and a clutch of XML schema, APIs and the like …

Back in ye olden days, most programming tasks I performed felt quite natural and painless, just a quiet little chat between me and the compiler. Sometimes longwinded, sometimes repetitive, but I just sat and thought and typed and software happened. The work I do these days feels more like being a dogsbody at the tower of babel. I just don’t seem to feel fluent in anything much any more. 23

And every year, the new technologies arrive in a cloud of acronyms and cute names: MongoDB, HTML5, PaaS, CoffeeScript, TPL, Rx. One must keep up. On programmers.stackexchange.com, one hapless coder wrote:

I was humbled at a job interview yesterday almost to the point of a beat-down and realized that although I know what I know, my skills are pretty old and I’m getting to where I don’t know what I don’t know, which for a tech guy is a bad thing.

I don’t know if I can keep current just doing my day to day job, so I need to make sure I at least know what’s out there.

Are there well known blogs I should be keeping up with for software development? 24

The best – or at least the most ambitious – programmers read blogs and books, attend conferences to keep up with the state of the art, learn a new language every year or two. When you begin programming, one of the attractions is the certainty that you will never run out of things to learn. But after a few years of working in a corporate cubicle under exploitive managers, after one deadline too many, after family and age and a tiring body, learning the ins and outs of the latest library can feel like another desperate sprint on a nonstop treadmill. There is a reigning cult of overwork in the industry – the legend of the rock-star programmer usually has him coding sixteen hours a day, while simultaneously contributing to open-source projects, blogging, conferencing, and somehow managing to run a start-up – and this ideal has led many an aspirant to burnout, complete with techie thousand-yard-stare, clinical depression, outbursts of anger, and total disinterest in programming. This trough of disillusionment is so deep that for many, the only way to emerge from it is to leave the industry altogether, which rewards a few with fame and dazzling amounts of money, but treats the many as disposable cogs in its software production machine. The endless cycle of idea and action, endless invention, endless experiment, all this knowledge of motion takes its toll, leaves behind a trail of casualties.

Butler Lampson’s hope that millions of ordinary people would write “non-trivial programs” and thus become poets of logic has proved elusive. From the sixties onwards, numerous technologists have promised that their new programming languages would make programmers redundant, that “managers [could] now do their own programming; engineers [could] now do their own programming.” 25Advertisements touted the magical abilities of “automatic programming systems.” But Knuth’s “Software is hard” dictum still remains true, and business users have found that getting custom software out of IT departments requires large budgets and lots of patience. This is because programmers – at their best – try to build software out of elegant code that is modular, secure, and legible, which takes time and money. Instead of waiting, mere mortals often hack something together in the programs they already have available on their machines. This is why, according to the economics blogger James Kwak, “Microsoft Excel is one of the greatest, most powerful, most important software applications of all time.” 26Much of the planet’s business data is stored in Excel, and its intuitive interface allows non-programmers access to some very powerful capabilities. Executives and marketers and secretaries write formulae and macros to extract information when they need it, and are therefore able to take action in a timely fashion. The trouble is that in Excel there

is no way to trace where your data come from, there’s no audit trail (so you can overtype numbers and not know it), and there’s no easy way to test spreadsheets … The biggest problem is that anyone can create Excel spreadsheets – badly. Because it’s so easy to use, the creation of even important spreadsheets is not restricted to people who understand programming and do it in a methodical, well-documented way. 27

Sloppy Excel-wrangling can lead to some very bad decisions, as in the “London Whale” trading disaster of 2012, which caused the financial services firm JPMorgan Chase a loss of approximately six billion dollars; the company’s internal investigation listed as one of the contributing factors a financial modeling process which required cutting and pasting data through a series of spreadsheets. One of these spreadsheets contained a formula dividing by the sum of some numbers instead of their average. 28

The day that millions will dash off beautiful programs – as easily as with a pencil – still remains distant. The “lovely gems and brilliant coups” of coding remain hidden and largely incomprehensible to outsiders. But the beauty that programmers pursue leads to their own happiness, and – not incidentally – to the robustness of the systems they create, so the aesthetics of code impact your life more than you know.

For example, one of the problems that have always plagued programmers is the “maintenance of state.” Suppose you have a hospital that sends out invoices for services provided, accepts payments, and also sends out reminders for overdue payments. On Tuesday evening, Ted creates an invoice for a patient, but then leaves the office for an early dinner; there is now an “Invoice” object in the system. This object has its “InvoiceNumber” field set to 56847, and its “Status” field set to “Created.” All of these current settings together constitute this invoice’s “state.” The next morning, Ted comes in and adds a couple of line items to this invoice. Those inserted line items and a new “Status” setting of “Edited” along with all the other data fields are now the invoice’s state. After a coffee break, Ted deletes the second line item and adds two more. He has changed the invoice’s state again. Notice that we’ve already lost some information – from now on, we can’t ever work out that Ted once inserted and deleted a line item. If you wanted to track historical changes to the invoice, you would have to build a whole complex system to store various versions.

Things get even more complicated in our brave new world of networked systems. Ted and his colleagues can’t keep up with the work, so an offshored staff is hired to help, and the invoice records are now stored on a central server in Idaho. On Thursday afternoon, Ted begins to add more line items to invoice 56847, but then is called away by a supervisor. Now Ramesh in Hyderabad signs on and begins to work on the same invoice. How should the program deal with this? Should it allow Ramesh to make changes to invoice 56847? But maybe he’ll put in duplicate line items that Ted has already begun working on. He may overwrite information – change the “Status” field to “Sent”—and thereby introduce inconsistencies into the system. You could lock the entire invoice record for 56847 on a first come, first served basis, and tell Ramesh he can’t access this invoice because someone else is editing it. But what if Ted decides to go to lunch, leaving 56847 open on his terminal? Do you maintain the lock for two hours?

Guarding against inconsistencies, deadlocks of resources by multiple users, and information loss has traditionally required reams of extremely complex code. If you’ve ever had a program or a website lose or mangle your data, there’s a good likelihood that object state was mismanaged somewhere in the code. A blogger named Jonathan Oliver describes working on a large system:

It was crazy – crazy big, crazy hard to debug, and crazy hard to figure out what was happening through the rat’s nest of dependencies. And this wasn’t even legacy code – we were in the middle of the project. Crazy. We were fighting an uphill battle and in a very real danger of losing despite us being a bunch of really smart guys. 29

The solution that Oliver finally came to was event sourcing. With this technique, you never store the state of an object, only events that have happened to the object. So when Ted first creates invoice 56847 and leaves the office, what the program sends to CentralServer in Idaho are the events “InvoiceCreated” (which contains the new invoice number) and “InvoiceStatusChanged” (which contains the new status). When Ted comes back the next morning and wants to continue working on the invoice, the system will retrieve the events related to this invoice from CentralServer and do something like:

Invoice newInvoice = new Invoice();

foreach(singleEvent in listOfEventsFromCentralServer)

{

newInvoice.Replay(singleEvent);

}

That is, you reconstitute the state of an object by creating a new object and then “replaying” events over it. Ted now has the most current version of invoice 56847, conjured up through a kind of temporally shifted rerun of events that have already happened. In this new system, history is never lost; when Ted adds a line item, a “LineItemAdded” event will be generated, and when he deletes one, a “LineItemDeleted” event will be stored. If, at some point in the future, you wanted to know what the invoice looked like on Wednesday morning, you would just fire off your “Replay” routine and tell it to cease replaying events once it got past 9 a.m. on Wednesday morning. You can stop locking resources: because events can be generated at a very fine granular level, it becomes much easier to write code that will cause CentralServer to reject events that would introduce inconsistencies, to resolve conflicts, and – if necessary – pop up messages on Ted’s and Ramesh’s screens. Events are typically small objects, inexpensive to transfer over the wire and store, and server space grows cheaper every day, so you don’t incur any substantial added costs by creating all these events.

Oliver writes that when he discovered event sourcing

it was as if a light went on. I could literally see how adoption of event sourcing could shed a massive amount of incidental and technical complexity from my project … Fast forward to today. [I] now have a number of systems in production with several more that are only weeks away and I literally could not be happier. I have significantly more confidence in my software than I had in the past. The code is dramatically cleaner and infinitely more explicit than it would have been otherwise. But that’s only the starting point. Our ability to expand, adapt, and scale – to be agile from a business perspective – is infinitely greater than it ever has been, even with each application being significantly larger and each associated domain exponentially more complex than before – all with a smaller team. 30

“Dramatically cleaner and infinitely more explicit” code is beautiful, and here, enhanced function follows from form. But letting go of object state and embracing events requires some effort and imagination. During another blog discussion about event-sourcing code, a user more familiar with the old-style methods of storing current state remarked, “Yes, this code is beautiful, really beautiful. And my … brain almost blew up when I tried to understand the process.” 31

As I learned about the beauty of event sourcing, I was reminded of other discussions of identity-over-time that had bent my mind. The Buddhists of the Yogachara school (fourth century CE) were among the proponents of the doctrine of “no-self,” arguing: “What appears to be a continuous motion or action of a single body or agent is nothing but the successive emergence of distinct entities in distinct yet contiguous places.” 32There is no enduring object state, there are only events. To this, Abhinavagupta – whom we’ve already seen commenting on Anandavardhana’s Dhvanyaloka—responded with the assertion that there could be no connection between sequential cognitive states if there were not a stable connector to synthesize these states across time and place. 33There may be no persistent object state, but there needs to be an event-sourcing system to integrate events into current state. For Abhinavagupta, memory is the preeminent faculty of the self: “It is in the power of remembering that the self’s ultimate freedom consists. I am free because I remember.” 34

And, according to Abhinavagupta, it is memory from which literature derives its powers.

7 THE CODE OF BEAUTY: ABHINAVAGUPTA

The most prominent of Anandavardhana’s successors in the field of rasa-dhvanitheory was the towering polymath Abhinavagupta (literary critic, aesthetic philosopher, metaphysical philosopher, theologian, poet, musician, and – according to his late-tenth-century contemporaries – a realized yogic master). In his commentaries on the Natyashastraand Anandavardhana’s Dhvanyaloka, Abhinavagupta explored the role of memory in the psychology of rasa.Just as Anandavardhana had claimed a distinctiveness in the way vyanjanaor suggestion worked in poetic language, Abhinavagupta claimed that the commonplace workings of memory, when directed by the poet, gave literature a power that was unique, an ability that was available nowhere else.

Abhinavagupta asserted that all minds contain infinite layers of samskarasand vasanas—“latent impressions” left by one’s experience and past lives; it is these impressions that are brought alive or manifested by dhvani.The aesthetic experience allows the viewer, this cognizing subject, to set these latent impressions in motion within itself, to conjure them up out of sub– or un-consciousness and render them active; the subject becomes a participant in the fictional event, it feels, it relives. Yet, according to Abhinavagupta, this event and its evoked emotions are, for the participating subject, free of all ego-driven considerations: “I am afraid, he – my enemy, my friend, anybody – is afraid.” 1The viewer or reader, then, is able to engage with the specifics of the art in a way that is profoundly felt and is yet – paradoxically – removed.

So, to a playgoer who hears some lines about a hunted deer

there appears, immediately after the perception of their literal sense, a perception of a different order, an inner [mānasī] perception, consisting in a direct experience [sākṣātkāra] which completely eliminates the temporal distinction, etc., assumed by these sentences. Besides, the young deer … which appears in this perception is devoid of its particularity ( viśeṣa), and at the same time the actor, who [playing the role of the deer] frightens [the spectators by appearing to] be afraid, is unreal ( apāramārthika). As a result, what there appears is simply and solely fear – fear in itself, uncircumscribed by time, space, etc. This perception of fear is of a different order from the ordinary perceptions … for these are necessarily affected by the appearance of fresh mental movements … consisting of [personal, egoistic] pleasure, pain, etc., and just for this reason are full of obstacles ( vighna). The sensation of the fear above mentioned, on the contrary, is the matter of cognition by a perception devoid of obstacles ( nirvighna) and may be said to enter directly into our hearts, to dance ( viparivṛt) before our eyes: this is the terrible rasa.In such a fear, one’s own self is neither completely immersed ( tiraskṛ), nor in a state of particular emergence ( ullikh) As a result of this, the state of generality involved is not limited ( parimita), but extended ( vitata). 2

This generalization, this trans-personalization, sadharanikarana, is the essential basis of the aesthetic experience. The framing of an object as art produces this necessary detachment from the limited ego. For a viewer, “the tasting of pleasures, pains, etc., inhering in his own [limited] person” prevents the relishing of rasa. 3The attachment to limited self prevents universalization; if you are grieving over your own long-lost mother, you are not relishing the rasaof the tragic death scene in the movie you are watching.

The means of eliminating this obstacle are the so called theatrical conventions ( nāṭyadharmi), which include a number of things not found in ordinary life, as, for instance, the zones ( kakṣyā) dividing the pavilion ( maṇḍapa), the stage ( raṇgapīṭha); and … also the different dress of the actors – the headwear, etc. – by which they hide their true identity. 4

It is the very artificiality and conventionality of the aesthetic experience, therefore, that makes the unique experience of rasapossible. Abhinavagupta observes:

In the theatrical performance there is on one hand the negation of the real being of the actor, and on the other – since the spectator’s consciousness does not rest entirely on the represented images – there is no rest on the real being of the superimposed personage; so that, as a result of all this, there is eventually just a negation both of the real being of the actor and of the real being of the character he is playing. 5

And yet the spectator experiences the full panoply of emotion and thought induced by the action of the play, and simultaneously, the spectator’s perception of the aesthetic objects (the story, the actors, the stage) and of his or her own reactions is marked by wonder, chamatkara, and a willingness, an openness toward these perceptions. The result is pleasure that exists “through the suppression of our [usual] thick pall of mental stupor and blindness” as we encounter the aesthetic object. This pleasure consists of “the states of fluidity, enlargement, and expansion, and is also called ‘tasting,’ and is of a non-ordinary [ alaukika] nature.” 6So, rasais a supra-mundane mental state that is “not a form of ordinary cognition, nor is it erroneous, nor ineffable, nor like ordinary perception, nor does it consist of a super-imposition.” 7 Rasadiffers from “both memory, inference and any form of ordinary self-consciousness.” 8

During the experience of rasa, according to Abhinavagupta, “what is enjoyed is consciousness itself.” 9That is, the aesthetic object, through the process of generalization, allows us to experience the emotional and cognitive fluctuations within ourselves without attachment, without obstacles, with a harmonious density ( ekaghana) that we cannot find in the chaos of ordinary life. When we watch characters experiencing grief, for instance, we have

a thought-trend that fits with the vibhāvasand anubhāvasof this grief, [which] if it is relished (literally, if it is chewed over and over), becomes a rasaand so from its aptitude [toward this end] one speaks of [any] basic emotion as becoming a rasa.For the basic emotion is put to use in the process of relishing: through a succession of memory-elements it adds together a thought-trend which one has already experienced in one’s own life to one which one infers in another’s life, and so establishes a correspondence in one’s heart. 10

Daniel H. H. Ingalls, Sr., points out that this reflective, mirroring response of the heart, this hrdaya-samvada, is differently understood by Abhinavagupta than a viewer’s “empathy” in the West (“I feel Hamlet’s emotions as my own”); here, one’s own latent and personal memories of grief are liberated into “a universal, impersonal flavour.” 11It is precisely this impersonality, this ego-less emotion, experienced in tanmayi-abhava, total absorption, which is desirable – the sahrdayawants the state of objectivity, not increased subjectivity. He doesn’t want to experience grief at a personal level, he wants to relish the stable emotion of grief within himself, made available to him because of his heart’s concordance with the suffering of the characters. “The feelings of delight, sorrow, etc., [produced by the representation] deep within our spirit,” Abhinavagupta says, “have only one function, to vary it, and the representation’s function is to awaken them.” 12

The aesthete rests in rasain a kind of meditation, tasting the waves of emotions within consciousness, and the bliss he or she experiences is the same as the yogi’s beatitude. The difference is that the sahrdaya’s limited self is not “completely immersed” or vanished; the accomplished yogi, on the other hand, goes beyond the self altogether, and exists in a state of complete transcendence which is nirvikalpa, “without support”—without object, without subject, without ideation and verbalization. This does not mean the yogi’s experience is necessarily “better”—the relishing of beauty cannot happen when there is no subject and no object, and there is a harshness often associated with the yogi’s effort, with the sheer enormity of the exertion. But within the aesthetic experience, “This rasais poured forth spontaneously by the word which is like a cow, for love of her children; for this reason it is different from that which is (laboriously) milked by yogin.” 13

One of the protagonists in Red Earth and Pouring Rainparticipates in an event usually referred to as the First Indian War of Independence (by Indians) or as the Great Mutiny of 1857 (by the English). The memory of an entire culture includes certain events that become shared samskaras or latent traces, and these too can be mobilized by the poet. As I wrote about the 1857 war, there was both a sense of great power from resurrecting iconic events, and a feeling of unease from the still-palpable pain of that long-ago trauma.

Jacques Lacan broke from the psychoanalytic establishment with his famous manifesto “The Function and Field of Speech and Language in Psychoanalysis,” and in this speech he refers directly to Abhinavagupta and dhvanitheory, invoking “the teaching of Abhinavagupta” to elaborate upon “the property of speech by which it communicates what it does not actually say.” 14Lacan argued that the unconscious “does not expressitself in speech; it revealsitself through suggestion,” and that the analyst should deploy the power of dhvani“in a carefully calculated fashion in the semantic resonances of his remarks.” 15

According to Lalita Pandit, through dhvani, “poetic language reaches the condition of silence. It functions like a meta-language, generating many meanings by deploying collective and individual memory banks, latent impressions, mental associations.” 16

Like the Lacanian analyst, the poet can direct dhvaniat the depths of what a culture leaves unsaid, and thus manifest in the sahradaya’s consciousness the echoes of those great silences.

Great art is distinguished by its resonance, by the depth of its dhvani.But the rasathat the viewer will experience also depends crucially on his own capability and openness: “The word sahrḍaya(lit. ‘having their hearts withit’) denotes persons who are capable of identifying with the subject matter,” Abhinavagupta writes, “as the mirror of their hearts has been polished by the constant study and practise of poetry, and who respond to it sympathetically in their own hearts.” 17The sahrdaya’s education and erudition has not made his heart or hrdayaimpervious, it is able to “melt” in response to art; this is in contrast with the “scholar” whose heart “has become hardened and encrusted by his readings of dry texts on metaphysics.” 18

Abhinavagupta insists that rasacannot be “caused.” That is, mimesis – of things, of events, of people – offers us an opportunity for savoring, and this gustation is not a fixed or “frozen” mental state, a simple matter of stimulus and response, such as the joy one might feel in response to the words, “A daughter is born to you.” The sensitive viewer or reader inhabits the imitated action through an act of concentrated sympathy, and so

the relishing of beauty arises in us from our memory bank ( saṃaskāra) of mental states which are suitable to the vibhāvasand anubhvāsof those basic emotions [that are being portrayed in the characters of a literary work] …

So what is born here is a rasyamāṇatā(a being tasted, a gustation, of beauty), that is, a savouring that eclipses such worldly mental states as the joy that might be produced by reunion with a constant stream of old friends. And for this reason [viz., because of its super-normal character], the savouring serves to manifest something, not to inform one of something, as might be done by an established means of knowledge ( pramāṇa). It is not a production such as results from the working of a cause. 19

The poet’s pratibhaor intuitive genius – which harnesses craft and training – therefore depends on the sahrdaya’s intuitive receptivity – which is polished by learning – to become complete. It is for this reason that Abhinavagupta begins his commentary on the Dhvanyalokawith an evocation of “the Muse’s double heart, the poet and the relisher of art.” The coming together of the poet and the reader is what creates “brave new worlds from naught and even stones to flowing sap has brought.” Beauty is imparted by the “successive flow of genius and of speech” from the poet to the sahrdaya. 20

Since rasacannot be “caused” in a deterministic manner, you cannot produce art through test-driven development; your true sahrdayamay be born a hundred years after you die.

There are other qualities of poetic language that make verification difficult or impossible. The speech of the poet can be effective even when it doesn’t obey the rules of everyday language. According to Abhinavagupta, even denotative and connotative meanings are only aids to the production of rasa, unessential props which can sometimes be discarded: “Even alliterations of harsh or soft sounds can be suggestive of [ rasa], though they are of no use as to meaning. Here, then, there is not even the shadow of the metaphor.” 21So music alone, without lyrics, can be the occasion of rasa.Even when language is used to construct an aesthetic object, when meaning and metaphor are necessarily present, to want the object – the poem, the story, the play – to convey coherent, verifiable information about the real world, as a treatise might, is to fall into a category error. Poetry’s meaning does not need any external referentiality or validation to produce pleasure. “[In poetry] the savouring … arises like a magical flower, having its essence at that very moment, and not connected with earlier or later times.” 22

Abhinavagupta goes even further, arguing that even at the level of syntactic units or the basic building blocks of a language, poetry is not always bound to the principles of coherence, meaning, and verification. “Poetic sentences,” for instance, “do not require validity so as to motivate [hearers] by communicating a true meaning … because they culminate only in pleasure.” 23So even language that does not cohere or produce mundane meaning may produce rasa.This is true, for instance, in language or sound poetry. Illegibility has its own pleasures, incomprehensibility may exalt. It is at the end of denotation that rasamanifests, as in Hindustani and Carnatic music, where the repetition of a single phrase by the singer – sometimes for hours – so empties the words that finally nothing is left but the fullness of the emotion, that which lies beyond words.

The grammarians of Sanskrit – the eternal, formal language – were, as one might expect, obsessed with correctness, precision, clarity. The proponents of the rasa-dhvanitheory – from Anandavardhana onwards – faced fierce opposition from the orthodox on the grounds that there was no need to introduce a new semantic power to account for the suggestive functioning of art. Connotation, context, the speaker’s intent, and inference, the argument went, already accommodated this functionality. A ninth-century logician summarily dismissed Anandavardhana’s arguments and added, “In any case, this discussion with poets is not appropriate; even learned people become confused in this difficult path of sentence meaning.” 24

Our logician was understandably annoyed by the fuzzing up of the difficult but clean lines of sentence-meaning, least of all by poets, who – it must be admitted – can tend to be somewhat unlearned in logic. Nevertheless, what Anandavardhana tries to achieve in his analysis is completely in keeping with his intellectual tradition, which modeled all knowledge after Panini’s grammar: he tries to provide a systematic, algorithmic understanding of literary beauty and its effects. At the end of the Dhvanyaloka, he quotes a critic who declares, “We may speak of dhvaniwhenever an ineffable beauty of certain words and certain meanings is perceptible only to special cognizors, just as the rarity of certain gems [is known only to special experts].” Anandavardhana says bluntly that this critic is wrong, and argues that the

special [virtues] of words and meanings can be explained and have been explained in many ways [by himself]. To imagine that there is some ineffable virtue over and above these is to admit that one’s power of analysis has ceased … As for the definition sometimes given of ineffability, that it is the appearance of a thing [viz., of a unique particular] which cannot be referred to by a word for a mental construct ( vikalpa) which is based on … the general or universal, this can no more apply to the special virtues of poetry than it can to the special virtues of gems. For the virtues of the former have been analysed by literary critics, while no estimate can be made of the value of a gem by reference merely to the general or universal. It is true, however, in both cases that these special virtues are recognizable only by experts. For only jewellers are knowers of gems and only sensitive critics ( sahṛdaya) are knowers of the rasaof poetry. On this point no one will argue. 25


    Ваша оценка произведения:

Популярные книги за неделю