Live data from Hacker News

How A Pull Request Rocked My World

clayallsopp.com

31–40 of 158 posts

Re: How A Pull Request Rocked My World

#31
post #4

I don't love this refactor. I especially don't like how it generates names from other names -- e.g., given 'switch'/'submit', appends '_row', and then converts it to CamelCase so you get 'SwitchRow'/'SubmitRow', then instantiates the class named that. Here's why: When I am maintaining somebody else's code, even if I guess that this is going on, I rarely trust these kinds of name-generation tricks. When I need to chan…

This is especially true for those of us who do application support.

When we are investigating application stack traces from production for a large application, it is awful when you discover that the developers decided to be clever with dynamic function names, making a large code base very difficult to support based on available logs.

If you think you're being clever you're probably just being a dick.

Re: How A Pull Request Rocked My World

#32

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 ?

Ah, the good ol' ad hominem.

Re: How A Pull Request Rocked My World

#33

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

I think this comment is a little unwarranted. Polymorphism wasn't the concept he discovered - the idea of generating the classes (metaprogramming) and the "clever" (well, some would say so at least) was interesting to him. I also don't like how your comment tries to make fun of his efforts to learn something new.

> 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.

Re: How A Pull Request Rocked My World

#34
post #15

On the first glance it seems great, but much more complex to understand and debug. The if tree was certainly not pretty, but straightforward - it did its thing. It was something that could be given to an average developer to work on and improve. The refactored code will require someone that's not just an average developer - if only because you need to read the article to understand it if you're not familiar with java…

This is not written in javascript, it is ruby. And I think your developer is way below average if he can't understand the pattern used in the refactored code.

Re: How A Pull Request Rocked My World

#35

Earlier quoted context omitted.

I think this comment is a little unwarranted. Polymorphism wasn't the concept he discovered - the idea of generating the classes (metaprogramming) and the "clever" (well, some would say so at least) was interesting to him. I also don't like how your comment tries to make fun of his efforts to learn something new.

> 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.

Why is that a problem? As I pointed out, he's just showed us a metaprogramming trick he thought was cool. That is no indication that he is an inept programmer or someone that should be allowed to teach something like RubyMotion (if he was writing a book on metaprogramming, that's another thing).

Re: How A Pull Request Rocked My World

#36

Earlier quoted context omitted.

I think this comment is a little unwarranted. Polymorphism wasn't the concept he discovered - the idea of generating the classes (metaprogramming) and the "clever" (well, some would say so at least) was interesting to him. I also don't like how your comment tries to make fun of his efforts to learn something new.

> 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?

Re: How A Pull Request Rocked My World

#37

In terms of Gang of Four patterns, I believe this would be Strategy + Factory Method. The book is a little antiquated (1994) but it or a better successor should be required reading for any programmer.

I don't believe that its terribly antiquated. Pretty much everything bases itself off of this book.

Edit: drafted iPad - fixed spelling. Trilby - does anyone even use that word anymore?!?

Re: How A Pull Request Rocked My World

#38
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.

What I take from this is yet another situation of people arguing about something highly subjective that is closely tied to their identity. Good programming is not an objective concept. People respond differently to different programming techniques and what works better for one person may greatly confuse another.

Re: How A Pull Request Rocked My World

#40
post #4

I don't love this refactor. I especially don't like how it generates names from other names -- e.g., given 'switch'/'submit', appends '_row', and then converts it to CamelCase so you get 'SwitchRow'/'SubmitRow', then instantiates the class named that. Here's why: When I am maintaining somebody else's code, even if I guess that this is going on, I rarely trust these kinds of name-generation tricks. When I need to chan…

Given this is ruby code, I think it's acceptable, and well-structured enough to be understandable.

While the implementation itself might be a bit 'eugh' because of the meta-programming involved, there was enough thought put into code organisation to allow you to grep `RowType` to find the module that namespaces all these dynamically instantiated classes.

Hell, if the code in the tree was arranged correctly, then `tree | grep row_type` would give you the folder where they all lived.

Post reply on HN