Live data from Hacker News

How A Pull Request Rocked My World

clayallsopp.com

41–50 of 158 posts

Re: How A Pull Request Rocked My World

#41

The article is very humble, but in my view, seems to go a little too far. "You can reuse code with inheritance. Absolutely crazy. Brilliant. All of this blew me away." Honestly?

Thats a very critical point that you just have to understand, to "get". Many people know and learn about object oriented design, but when tasked to actually write a program based on these principles they will often revert to code where they make distinctions based on the type of what they have been handed. TLDR: dynamic_cast is bad design

Using static conditions rather than polymorphism seems to just be a common thing that people tend to do, regardless of skill level or quantity of experience. It's not uncommon for people just not to think of using polymorphism, if the objects in question wouldn't really model any particular kind of object as such (they're just there to provide a table of function pointers). This says nothing about the quality of their code, or the general OOness of their designs, or the number of digits in their IQ.

It's a bit of a shame, because I've found code to be reliably improved by using objects as simple tables of function pointers. The same is less often true for using objects as models of things.

Re: How A Pull Request Rocked My World

#42

Earlier quoted context omitted.

> I also don't like how your comment tries to make fun of his efforts to learn something new. The problem is not that he's learning, he's teaching.

What, teachers should never learn?

The basics? Yes they should learn that, years before starting to teach.

Re: How A Pull Request Rocked My World

#43

Reading the comments in this thread is very interesting to me, because each programmer seems certain of the superiority of his own programming style. We have some comments that disparage the change, saying that it obfuscates the code and makes it more difficult to understand. We have others saying that this change is a basic technique and it's "shocking" that the author wrote a book without this simple knowledge. Wha…

+1 for Good programming is not an objective concept.

Re: How A Pull Request Rocked My World

#44
post #12

I'm not a developer, but I read this article anyway. All of this blew me away. Like this "@mordaroso" fellow strolled on up, cocked his knee skyward, and jettisoned his leg into the rickety wooden door that previously sheltered my mind. That was just great writing.

I have to disagree. "Jettison" does not fit the simile he was going for, at all.

It's not great, but it could be good. Replace "jettison" and cut the cliched "All of this blew me away" and the resulting paragraph is descriptive and fairly tight.

Re: How A Pull Request Rocked My World

#45
To be honest, I'm very disappointed with the comments here.

Clay is obviously a very talented programmer, and just like most talented programmers, he didn't start out that way. This article isn't about how he learned OOP, it's about how someone opened his eyes to how code can be elegant instead of simply just functional.

This article hits home with me especially. I just learned Python last semester in my intro to CS class. I had an eerily similar moment when I learned how to use generators. "WOW! You can simplify this huge block of code into one line! It's..beautiful." It's a really special moment, and I'm glad Clay shared his.

Re: How A Pull Request Rocked My World

#46

Earlier quoted context omitted.

> I also don't like how your comment tries to make fun of his efforts to learn something new. The problem is not that he's learning, he's teaching.

What, teachers should never learn?

Metaprogramming isn't a basic part of any programmer's education.

Re: How A Pull Request Rocked My World

#47
post #12

I'm not a developer, but I read this article anyway. All of this blew me away. Like this "@mordaroso" fellow strolled on up, cocked his knee skyward, and jettisoned his leg into the rickety wooden door that previously sheltered my mind. That was just great writing.

I have to disagree. "Jettison" does not fit the simile he was going for, at all.

[deleted]

Re: How A Pull Request Rocked My World

#48

It's scary to think that this guy who was just shocked to discover a very basic concept of object oriented programming (polymorphism) has written his own book on iOS programming: http://clayallsopp.com/posts/writing-a-programming-book

How many books did you wrote ?

That's not an Ad Hominem.

Re: How A Pull Request Rocked My World

#49
Those who know this technique either discover it themselves, through "reading, learning, doing", or are shown,like this guy was. None of us was born knowing this. Clay has blogged about his experience of discovering this - that in itself is what makes this a great read for me. I wouldn't be surprised if every single tech book author, at some point after their book has been published, has learned something and thought "I wish I knew that when I wrote my book !!" By their very nature books document the authors understanding at a point in time. Would polymorphism have helped Clay's book ? Probably. Does not knowing it ruin the book ? Probably not. If we waited 'til we knew everything before we wrote a book about anything, nothing would ever get written.

Re: How A Pull Request Rocked My World

#50

Those who know this technique either discover it themselves, through "reading, learning, doing", or are shown,like this guy was. None of us was born knowing this. Clay has blogged about his experience of discovering this - that in itself is what makes this a great read for me. I wouldn't be surprised if every single tech book author, at some point after their book has been published, has learned something and thought…

Writing a book is also a great way to discover new things about your subject.
Post reply on HN