by fjdfhdjldj · 8y ago · 0 comments
The interviewers are definitely using the wrong problem if they're trying to test knowledge of OOP.
There's simply no need for "instantiate all the things" approach assumed in the Quora answer. That is OO at its most naive.
OOP is messaging, encapsulation, and late binding. What you do inside the capsule is up to you; and at a higher level, how the behaviour emerges from a composition of objects is also up to you.
I originally though you were advocating for a representation of each piece on the board, were "messages" were "sent" to individual pieces, not the entire board. I was curious about how you'd map that interface to a compact representation.