4 ms·
> 2) It is actually surprisingly difficult to teach object oriented programming in Python, since most simple problems are much more easily solved in a functiona
by ama729 13y ago
> 2) It is actually surprisingly difficult to teach object oriented programming in Python, since most simple problems are much more easily solved in a functional manner than with classes.
Do you have an example? From the outside, it doesn't seem to be that difficult, for example, in the C++ course I followed, the teacher introduced classes with the implementation of a RPG character. That was pretty simple.
- jeorgun 13y agoWhile I don't know that it's difficult to teach OOP in the sense of 'objects exist' in Python, I do think it's more difficult to teach a lot of tthe concepts associated with OOP, because the way it's done in Python is so unusual (explicit self, no real encapsulation, etc., etc.). In the introductory programming course I took, the way OOP was introduced involved writing incredibly un-idiomatic Python. So in that sense it works fine, but if you're going to ignore the 'spirit' of a language in order to use it as a teaching tool, it seems to me what language you choose doesn't really matter, so long as it has the features to shoe-horn in whatever style you want to teach people in.
- Derbasti 13y agoI explained it using a bank account. That works well enough. It's just that I couldn't come up with many real-world problems and exercises that are naturally solved with classes. Classes are a rather high-level abstraction, and most problems in introductory classes are decidedly low-level.