Sunday, October 25, 2015

Would you pair program with Stan Lee?

Ever wonder what it would be like if Stan Lee joined your engineering team? Well, I do.

Back in 1978, Stan Lee and John Buscema (both comic legends) wrote a book about "How to Draw Comics the Marvel Way" where they emphasize simpler is better. Sound familiar?

So what is simpler? What is better? Stan Lee says, "A work of art must have a magical ingredient of correct composition." He continues, artists must "compose something that is both pleasing to the eye and gets the message across clearly and interestingly." We've all seen and can identify code that is unpleasing to the eye. And I'm sure most of us can also identify code that clearly states it's intent. So far Stan Lee is preaching to the choir.

How does the man, the myth, the legend suggest we accomplish composing something that is both pleasing and gets it's message across? He says there is one main rule, "the simpler, the better." I agree, simpler is better. But how do we know it's simple?

In the book, Stan and John describe how important elements are grouped together to form prime shapes. These prime shapes should give viewers the best possible shot of the action. They also group together important elements and make it easy for the viewer to understand what is happening. Artists should also never squeeze elements into a prime shape and should remove important areas that fall outside of the prime area. Sounds to me like Stan and John are suggesting good object composition.

Stan Lee states that artists "sense" good composition and sketch in prime shapes before drawing the detail. Much like an engineer would use BDD to specify the outermost behavior and then work their way in. Good panel composition as well as good object composition leads the reader's eye and conveys an interesting message.

And sometimes after shapes are identified and the picture is drawn, too many important elements fall outside the basic shaded area and  the panel needs to be redrawn. I believe us engineers call that refactoring :)

But what if my objects don't have a simpler form or fit into nice prime shapes? Then change the camera angle!  For example, here we have Jonah Jameson yelling at Peter Parker on the phone.

Sure it shows what is happening, but look at how much better the second drawing delivers the message. It's extremely clear what is happening and all that changed was the camera angle.

But there are no cameras in code you say. You are correct, but there are different ways to look at solving a problem. Sometimes it requires deleting code, walking away, and revisiting the problem, but there is always another way. It takes practice, creativity, and a good pair always helps. Even explaining the problem to somebody else can help you see and understand a new way of approaching the problem.

To emphasize the point further, which figure more clearly demonstrates what is happening? A or B?
While A does show the viewer our hero is blasting a foe with a laser blast from his eyes, B does the same thing much more clearly and interestingly. Everything in B demonstrates intense action. There are elements in A that suggest that maybe certain components aren't needed. A also makes our hero look weak and somewhat unsure. When it comes to stating intent clearly I tend to refer back to three things, Avdi Grimm's Confident Ruby, Object Thinking by David West, and Tell Don't Ask. Each of them reinforce the importance of your objects communicating clearly what they do, just like B demonstrates that our hero's entire body is involved in emanating a laser blast from his eyes with confidence!

While Stan Lee may not have experience writing code, he sure has a firm grasp on telling a good story in a way that is clear and interesting to the reader. So yes, I'd love to sit down and craft amazing adventures in code with Stan Lee! As software craftsman, isn't that what we do everyday? We craft code. Code that tells a story. And while the story arc may vary, they are all still stories. Let's all put a little more amazing into our stories the MARVEL way!

No comments:

Post a Comment