Re:Teach Programming to become a better programmer
by howlgram on Tuesday June 19, 2018 @03:35AM
(#17344487)
Yes! There is crazy amounts of dilly dallying with these analogies and there are implied points of logic that are not to belong in the actual technical concept, especially when teachers make it a point to say "these should be separated into a superclass/subclass/attribute but these shouldn't, and it should be specific to this extent and not to the extent that you thought was fitting", while talking about cars and car parts or animals and animal parts and species etc and, there is no actual logic behind their arbitrary separation of concepts that makes sense in their mind, it could be implemented in multiple ways that work, but only the one that they thought made sense to them is correct and students get punished for not thinking like the teacher even if they did something right, this leads to the students wondering if the concepts are just too difficult and going over their head when it's not their fault at all.
The way classes are explained with cars and animals has always struck me as extremely perverse, I've seen a couple of very bright students who were just baffled by what lesson they are meant to take away from the analogy. Consider:
Vehicle is to Car as is Superclass is to Subclass.
Vehicle is to Car as also is a string of bits is to a C int.
Why is this analogy any more relevant to explaining class relations vs explaining that all data can be represented as a stream of bits? Or a whole list of other concepts where a thing is classified? Once the OOP vehicle-car analogy is probed past the truly superficial grammar, there isn't anything there.
Classes are an organisational tool. They have more in common with database normal forms and and functional programming than cars. Representing that an organisational concept should be thought about as a physical relation is not helpful.