An Introduction to Metaprogramming
Once you're familiar with the techniques, metaprogramming is not as complicated as it might sound initially. Metaprogramming allows you to automate error-prone or repetitive programming tasks. You can use it to pre-generate data tables, to generate boilerplate code automatically that can't be abstracted into a function, or even to test your ingenuity on writing self-replicating code.
The Jargon File: www.catb.org/esr/jargon
Ruby Cookbook by Lucas Carlson and Leonard Richardson, published by O'Reilly Media, 2006. Chapter 10 of this book contains 16 recipes on reflection and metaprogramming using Ruby. Highly recommended.
The Quine Page: www.nyx.net/~gthompso/quine.htm. This Web page contains quines in many different programming languages. It even has quines that work in more than one language.
Ariel Ortiz is a faculty member at the Computer Science Department of the Tecnolgico de Monterrey, Campus Estado de Mexico. He's been teaching computer programming for almost two decades. He's not too sure what his favorite programming language is, but he thinks it's either Scheme, Python or Ruby. He can be reached at email@example.com.
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
- Tips for Optimizing Linux Memory Usage
- Picking Out the Nouns
- "No Reboot" Kernel Patching - And Why You Should Care
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Android Candy: Intercoms
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Non-Linux FOSS: .NET?
- Consent That Goes Both Ways