Live data from Hacker News

How A Pull Request Rocked My World

clayallsopp.com

51–60 of 158 posts

Re: How A Pull Request Rocked My World

#51
Critiquing these particular lines of code or the pull request is unimportant. My takeaway was that it's hugely valuable to simply make your code available and have other people look at it. Not only can it improve your own code, but you can personally learn something new from other people. You can be sure

Now I'm feeling a bit guilty for not having open sourced any of the code I've ever written, and I'm wondering what kinds of lessons I could have learned earlier on.

Re: How A Pull Request Rocked My World

#52

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…

Early in my career, a project manager said to me, "I've never heard one programmer praise another programmer's code. They always criticize!" I think that reinforced for me both that someone's approach might be good even if it isn't my own, and also that it's important to say when something is done well. Of course, there's also just a lot of bad code out there.... :-)

Re: How A Pull Request Rocked My World

#54

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…

both arguments are right, but not because of a subjective goodness. because they're talking about 2 different parts of the patch:

- the "bad" part is RowType.for(), where a type is dynamically called forth based on manipulations on some string. I agree that a more concrete mapping from string-to-type would be preferable (I'm assuming the use of a string is required for some reason).

- the "good" part of the patch is that he replaced a conditional with type dispatch. I agree that this is a basic technique of object-oriented programming.

Re: How A Pull Request Rocked My World

#55

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?

I also did not got the point.

It is as if the OP did not grasp what OOP is all about.

Re: How A Pull Request Rocked My World

#56
Novice programmer: Uses simple if/else.

Adept programmer: Discovers polymorphism. It's great, uses it for everything.

Master programmer: Realizes that in many cases, it makes the code less clear and more verbose, reverts back to if/else until the flexibility is actually needed.

Same story repeats itself many times on different fronts: metaprogramming, recursion, exceptions, macros, etc.

Re: How A Pull Request Rocked My World

#57

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…

Authoring a book and being an expert in the topic of said book is, surprisingly, not always correlated. I don't know this particular person, so don't read that as a comment on this particular author. I have met people whose books I have read, I have seen code written by these same people, I have talked with them about the book topic. My take away is that some people are good at writing books, some people are good at writing code, some, but definitely not all, are good at both.

Re: How A Pull Request Rocked My World

#58

Earlier quoted context omitted.

How many books did you wrote ?

That's not an Ad Hominem.

I assume you are responding to me. Yes, yes it is. From Wiki "Argumentum ad hominem, is an argument made personally against an opponent instead of against their argument." AlexeyBrin is implying that because greenyoda may not have written any programming books, that his argument is less valid. AlexeyBrin's argument is not refuting greenyoda's central point, that it's somewhat strange that the blog post author has written a programming book about Ruby, despite not being aware of what some argue are the language's commonly used features.

Re: How A Pull Request Rocked My World

#59
post #3

The classic "Replace Conditional with Polymorphism" design pattern, which took me way to long to realize that it also applies to Python.

Yup. I remember that particular realization. Now switch statements in OO languages just look broken to me. Thanks Python!

Re: How A Pull Request Rocked My World

#60

Earlier quoted context omitted.

That's not an Ad Hominem.

I assume you are responding to me. Yes, yes it is. From Wiki "Argumentum ad hominem, is an argument made personally against an opponent instead of against their argument." AlexeyBrin is implying that because greenyoda may not have written any programming books, that his argument is less valid. AlexeyBrin's argument is not refuting greenyoda's central point, that it's somewhat strange that the blog post author has wri…

Sorry; I was actually responding to AlexeyBrin on https://news.ycombinator.com/item?id=5157519

Sorry for the confusion ;)

Post reply on HN