An Introduction to Metaprogramming

As we advance through the topics of the programming courses, we are introduced to new and weird concepts, in this article we talk about "metaprogramming" something that produces new programs or parts of them, this with the help of programming "metaprograms". This is complicated to be described, the professor says that this could be only suitable for the "programming gurus" but not. This in certain kind of way describes the difficulty of the topic. As I remember, at some of my classes, we learn something about metaprogramming, well, at least the word sounds familiar

The example was interesting, because it was simple and was enough to explain how the metaprogramming work in a simple situation. The explanation about eval and quines was useful, the definition about quines is new, the author defines it as a "special kind of source code generator". In other hand, the jargon defines the quines as "a program that generates a copy of its own source text as its complete output".

Later on, the article talks about the attr_accessors in ruby, specifically about the advantages and disvantages, and how we can face them with the attr_initializer, which help us to take advantage of the Ruby's metaprogramming. As I understand, this help us to define a kind of function to allow us to receive parameters and set their values by default and avoid the problem of trying to retrieve a value without initializing it. 

I cant stop wondering why I wasn't teached to program in Ruby before, it apperas that the language has a lot of advantages, like the modification at runtime, or "attr_initializer method" which mekeas easier to write programs. The topic, seems interesting, and I want to lear more about it, the topic doesn't seems easy, but I think it would be helpful for any programer to know how to use metaprogramming

Comentarios

Entradas populares de este blog

WarGames

First Entrance

Ethical Reflection on Ready Player One