How to instantiate Spring managed beans at runtime?

Looks like I found a solution. As I am using java based configuration it is even simpler than you can imagine. Alternative way in xml would be lookup-method, however only from spring version 4.1.X as it supports passing arguments to the method. Here is a complete working example: public class Container { private List<RuntimeBean> runtimeBeans … Read more

Tool to refactor C# var to explicit type

I’ve got ReSharper 4.1, and it does offer this option (in either direction). Actually, I’d recommend challenging the standard… the former is far more readable than the latter (especially if you call the variable pair or something similar). I would’t use “var” for var i = 0, but it is ideally suited to the above. … Read more

Coupling, Cohesion and the Law of Demeter

Grady Booch in “Object Oriented Analysis and Design”: “The idea of cohesion also comes from structured design. Simply stated, cohesion measures the degree of connectivity among the elements of a single module (and for object-oriented design, a single class or object). The least desirable form of cohesion is coincidental cohesion, in which entirely unrelated abstractions … Read more