Let's say I have a method DoTheThing() which requires the precondition-check CanTheThingBeDone() to return true. The latter method is time consuming as it accesses the database. I'm finding it hard ...
Martin Fowler's Refactoring book: switch statement is using other object's data, why is that bad ? A deeper explanation is sought for.
In the code sample below the Rental object is using Movie's fields to do a switch statement. Martin says : this is a bad idea but he does not give any deeper explanation as to why ? Of course, you ...
As far as I have understood(?), the "Extends is evil" idea is in direct opposition to the Open Closed Principle? In here, the concept of OCP is presented as inherently using Extends: ...
Is it a basic principle, or highly desirable, to have class methods that return “$this” rather than a value?
I've really just begun to learn OOP. I started about a year ago and have written probably 15,000 lines of it. But I wrote it all with hardly any experience looking at other people's OOP. Most of my ...
How does the Law of Demeter apply to object-oriented systems regarding coupling and cohesion? [closed]
How does the Law of Demeter applied to object-oriented systems with coupling and cohesion? I was reading a book "Software development and professional practice" and came across the chapter about LoD, ...
I was following this highly voted question on possible violation of Liskov Substitution principle. I know what the Liskov Substitution principle is, but what is still not clear in my mind is what ...
Once upon time ago I asked a question on Stack Overflow about inheritance. I have said I design chess engine in OOP fashion. So I inherit all my pieces from Piece abstract class but inheritance still ...
I was just curious, it's something I think most people are aware of as a technique: You have some abominable data that simply must be parsed and you can do nothing to simplify the algorithm for doing ...