Buscar en Mind w/o Soul

lunes, marzo 17, 2008

Los constructores son dañinos

Sobre la separación de conceptos entre Creación y Uso de objetos.

Room 101: Constructors Considered Harmful
In mainstream object oriented programming languages, objects are created by invoking constructors. This is rather ironic, since you can say a lot about constructors, but you cannot honestly say that they are object oriented.
...
What about using a dependency injection framework (DIF)? Ignoring the imbecilic name, I think that if you’re stuck with a mainstream language, that may be a reasonable work around. It requires a significant degree of preplanning, and makes your application dependent on one more piece of machinery that has nothing to do with the actual problem the application is trying to solve. On the positive side, it helps guarantee employment for software engineers.

No hay comentarios: