TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Proof You Can Become a Better Programmer

29 点作者 williamkennedy超过 8 年前

15 条评论

rehemiau超过 8 年前
Here is a recipe for a successful shitpost on hacker news:<p>1. Write a blog post about your experience with X. Your description shall not be complete nor correct.<p>2. Wrap it around with a thesis on a random topic, which is semi-related to your experience, and which is by no means proven by your description.<p>3. ??<p>4. profit!
评论 #13050136 未加载
adamnemecek超过 8 年前
You don&#x27;t become a better programmer by doing Project Euler like problems. Pick a real world project that&#x27;s of interest to you and try to implement it. When starting out, it&#x27;s not the worst idea to pick something that&#x27;s been implemented quite a few times so that you can reference other people&#x27;s work if you get stuck. You&#x27;ll be surprised how much you can learn from implementing e.g. ls.<p>Also, you can contribute to open source.<p>Btw, this project I&#x27;m contributing to called AudioKit (if you are interested in audio stuff on Apple hw, you should definitely check it out) is looking for contributors<p><a href="https:&#x2F;&#x2F;github.com&#x2F;audiokit&#x2F;AudioKit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;audiokit&#x2F;AudioKit</a>
评论 #13049989 未加载
评论 #13049964 未加载
jwdunne超过 8 年前
Let&#x27;s not be too harsh. This is a programmer in a place where we have all been before - we must remember this.<p>William has looked back after 2 years learning. He&#x27;s blown away and is showing those that are slogging it out, 2 years away from that point.<p>The author will learn that, actually, you can do this every 1 - 2 years and still get blown away. Even more shocking is looking at that newbie code at 4 years in.<p>Fact is there is clear improvement. He&#x27;s on the right trajectory. He&#x27;s just in the stage where you feel unstoppable and perhaps hasn&#x27;t yet been humbled by a few bad projects.<p>He should be applauded and welcomed. He has put in the time, improved significantly in 2 years and is on the path away from mediocrity.<p>In the end, many programmers stop learning after Uni or at least outside of formal training. We are, here, part of a pack that practices continuous skill improvement out of love for our craft and it looks like we have a new member.<p>To the author, keep at it mate - great progress!
agf超过 8 年前
I appreciate the lesson trying to be taught here -- don&#x27;t be intimidated by what you don&#x27;t know, develop a plan, and practice -- but I don&#x27;t think the author chose good examples.<p>For the LCM example, the second solution doesn&#x27;t show any understanding of the underlying problem. The point of project Euler is to think about algorithms -- not to take advantage of &quot;batteries included&quot; features of programming language standard libraries.<p>For the duplicate counting problem, while the second answer is shorter, it&#x27;s a bad solution. Just a few of the problems: it calls `split` many times instead of once; `count` can be called directly on a string; `chars` is the right way to get the characters of a string in Ruby; and finally the problem can be solved in 1-2 passes over the data using something like Ruby&#x27;s `Enumerable#group_by` or Python&#x27;s `itertools.groupby` rather than in a number of passes proportional to the length of the data -- O(n) rather than O(n^2).
bshimmin超过 8 年前
What on earth does he mean by saying that &quot;the reduce method [instead of inject] is performance friendly and a more &quot;Ruby way&quot; of doing things&quot;? `reduce` is an alias for `inject`...
评论 #13049859 未加载
sbov超过 8 年前
Problem 2 is underspecified so both answers might be wrong. Should the output on the string &quot;aaaabbbaa&quot; be &quot;a4b3a2&quot; or &quot;a6b3&quot;? Or is that invalid input? I don&#x27;t think you can reasonably answer the problem without an example like this.
评论 #13049960 未加载
xiaoma超过 8 年前
The really scary parts of this are<p>1) The popup at the bottom saying <i>&quot;Sign Up Now to Receive a Free Developer Career Cheat Sheet plus a Free Course to Help Get that First Coding Job! Let&#x27;s make that breakthrough together&quot;</i>.<p>and<p>2) Zero to Launch is on his calendar.<p>The author of this post has paid thousands of dollars to learn how to market and sell a course on how to get a programming job.
Zyst超过 8 年前
Has someone ever said you can&#x27;t improve as a programmer? I might live in a bubble of positivism, but I don&#x27;t think I&#x27;ve ever heard that a programmer can&#x27;t improve.
z3t4超过 8 年前
in another two years you will be back to writing stupidly simple code again. Because it often perform better and is easier to maintain.
natdempk超过 8 年前
Is it just me or is his improved solution a possibly incorrect way to solve the second problem? With his solution &quot;aabbcccaa&quot; compresses to &quot;a4b2c3&quot;, but I would expect that to compress to in &quot;a2b2c3a2&quot;.<p>Am I misunderstanding the problem here? In the context of compression why would it just be about counting letters? Why wouldn&#x27;t you just use a hash of character counts if that is all you care about? Don&#x27;t you want to maintain the form of the string also so you can unpack the original value?
CydeWeys超过 8 年前
I&#x27;ve never used Ruby before, but I learned something interesting when Googling what I thought was a weakness in his preferred solution to the first problem: Apparently, in Ruby, integer types have two internal representations that are flexibly switched between as needed. One representation uses a fixed size (analogous to long&#x2F;int64 in other languages) and the other representation, Bignum, has an arbitrary size (analogous to Java&#x27;s BigDecimal). So the simple (1..n).reduce(:lcm) approach should work for n of arbitrary size, though I don&#x27;t think it&#x27;s the most efficient approach.
kornork超过 8 年前
I&#x27;d love to see more on how he manages his &quot;to learn&quot; pile using Evernote. My current strategy is to let things I want to read live in open browser tabs until my browser crashes. Rinse &amp; repeat.
评论 #13049941 未加载
dri_ft超过 8 年前
I slightly prefer the &#x27;worse&#x27; solution for the second problem, at least in terms of substance, not necessarily style. The trick the &#x27;improved&#x27; version does with uniq seems a little hacky to me, somehow.<p>The first problem has a clear improvement.<p>I just checked ruby doc and &#x27;reduce&#x27; and &#x27;inject&#x27; seem to be synonyms, as far as I can tell.
评论 #13049869 未加载
contravariant超过 8 年前
Of course you can also just find the biggest prime powers and multiply those. This immediately tells you that the smallest number divisible by all of 1,2,...,20 is 2^4·3^2·5·7·11·13·17.<p>This is somewhat more difficult to program, but definitely the more efficient way of doing it.
nickthemagicman超过 8 年前
I think both are ok. The first are more &#x27;pure&#x27; and the logic is cross language.<p>The second are more ruby&#x2F;functional lang specific.<p>I mean, if the tests pass.. amirite?