Vikram Chandra - Geek Sublime - The Beauty of Code, the Code of Beauty

Здесь есть возможность читать онлайн «Vikram Chandra - Geek Sublime - The Beauty of Code, the Code of Beauty» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Год выпуска: 2014, ISBN: 2014, Издательство: Graywolf Press, Жанр: Современная проза, Публицистика, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Geek Sublime: The Beauty of Code, the Code of Beauty: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Geek Sublime: The Beauty of Code, the Code of Beauty»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

The nonfiction debut from the author of the international bestseller
about the surprising overlap between writing and computer coding.
Vikram Chandra has been a computer programmer for almost as long as he has been a novelist. In this extraordinary new book, his first work of nonfiction, he searches for the connections between the worlds of art and technology. Coders are obsessed with elegance and style, just as writers are, but do the words mean the same thing to both? Can we ascribe beauty to the craft of writing code?
Exploring such varied topics as logic gates and literary modernism, the machismo of tech geeks, the omnipresence of an “Indian Mafia” in Silicon Valley, and the writings of the eleventh-century Kashmiri thinker Abhinavagupta,
is both an idiosyncratic history of coding and a fascinating meditation on the writer’s art. Part literary essay, part technology story, and part memoir, it is an engrossing, original, and heady book of sweeping ideas.

Geek Sublime: The Beauty of Code, the Code of Beauty — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Geek Sublime: The Beauty of Code, the Code of Beauty», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

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-dhvani theory 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 Natyashastra and Anandavardhana’s Dhvanyaloka , Abhinavagupta explored the role of memory in the psychology of rasa. Just as Anandavardhana had claimed a distinctiveness in the way vyanjana or 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 samskaras and 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

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Geek Sublime: The Beauty of Code, the Code of Beauty»

Представляем Вашему вниманию похожие книги на «Geek Sublime: The Beauty of Code, the Code of Beauty» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Geek Sublime: The Beauty of Code, the Code of Beauty»

Обсуждение, отзывы о книге «Geek Sublime: The Beauty of Code, the Code of Beauty» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x