Live data from Hacker News

How A Pull Request Rocked My World

clayallsopp.com

11–20 of 158 posts

Re: How A Pull Request Rocked My World

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

Re: How A Pull Request Rocked My World

#13

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?

My thought exactly. Seems like a pretty basic usage of polymorphism/inheritance.

Re: How A Pull Request Rocked My World

#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 javascript, while the initial code needed only a glance to understand what it did.

IMHO, that's just complexity for complexity sake - unless you have plans to take advantage of the new flexibility it provides.

(and if you have to find, hire and pay that 'better than average' person, it might not be such a good thing.)

Re: How A Pull Request Rocked My World

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

Re: How A Pull Request Rocked My World

#17
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…

...I rarely trust these kinds of name-generation tricks.

So you're probably not a big fan of Rails, then?

Re: How A Pull Request Rocked My World

#18

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

Re: How A Pull Request Rocked My World

#19
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…

Agreed. This "refactor" is actually a hack. It shouldn't pass code review.
Post reply on HN