Hacker News new | ask | show | jobs
by mikekchar 3973 days ago
Sometimes the bias you have from learning programming one way makes it more difficult to grasp concepts which are different. I recall a study[1] where they questioned whether recursion is more difficult than iteration if it is introduced first. Certainly recursion was difficult for me when I was first learning because I had done a lot of programming using iteration first. It seems surprising that it may have just been a bias of what was introduced first.

I think that eigenclasses are a good example of this. Just because of the languages I learned early on, eigenclasses were obvious to me. I had a hard time even understanding why they had a name: OO without eigenclasses was just another way of saying "broken OO" ;-) Again, it's a bias which is hard to be aware of.

[1] It may be this one: http://dl.acm.org/citation.cfm?id=2361296

2 comments

What troubles me the most with the iter/rec debate is that iteration is so trivial for most, but then many problems look intractable. Recursion feels awkwardly void, empty, almost nonsensical, but when you click your horizon broaden dramatically.

That said, I still fail to recognize recursive patterns far to often.

Eigenclasse, had to look that up:

"A hidden class associated with each specific instance of another class." https://en.wiktionary.org/wiki/eigenclass#English

https://gist.github.com/jfarmer/2625060

Yep. Makes perfect sense that if everything is an object, and class methods belong to a class, and a that class method has to be attached to an object -- you'd need an object to attach it to...

And in Ruby they are only "special" because they have been intentionally hidden from the publicly visible inheritance chain. Personally I think that's what makes it hardest for people to grasp.

E.g. if you define class methods on class Foo, all that's happening is that the class of the object defining Foo is no longer an instance of Class but of a subclass of Class. But it gets confusing because Foo.class still returns Class.