Traducir
[url=http://www.zedshaw.com/essays/master_and_expert.html]http://www.zedshaw.com/essays/master_and_expert.html[/url]
The Master, The Expert,
The Programmer
I spent most of my high school years living on Guam trying to stay alive long enough to leave and start a new life. It wasnt a good time for me, and about the only good thing that came out of it was I started studying martial arts. These days Im a lazy bastard, but back in the day I studied everything I could get my hands on. It was rough, but I came out of it fine and Ive since used my knowledge of martial arts in just about everything Ive done. Each one I studied taught me something different. Capoeira taught me that being balanced is more about being able to adapt and flex than root your stance. Aikido taught me that attacking a problem directly is rarely the solution. Muay Thai taught me that destroying the base will destroy the building. I studied Muay Thai, Ninjitsu, Wing Tsung, Judo, various weapons, and even spent a year getting the crap beat out of me by some rough sword fighters in the SCA. Unfortunately I never studied anything long enough to be considered very good at it. I just took what I found and moved on to the next interesting thing. What does this have to do with programming?
The Master
When I started studying Aikido I read The Book of Five Rings by Miyamoto Musashi about 20 times. I had a badly stained copy from walking to and from class every night in the rain. It was folded and written on as I tried to figure out what the hell he meant. I never really figured it out. I guess you had to be a Japanese Samurai from the 1700s to figure it out. I did figure out though that Musashi was able to defeat his enemies by using unusual and revolutionary tactics. From what I understand of the history of Japanese martial arts, nobody used both swords at the same time until Musashi started doing it. They had two, they just never used them both simultaneously. Musashi was the first known man to break out both swords and defeat a very large number of people with them. He did things differently and it worked.
In Musashis case it wasnt something he came up with and then developed later, but rather an accident that came out of necessity. He was apparently being attacked by a large near army of men, and in order to keep alive he took out his wakizashi to defend himself (thats the small sword). He later developed it into a complete system, but originally it was self preservation. He also did this after spending his whole adult life studying combat, the sword, and strategy in general. Even though it came from necessity, he had the tools and training necessary to make this radical leap possible. Without this training, he probably would have been killed trying to wield two swords at once.
Later in life Musashi retired and pretty much just disappeared from the world. He taught a couple of people, but mostly his art would have died with him if he hadnt written one very little book, The Book of Five Rings. In this book Musashi lays out what he knows about strategy in probably one of the most concise and best written treatise on the subject. Every other person who wrote about strategy wrote huge tomes. If you think The Art of War is small, keep in mind that the Chinese had a huge number of official texts on strategy, of which The Art of War was only a minor part focusing on how war fits with Chinese politics of the era. The Book of Five Rings was different though, it wasnt specific to any era, it was small, it was austere, and it was like nothing before it. It was the final culmination of one mans mastery.
After reading books on martial arts history for years, and studying everything I can, I started to see a commonly understood pattern. Almost all people considered masters of their art finally come to such a deep knowledge that they can do more with less. Rather than a flurry of complicated leaping and jumping, the master will simply step to the side and make one calculated strike. Every story about old masters is the same in that, even though they were frail and near death, their knowledge and abilities were so deep and clear that their simplest motions had the greatest power. For a master, the pompous and flowery motions were just wastes of energy.
Apparently though, these are all just stories Id heard. Nothing more than myths and legends that I was passed from my teachers and friends. But its these stories that make up what we perceived as a masterful person.
A similar story comes from a completely different side of the world and a different era. I read a story about Mestre Bimbathe originator of modern Capoeira from Brazilwhere he fought a challenger in his 20s. Mestre Bimba was in his 80s had limited mobility, but he still took the young buck on. The young guy started the fight by flying into the air doing this impressive flipping motion, ready to kick some ass. Mestre Bimba just rolled out in a slow cartwheel, and stuck his foot out. The hot-head, still flipping, comes out of the maneuver and right into Mestre Bimbas steady foot, smashing himself unconscious. When he woke up he said, What..what was that?
That was my foot my son, is all Mestre Bimba said.
This kind of story is so common in the lore of the martial arts that its impossible to study a martial art and not hear at least one. Every teacher Ive learned from had similar stories about their senseis, sifus, and mestres. Each one is about how some frail old man (or woman) could do amazing things with just the simplest of motions. These lessons all taught me the same thing, A master wastes no energy. Every motion is precious. A master makes everything look effortless. Nothing is frustrating or difficult for them because they do nothing that isnt necessary. The masters actions are pure and elegant.
The Expert
In all my martial arts studies Id always consider myself a novice. I never studied long enough to be an expert, but when I was younger I thought that I was. I studied so much that I couldnt help being some kind of expert. I found that I could get very good at something rather quickly, but mastering something took far longer. I dont think Ive ever mastered anything Ive studied. Im just an expert, probably even less now that I dont study regularly.
I have met quite a few false masters though. These are people who may be very good, and much better than myself. I usually took classes from them, but not because I thought they were grand masters, or masters or anything. These guys (they were always guys, women are hard to find) were flashy. They could do neat things, could teach really complex techniques, and could tell you every single thing about their martial art possible. Charging you for lesson after lesson was how they made their money after all. Teaching you movie stunt man moves was how they attracted and kept students.
Yet, none of these gentlemen were what Id consider masters. They were great teachers, and I dont want to insult them in any way, but none of them were masters of their art. None of them could clearly and simply explain their martial arts concepts. When Id ask a complicated question, they would give me a complicated answer. Sometimes their answers were just wrong. Like one guy who tried to show everyone how to break out of an arm lock by punching. He asked me to do the arm lock since I studied Judo, so I did it right and made sure that I rotated with him as he tried to punch. He kept trying to punch me, and I just kept rotating. I really wasnt paying attention until he suddenly burst out, Dammit stand still so I can demonstrate. I said sorry but thought, Yeah, like Im gonna stand still. He could have kicked my ass two ways from Sunday, but a simple arm lock frustrated him?
The main thing I noticed about the experts Ive encountered is they are into impressing you with their abilities. They are usually incredibly good, but their need for recognition gets in the way of mastery. Everything they do is an attempt to prove themselves and in order to do this they must perform like an actor on stage. Theres nothing wrong with this, and I dont think the expert can become a master without going through this stage in life. At some point though, the expert becomes comfortable with themselves or fed up with impressing everyone and starts to look inward to the core of their art.
The Programmer
Im going to come out looking like an obnoxious pompous asshole here, but Im not trying to be one. Im simply trying to explain something Ive noticed about the difference between code written by myself and that which frustrated experts write. Im in no way saying that Im some kind of grand master coder. I consider myself an advanced expert at best.
What I notice is that my peers are progressing to more and more complicated and convoluted designs. They are impressed with the flashiest APIs, the biggest buzzwords, and the most intricate of useless features. They are more than happy to write endless unit tests to test their endless refactoring all the while claiming that they follow XPs the simplest thing that works mantra. Ive actually seen a guy take a single class that did nothing more than encapsulate the addition of two strings, and somehow refactor it to be four classes and two interfaces. How is this improving things? How can more somehow equal simpler? This should never be the case.
These are the actions of an expert. These experts are very smart, capable, and skilled, but they are too busy impressing everyone to realize that their actions are only making things worse for themselves. In the end all of their impressive designs are doing nothing but making more work for themselves and everyone around them. Its as if their work is only designed for getting them their next job, rather than keeping them in their current one.
I used to be this way. I used to love complicated designs and read everything I could about complicated technologies. But as I get more experienced and older as a programmer I find complex things just annoying. They arent a mental challenge to understand anymore, they are just irritating. Ill pick apart the flashy crap, boil down the technology to its essence and then come up with a much simpler design for the task at hand almost every time.
What worries me though is how the experts react to my simplified designs. Typically theyll say that what Ive written is not following best practices or isnt well designed. Theyll propose these endlessly complex designs with endlessly imagined failure scenarios, and not realize that what they are doing will be a nightmare to maintain. The experts will then saunter off to implement their Flaming Tower of Babel without any comments, horribly complex mock enabled tests, making sure EVERY SINGLE CLASS HAS AN INTERFACE, and ending every class with Impl because, well, thats the best practice. After implementing it theyll continue to complicate the design even further with endless seemingly aimless refactorings for no other reason than to refactor. And when theyre done, Ill go in and read through their code and cry.
This is the actions of an expert. They love complexity because the art is still new to them, something which should be explored. A list is not just a container, its a linked list, or red-black tree, or doubly linked list. To me, its just a container. I realize now that theyre missing my need for simple beautiful things. They dont love quiet elegance, and would rather shout their superiority from the top of the mountain. Meanwhile, Im just a lazy old man who wants to get his job done and write something without any wasted energy. I want to climb the mountain with the least amount of effort and their shouting is causing an avalanche of bad code.
The Coming Professional Master
Programming is a very new discipline, so theres not too many master programmers out there. Whats worse is that the few people I would consider masters arent very exemplary of the software profession and art. They are typically professors who never write anything under a deadline and are given complete artistic freedom to develop whatever they want. Take Donald Knuth, who was able to take three years off from teaching in order to complete TeX. Theres no way I could get away with telling my employer that itll take me three years to finish their product. Knuth is basically a master amateur. A guy who worked in a complete utopia and was able to hone his skills without interference. I would compare him with a man who became a master by studying at a monastery for for his entire life.
In contrast there are masters in the martial arts who learned their art as a means of survival and became masters in a realistic and hostile environment. We dont have anyone like this in the programming profession, or at least I havent met any. I believe that my generation of developers will produce the kind of masters forged in the real professional world. (Yes, sorry professors, if you cant get fired for missing a deadline then you arent a real programmer working in the real world.) Hopefully software development will continue as a profession and well see a crop of master programmers emerge from industry to challenge the existing amateur masters. But, if the current experts continue to push for ever more complicated, convoluted, involved, and impressive designs and ideas then were in for a world of hurt.
So my final plea for all my fellow experts out there: Can we please start pushing the art and science of software development toward the austere? Id love someday to hear a young coder tell a story about someone they idolized like, There was this guy I worked with who once optimized a complicated red- black tree getting 300% performance boost. I was baffled and ask, Howd you do that? Thats impossible. To which he responded
Thats my linked list my son.
Versión Final.
[url=http://www.zedshaw.com/essays/master_and_expert.html]http://www.zedshaw.com/essays/master_and_expert.html[/url]
El Maestro, El Experto, El Programador.
He gastado la mayor parte de mi vida de estudiante de bachillerato viviendo en Guam, tratando de estar lo suficientemente vivo para abandonar este modo de vida y recomenzar otro.
No ha sido una buena época para mí, y lo único bueno que me ha sucedido es el entrenamiento en Artes Marciales.
En estos días he sido un bastardo holgazán, pero tiempo atrás cuando estudiaba de todo, era mucho más activo.
Es un poco difícil de creer, pero las cosas comenzaron a salirme bien desde que apliqué mi conocimiento de Artes Marciales en prácticamente todo lo que he hecho.
Cada Arte Marcial que he estudiado, me ha enseñado algo diferente.
El Capoeira me enseñó que el estar bien equilibrado es mucho más que moverse y estirarse de una posición a otra.
El Aikido me enseñó que atacar un problema de manera directa, raramente es la solución.
El Muay Thai me enseñó que destruyendo la base se colapsará todo lo demás.
Estudié Muay Thai, Ninjutsu, Wing Tsung, Judo, armería e incluso entrené un año como para ser considerado un buen espadachín de la SCA.
Desafortunadamente nunca estudié el suficiente tiempo como para ser considerado muy bueno en ellas. Sólo tomé lo que me interesaba y lo llevé a un siguiente nivel más interesante.
¿Cómo aplicarlo a la programación?
El Maestro.
Cuando comencé a estudiar Aikido leí El libro de los cinco anillos de Miyamoto Musashi, alrededor de unas 20 veces.
Era un ejemplar que leía durante el trayecto a la clase, e incluso en las noches lluviosas. Estaba maltratado y tenía notas escritas para tratar de encontrar el maldito significado al libro.
Nunca lo logré. Supongo que se debe ser un Samurai Japonés del siglo XVI para lograrlo.
Pienso que Musashi fue capaz de derrotar a sus enemigos usando tácticas revolucionarias e inusuales. De lo que entiendo de la historia de las Artes marciales japonesas, nadie usaba dos espadas al mismo tiempo hasta que Musashi comenzó a hacerlo. Si tenían dos espadas, pero nunca las usaban de manera simultánea. Musashi fue el primer hombre conocido que innovó en usar ambas espadas y derrotar a una gran cantidad de enemigos con ellas.
Él hacía cosas distintas y funcionaban.
El caso de Musashi no fue algo que haya pensado, luego desarollado y perfeccionado, sino más bien fue un accidente producto de la necesidad.
Aparentemente estaba siendo atacado por una muchedumbre, y para mantenerse con vida tomó también su wakizashi (la espada pequeña) para defenderse. Posteriormente desarrolló un sistema completo, pero originalmente solo fue supervivencia, instinto de conservación.
También hizo esto, después de una vida entera dedicada al estudio del combate, la espada y la estrategia en general.
Incluso, aunque todo esto haya sido producto de la necesidad, tenía las herramientas y el entrenamiento necesario para haber logrado esta revolución en combate.
Sin su entrenamiento, probablemente hubiera sido asesinado al momento de empuñar ambas espadas por primera vez.
Después Musashi se retiró con vida y se retiró del mundo. Enseñó a un par de personas, pero si no hubiera sido por el Libro de los cinco anillos, su arte hubiera muerto con él. En este libro Musashi expone lo que conoce acerca de la estrategia, en el que probablemente es uno de los tratados mas concisos acerca del tema. Los otros que escribieron acerca de la estrategia terminaron con grandes volúmenes de información.
Si piensas que El arte de la guerra es pequeño, debes tener en mente que los chinos tenían enormes cantidades de textos oficiales de estrategia, en el cual El arte de la guerra era solo una pequeña parte que se enfocaba a como la guerra se ajustaba a la política China de la época. El Libro de los cinco anillos cuenta con un diferente pensamiento, no fue específico a una era, fue pequeño, fue austero, y fue como ninguno otro anterior. Fue la culminación final de la maestría de un hombre.
Después de leer por años libros de historia de artes marciales, y estudiar todo lo que pude, comencé a observar un patrón común de entendimiento. Casi todas la personas consideran a alguien maestro de su arte cuando finalmente logra profundizar su conocimiento de poder hacer más con menos. Más que una elaborada secuencia de movimientos y saltos, el maestro podrá siempre dar un paso hacia un lado y atacar calculadamente con un golpe de mano. Cada historia relativa a los maestros es la misma en que, incluso cuando hayan fallado y con la muerte cerca, sus conocimientos y habilidades eran tan profundas y claras que sus simples movimientos tenían un gran poder. Para un maestro, los movimientos pomposos y adornados eran sólo un desperdicio de energía.
Aparentemente creen, que son historias que escuchado por ahi. Solamente mitos y leyendas que me han transmitido mis maestros y mis amigos. Pero en estas historias lo que se percibe es el como es una persona con maestría.
Una historia similar viene de un lugar al otro extremo del mundo y en una época diferente. Leí la historia acerca del Maese Bimba -creador del Capoeira moderno brasileño- donde combatió contra un retador de 20 años. Maese Bimba tenía 80 años y una movilidad limitada, pero aún asi enfrentó al joven.
El muchacho joven comenzó la pelea, con impresionantes movimientos por el aire, listo para desgraciar al anciano. Maese Bimba solamente esquivó el movimiento con una lenta vuelta de carro, y lanzó un ataque de pie.
El joven acelerado, aún saltando por el aire fue a dar exactamente su cara hacia el pie del Maese, quedando inconsciente.
Cuando se recobró peguntó, ¿Qué…qué fue eso?
Hijo, ese fue mi pie respondió Maese Bimba.
Este tipo de historias son muy comunes en el campo de las artes marciales, y es imposible haber estudiado algún arte marcial sin haber escuchado alguna de ellas.
Cada maestro del que aprendí tenía historias similares acerca de sus sensei, sifu, y maeses. Cada una de esas historias es acerca de que un frágil anciano (o mujer) pudo realizar cosas sorprendentes con movimientos sencillos. Todas estas lecciones me enseñaron la misma cosa:
Un maestro no desperdicia la energía. Cada movimiento es precioso.
Un maestro hace ver todo suave, no forzado.
Nada es frustrante o difícil para él, porque no hace nada que no sea necesario.
Las acciones de un maestro son puras y elegantes.
El experto.
En todos mis estudios de artes marciales, siempre me consideré a mi mismo como un novato. Nunca estudié el tiempo suficiente para volverme un experto, pero cuando era joven, pensaba que si lo era.
Aunque estudiaba tanto, eso no me podría ayudar a volverme algún tipo de experto. Descubrí que tenía facilidad para volverme bueno en algo, pero para alcanzar la maestría me tomaría mucho más tiempo. No creo haber alcanzado la maestría en algún campo que haya estudiado. Solamente soy un experto, ahora probablemente menos, por haber dejado de practicar regularmente.
Creo que me he encontrado con muchos falsos maestros. Estas personas pueden ser muy buenos e incluso mucho mejores que yo. Usualmente tomé clases con ellos, no porque pensara que eran Grandes Maestros, o Maestros o algo por el estilo. Estos hombres (siempre fueron hombres, las mujeres eran muy pocas) eran llamativos. Podían lograr limpieza técnica, podían enseñar técnicas complejas, y podían explicarte cualquier posible detalle mínimo de su arte marcial.
Cobraban por clase y así era como se hacían de bastante dinero. Ser instruido por un doble de película era muy atractivo y eso les ayudaba a tener bastantes estudiantes.
Aún asi, ninguno de estos caballeros eran maestros. Eran instructores muy buenos, y no quiero insultarlos de ninguna manera, pero no eran maestros en su arte. Ninguno de ellos podía explicar de manera simple y clara los conceptos de su arte. Cuando les hacia preguntas complejas, me respondían de manera compleja. En ocasiones sus respuestas estaban equivocadas.
Como una persona que intento mostrar a todos como romper una palanca de brazo con un golpe de mano.
El me instó a que le hiciera una llave de brazo, debido a que yo había estudiado Judo, así que lo agarré y me aseguré de rotar cuando el me intentaba atacar. Se mantenía en su intento, y yo solo rotaba. No ponía mucha atención, cuando súbitamente me gritó Demonios, ¡quédate en tu lugar! para que pueda hacer la demostración. Le dije -Lo siento- pero pensé, Ya parece que me voy a quedar quieto.
Ese domingo, el me podría haber desgraciado de dos maneras diferentes, ¿pero una simple llave al brazo lo frustró?
El asunto principal que noté acerca de los expertos es que impresionan con sus habilidades. Casí siempre son increiblemente buenos, pero para ser reconocidos necesitan adentrarse en el camino de la maestría. Todo lo que hacen es un intento para probarse a si mismos de lo que son capaces de realizar y actuan un papel. No hay nada malo en ello, pienso que el experto no puede volverse maestro sin meterse en su papel en la vida. Aunque en algún punto, el experto se conforma con lo que ha alcanzado para impresionar a los demás, y comienza una búsqueda interna en el núcleo de su arte.
El programador.
Comenzaré a verme como un odioso presumido e idiota, pero no estoy intentando ser uno. Simplemente estoy intentando de explicar las diferencias que he notado entre el código escrito por mi y por los expertos frustados. De ninguna manera estoy dando a entender que soy un Gran maestro codificador. A lo mucho me considero un experto avanzado.
Lo que he notado es que mis iguales han progresado en diseños cada vez más complicados y rebuscados. Impresionan con las API flash, enormes cadenas, y el mas intrincado uso de características especiales. Son más que felices por escribir interminables unidades de pruebas para verificar sus interminables correciones mientras todos dicen seguir el mantra de XP la cosa más simple es la que funciona. He visto a una persona usar una librería de clase que no hacía más que encapsular la suma de dos cadenas, y algo como una correción de cuatro clases en dos interfaces. ¿Esto en que mejora las cosas? ¿Cómo podría ser esto hacer lo mismo de manera más simple?. Este nunca debe ser el caso.
Estas acciones son las de un experto. Los expertos son muy inteligentes, capaces y hábiles, pero están demasiado ocupados en impresionar a todos al realizar sus acciones que solamente se complican la existencia.
Al final de sus impresionantes diseños, no hacen más que trabajar demás a la gente que esta a su alrededor y a ellos mismos. Es como si su trabajo sólo fuera diseñado para tener más trabajo, en lugar de facilitar su trabajo.
Yo también era asi. Amaba los diseños complicados y leía todo lo que podía de las complicadas tecnologías. Pero conforme fui adquiriendo más experiencia y maduraba como programador, descubrí que las cosas complejas solamente son molestas. No son un reto mental para entender más, solamente son irritantes. Separe la basura llamativa, destilé la esencia de la tecnología que hace el diseño de las cosas más simples para las tareas diarias.
Lo que me preocupa es la reacción de los expertos a los diseños simplificados.
Normalmente dicen que el código que he escrito no esta siguiendo con las mejores prácticas o que no está bien diseñado. Se proponen complicar interminablemente los diseños con interminables situaciones posibles, y no se fijan en la pesadilla que puede ser darle mantenimiento a eso.
Luego los expertos se irán a pasear para implementar su Torre de Babel en llamas sin ningún comentario, con pruebas horriblemente complejas, asegurándose de que CADA UNA DE LAS CLASES TENGA SU INTERFACE, y terminando cada clase con Impl porque, es la mejor práctica. Después de la implementación, continúan complicando el diseño más y más con correcciones interminables con el único fin del refactoreo. Y cuando está hecho, tratan de entender su propio código y lloran.
Eso es el proceder de un experto. Aman la complejidad porque el arte es aún nuevo para ellos, algo que debe ser explorado. Una lista no solo es un pila, es una lista encadenada, un árbol red-black, o una lista doblemente encadenada. Para mí, es solo una pila. Veo que pierden la simpleza de las cosas por la belleza de las cosas. No aman la elegancia, y solo quieren gritar en la cima de una montaña que son seres superiores.
Mientras tanto, yo solamente son un hombre holgazán que quiere hacer su trabajo y escribe algo sin desperdiciar su energía. Quiero subir a la cima de la montaña con la menor cantidad de esfuerzo ya que sus gritos están causando una avalancha de mal código.
La llegada del Maestro Profesional.
La programación es una disciplina muy nueva, es por eso que hay muchos maestros programadores por ahí. Lo que es peor, las pocas personas que puedo considerar maestros no son ejemplo de lo que es la profesión y el arte del software. Son el típico profesor que nunca han escrito nada en para entregar en un plazo y tienen completa libertad para desarrollar cualquier cosa que deseen. Por ejemplo Donald Knuth, que fue capaz de tomarse tres años para desarollar por completo TeX. Básicamente Knuth es un maestro amateur. Una persona que trabajo en una completa utopía y fue capaz de afilar sus habilidades sin interferencias. Lo podría comparar con un hombre que se hizo maestro estudiando toda su vida en un monasterio.
En contraste, hay maestros en artes marciales que parendieron su arte como método de supervivencia y alcanzaron la maestría en entornos reales y hostiles. No tenemos nada similar en la profesión de programador, o al menos no me he encontrado con alguien asi (N. del T. Darakann lo és).
Creo que mi generación de desarolladores producirá el tipo de maestros forjados en el mundo real profesional. (Si, lo siento profesores, si no pueden ser despedidos por no cumplir un plazo de entrega para ser programadores del mundo real). Afortunadamente el desarollo de software continuará como profesión y podremos ver emerger desde la industria un semillero de programadores maestros para enfrentar a los maestros amateurs. Pero, si los expertos actuales continuan presionando por complicar, rebuscar, revolver e impresionar con sus diseños e ideas, entonces estaremos en un mundo perdido.
Así que mi súplica final, para todos mis compañeros expertos de ahí afuera es: Podrían por favor presionar en que los adelantos en desarollo de software vayan hacia la austeridad?.
Me encantaría un día escuchar a un jover programador contar una historia acerca de alguien que lo idolatraba diciendo: Eráse una vez una persona que trabajó con alguien que optimizó un complicadísimo árbol red-black obteniendo una aceleración de un 300%. Yo me desconcerté y le pregunté, ¿Cómo hiciste eso?, es imposible. A lo cual el me respondió:
Hijo, Es mi lista encadenada.