Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

OOP made sense to people who already knew structured programming and understood functional decomposition (what we now call 'refactoring'). Perhaps education should start with that and then justify OOP? I remember reading about the original LOGO experiments; one thing kids do not spontaneously do is break up their monolithic actions into sensible functions.


Yeah "breaking up a complex function into simpler functions" is a great example of something that isn't taught well today, yet is simpler and more critical than what we try to teach people in intro courses.

I think of it in analogy to math. OOP is like topology - it's definitely useful in some cases, it's not too hard for an experienced mathematician to get the basics, and yet in a lot of situations it's irrelevant and it doesn't really belong in the first class you take.

Being able to solve fizzbuzz is like doing arithmetic. If you can't solve fizzbuzz then you aren't going to be able to really get any advanced concepts. It's like you can't be a good mathematician if you can't figure out whether 351 is an odd number - you need to learn the basics first, even if "real math isn't about arithmetic".

Sadly, you can tell if you do a lot of phone screens that many people who graduate with CS degrees still can't code fizzbuzz. Our CS education is busted right at the beginning. It needs to get the basics right, like, can you write loops, can you write functions. Today it is failing at that.


Perhaps inheritance is easier to teach, which might be completely unrelated to how useful it is in practice? That would explain a lot.

It reminds me a bit of how I was taught basic economics, where societies go from barter to currency. Apparently this is not true at all, but it's a story that is easy to teach.


Functional decomposition != refactoring.

They are two completely different processes.

https://en.wikipedia.org/wiki/Functional_decomposition

https://en.wikipedia.org/wiki/Code_refactoring


Breaking up a large functions into smaller functions isn't even (strictly speaking) functional decomposition because not every sub-function might be dependent on the previous function. "Extract function" is a kind of refactoring, but not refactoring itself.


When the ECE department at my university revised the undergrad Computer Engineering curriculum, they rejected the CS introductory courses partly for this reason. They also want to teach hardware first, but more importantly they teach "systematic decomposition" from the very beginning (before they teach programming) and leave OOP for future course work.


That is exactly true!

I have experience teaching kids Lua, and with the right metaphors and a little bit of backtracking and foundation-building, even complicated ideas like emulating classes and single inheritance can be understood and even implemented by young students.

If I taught them lua reserved keywords, and a couple little math tricks here and there, they usually would all bunch up everything into a couple huge functions, and their game would (sort-of) work but be impossible to reason about, and very painful to extend.

Introducing objects as a way to represent things that they want the game to do (draw things, shoot things, eat things, etc), it becomes clear to them that there is merit in structuring programs with objects beyond "shrugger says to do it like this!"

OOP on its own doesn't make much sense. You can't teach someone to drive stick shift if they don't know what a car is. Maybe you could, but that's probably even worse.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: