If Hemingway wrote JavaScript
21–30 of 88 posts
Re: If Hemingway wrote JavaScript
#22Great post, but I don't agree with the critique of "Dickens'" solution. Using one-step equation to solve iterative problem is IMHO better (obvious speed benefits for large n, the only drawback is floating point imprecision), and deriving the equation requires deeper understanding of the problem than simply modeling the iterative equation with a loop.
Re: If Hemingway wrote JavaScript
#23"No surprises here. Code reduced to its essentials with no word or variable wasted. It’s not fancy; maybe its even a little pedantic - but that’s the beauty of Hemingway’s writing. No need for elaborate logic or clever variable names. It’s plain and its clear and it does what it has to - and nothing more."
I am not sure why he did not choose this style:
function fibonacci(size) {
var result = [0, 1], i;
if(size
}Perhaps because Hemmingway would care about performance?
-----
Slightly related: One year ago Javascript inspired me to write the javascript version of genesis:
Re: If Hemingway wrote JavaScript
#24Re: If Hemingway wrote JavaScript
#25Great post, but I don't agree with the critique of "Dickens'" solution. Using one-step equation to solve iterative problem is IMHO better (obvious speed benefits for large n, the only drawback is floating point imprecision), and deriving the equation requires deeper understanding of the problem than simply modeling the iterative equation with a loop.
Re: If Hemingway wrote JavaScript
#26What is that CMS i see more and more often?
Re: If Hemingway wrote JavaScript
#27Vonnegut. Beautiful except for this omission. Anyone?
Re: If Hemingway wrote JavaScript
#28Great post, but I don't agree with the critique of "Dickens'" solution. Using one-step equation to solve iterative problem is IMHO better (obvious speed benefits for large n, the only drawback is floating point imprecision), and deriving the equation requires deeper understanding of the problem than simply modeling the iterative equation with a loop.
I'm not sure I understand how a speed benefit would be had here, since to get number N+1 they still need to retrieve (and/or calculate) number N-1. The difference between getting (N and N-1) or only N-1 is negligible, especially for large n, unless I'm missing something? It's not really more parallelizable either.
The benefit would be there, if Dickens went one step further, and used Math.pow to get the result instead of loop (that is - assuming calculating the power is faster than doing a loop (but it should be - you can square a few times to get near the result instead of multiplying "by one factor" each time)).
Re: If Hemingway wrote JavaScript
#29This is cool as a joke, but I don't think code should be compared to writing. For example I am an engineer, so this comment is written like code. It contains just enough words to express my point, it's clearly structured and my goal is to make it easy to read. That's okay writing, but far from great. Great writers can just sit down and write amazing text. I could never do that. I have to go back, read after myself an…
The main difference isn't the method, it's that writers usually get a lot more time to do their work.
Tangentially, I believe that learning to write better will make you a much better coder and communicator.
Re: If Hemingway wrote JavaScript
#30Excellent use of the .xxx domain name. If people start using .xxx for normal writing, the concept of "one place to conveniently censor" will not work out. Heh.
website automatically blocked in mid-east countries. sad.