In “On OOA and Simplicity (Part 1)”, Samuel Falvo says:
In short, it’ll take you, the programmer, substantially longer to implement a properly OO solution to any problem in Java than it would in Smalltalk. What this means is that a company will shell out more cash for proper OO solutions in Java than they would in Smalltalk. Period. The economics and the laws of physics agree on this one.
La metaprogramación es una técnica muy poderosa, y muy socorrida en el terreno de los lenguajes dinámicos. Puede llevarnos a reducir muy fuertemente el total de código que escribimos - Y lo que es mucho más importante, a minimizar la cantidad de código repetido innecesariamente. Nos lleva claramente a aumentar la calidad y mantenibilidad de nuestro código.
Programas que escriben programas: La metaprogramación consiste en escribir código que no ataca directamente al dominio del problema que queremos atacar, sino que al código que lo resolvería. Dicho sea de otro modo, el código que escribimos no modifica los datos o el estado de nuestra información, sino el del programa.
Las ventajas de los lenguajes dinámicos: La metaprogramación no es una nueva idea - Nació hace ya más de 40 años, con el lenguaje Lisp, y se popularizó tremendamente en el lenguaje Smalltalk, a principios de los 80. Ambos lenguajes fueron revolucionarios en diversos aspectos, y si no gozan hoy en día de mayor popularidad, se debe a que, en sus implementaciones originales sufrían de problemas de rendimiento en el hardware de su época. Sin embargo, sus ideas básicas han servido para conformar a una gran cantidad de lenguajes que han ido adquiriendo una cada vez mayor popularidad y aceptación: Los lenguajes dinámicos.
Podemos categorizar a un lenguaje de dinámico cuando no requiere de ciclos determinados y claramente separados de compilación y ejecución. Mucha gente cree erróneamente que los lenguajes dinámicos (por ejemplo, Perl, Ruby, Python o PHP, ampliamente utilizados en el mundo del Software Libre) son interpretados - La realidad es completamente distinta, son lenguajes que cuentan con compiladores tremendamente eficientes, que en fracciones de segundo pueden convertir decenas de miles de líneas de código en una representación binaria (bytecode para sus respectivas máquinas virtuales).
La característica definitoria de estos lenguajes como dinámicos no es el compilador ágil (aunque, claro está, lo requieren) - Es la presencia de la instrucción (o familia de instrucciones) «eval» (o similar). En resumidas cuentas, eval recibe un parámetro, típicamente una cadena, y lo evalúa como código fuente -
Reflectividad: La mayor parte de los lenguajes dinámicos son también reflectivos. Los objetos (y, recuerden, en los lenguajes completamente orientados a objetos, todo es un objeto - Incluyendo las clases, no sólo los objetos instanciados) pueden ser interrogados respecto a los métodos que ofrecen.
Q28. What is the difference between chaining and cascading?
Ans. In Chaining, one message can follow on after another. In this case the second message is sent to the object which is the result of the first message.
anObject msg1 msg2 msg3
In Cascading, each message is followed by a semicolon (;) and another message. In Cascading, subsequent messages are sent to the first receiver.
anObject msg1; msg2; msg3
Question: What do I get from 1+2*3?
Answer: 9
Del FAQ de smalltalk, es revelador de su funcionamiento. se van añadiendo mensajes a los objetos detras de estos.
- Everything is an object
- Objects communicate by sending and receiving messages (in terms of objects)
- Objects have their own memory (in terms of objects)
- Every object is an instance of a class (which must be an object)
- The class holds the shared behavior for its instances (in the form of objects in a pogram list
- To eval a program list, control is passed to the first object and the remainder is treated as its message
and I can tell you I did not have C++ in mind.
The objective of the Anti-IF Campaign is to raise awareness of effective use of the Object-Oriented paradigm.
The primary purpose of our campaign is to become aware of the design consequences of using IFs and of control structures in general, applied by following the path of the procedural paradigm in Object Oriented contexts. This greater awareness will enable you to understand how to achieve more effective results in terms of flexibility, comprehensibility, testability, and ability to evolve.
The basic problem is that IFs create dependencies, coupling between modules (methods, objects, components, etc.) and increases possible paths inside our code (which reduces legibility).
Our plans for a 3D environment
We think the ultimate interface is the Geoscope , and Croquet perfectly fits the requirements that the Geoscope idea has for a 3D environment, such as OO, Prototype-based, P2P, Self-contained, changeable from within etc.
Why is Croquet built on Squeak?
Croquet required a number of capabilities that could only be provided by a true late bound, message sending language. Croquet’s relationship to Squeak gives Croquet the property of a purely object-oriented system. This allows for significant flexibility in the design and the nature of the protocols and architectures that have been developed for Croquet. An essential part of our development process is Squeak’s ability to keep the system running while testing and especially while making changes. Squeak allows even major changes to be performed incrementally and they take no more than a fraction of a second to effect. (…)
It may be interesting to note that when we first set out to build Croquet, we intended to do it in Java. However, we had to abandon that approach because Java lacks needed meta facilities.