Книга: Metaprogramming Ruby 2
Назад: Wrap-Up
Дальше: Part 2: Metaprogramming in Rails

Chapter 7

Epilogue

A master developer was meditating on top of a steep mountain. So deep was his meditation, so profoundly interwoven his code and his soul, that he began to snore gently.

A disciple climbed the mountain and interrupted the master’s concentration. “I am struggling terribly, Master,” he said. “I’ve studied many advanced techniques, but I still don’t know how to apply them correctly. Tell me, what’s the essence of metaprogramming?”

“Look at this small tree by my side,” the master replied, languidly waving his hand. “See how delicately it bends toward the ground, as if feeding on its own roots? Thus must your code be: simple and plain, and closing in on itself like a circle.”

“I am still confused, Master,” said the disciple, even more worried than before. “They always taught me that self-modifying code is bad. How will I know that I am wielding this art properly?”

“Look over your code with a pure heart and a clean mind,” the master coached the disciple. “You will know when the code gets obscure. Exercise your knowledge to shed light, not to obfuscate and confuse.”

“But Master,” the disciple argued, “I lack experience. I need simple rules to know right from wrong.”

The master began to get annoyed. “You’re smart enough to learn,” he said, “but are you smart enough to forget what you have learned? There’s no such thing as metaprogramming. It’s just programming all the way through. Now get lost, and let me meditate in peace.”

At those words, the disciple was enlightened.

Назад: Wrap-Up
Дальше: Part 2: Metaprogramming in Rails