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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Can we become better programmers through studying code?

5 点作者 jakubholynet将近 12 年前
To help myself and others understand better the qualities of good code and deficiencies of a bad one, I have started a new blog called Wonders of Code. The question is, is this something that can trully help us improve our understanding and thus skills?<p>The idea is to take a piece of code, point out some noteworthy improvement opportunities - preferably in relation to the general principles of clean code, such as DRY, SRP, readability etc. - and rewrite it in a (presumbely) better way and explain the new qualities.<p>You might want to check out some of the 3+1 code studies already published at WoC to see what I mean: http://wondersofcode.wordpress.com/.<p>I have two questions:<p>1) Is this something worth doing, something that can really help us - and especially the juniors among us - become better programmers faster? 2) Do you have any tips and ideas for how to make it better and more effective?<p>Thank you!

5 条评论

ragatskynet将近 12 年前
Looking at other people's code (and I mean more experienced programmers of course) always helped me to learn best-practices, patterns, etc. Also if you does not understand something (why is it there? why is it written that way?) it is very good to ask the guy who wrote it down about his purpose - maybe both of you can learn from these situations.<p>Also this kind of "learning" is very useful in the future - you can understand other people's code faster or recognize problems by looking at the code.<p>I think your idea is worth doing and I would encourage you to keep working on it; I am sure I will recommend it to my friends too.
Sealy将近 12 年前
I would always encourage any form of education, coding included.<p>The way I learned how to code was to play with pre-written pieces of code myself.<p>1. I would say to myself... I want to see if I can write a loop to print out a message.<p>2. Then I would go and google for the code.<p>3. Copy and paste it into my own file, and change it to do what I want.<p>I'm willing to bet that most of the hackers on HN learned how to code this way. That's why we call ourselves hackers right?<p>I guess this is similar to your approach but in a more controlled environment?
评论 #5749640 未加载
bjoerns将近 12 年前
hi Jakub, definitely worth doing. In terms of making your blog more efficient, how about putting the code examples side by side (looking at your Python/MongoDB API snippets)? I know it's visually probably a bit harder but I guess it makes pros and cons etc more obvious. Just my two cents...
评论 #5749627 未加载
joelmaat将近 12 年前
Of course. I do this all the time. Even a passive perusal of good code makes you better.
w_t_payne将近 12 年前
Yes, I think that this is definitely something worth doing.