I'm writing several methods that call other methods. To pass the information I have a couple of choices: Pass the information as parameters Set instance variables so that other methods can access ...
I am currently learning about delegate and the Law of Demeter. I understand the Law of Demeter, but I can't seem to find a good example of where using delegate to avoid breaking the law would actually ...
It seems to me that instanceof comes from the land of functional programming and is a watered down version of pattern matching and that the OO altenative to it should be dynamic dispatching. In OO ...
In C#/Java, the dependency inversion principle is often demonstrated by high-level classes that depends on an interface/abstraction (that it owns). Low-level classes will implement the interface, thus ...
In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, ...
This blogpost was posted on Hacker News with several upvotes. Coming from C++, most of these examples seem to go against what I've been taught. Such as example #2: Bad: def ...
What the difference given they all exist 'once per class'. When should I use one over another, i.e. for what purpose? I use Ruby.
In OOP there is the Open/Closed principle that states that "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification". Taking in ...