News for hackers. Stuff that matters.
Re:One Sure-Fire Way to Improve Your Coding by j_baker on Thursday May 27, 2010 @11:56AM (#1384012)
I don't recommend reading code for an exercise (at least not by itself). I do recommend modifying code as an exercise though. There are lots of pieces of code that are deceptively complex: they look simple, but come to a grinding halt when you make the slightest change. Thus, it's important to know that there's a difference between what code is doing and what it looks like it's doing.

This teaches a few things:

1. How to read code

2. How to write code

3. How not to write code. When you encounter the grinding halt effect I mentioned above, there's a good chance that's how not to write code (but maybe not, some code is naturally tricky).

Re:One Sure-Fire Way to Improve Your Coding by sant0sk1 on Thursday May 27, 2010 @12:33PM (#1384154)
Good point. In the article I also point out that you should not be reading code passively. You should be running the tests, executing the code, breaking stuff, and trying to fix it.
Re:One Sure-Fire Way to Improve Your Coding by j_baker on Thursday May 27, 2010 @01:32PM (#1384343)
I noticed that. Perhaps my point is more of a semantic one. It still seems to me that the article seems to focus more on the reading than the modifying though.
Re:One Sure-Fire Way to Improve Your Coding by dhimes on Thursday May 27, 2010 @04:24PM (#1384847)
This is also a great exercise to improve your writing of prose, if anybody is interested. Take a well-written couple of paragraphs (Hemingway, etc.), and try to write it better. It's a short exercise that teaches you the importance of the subtleties of style.
Re:One Sure-Fire Way to Improve Your Coding by lanstein on Thursday May 27, 2010 @02:18PM (#1384492)
That reminds me of a line of code I wrote the other day:

  $result->RetrieveResult->DynamicEntity = clone $result->RetrieveResult->DynamicEntity;
it's to get around a PHP bug where the SoapClient returns a half-baked object. At least I preceded it with a comment.
Re:One Sure-Fire Way to Improve Your Coding by Hates_ on Thursday May 27, 2010 @10:35AM (#1383705)
Someone should make a site where user's share pieces of code and explain why it's awesome. Allow people to comment etc. I want to read more code, but don't have to time to go find it.
Re:One Sure-Fire Way to Improve Your Coding by aarongough on Thursday May 27, 2010 @02:40PM (#1384552)
I started work on it straight after I read your comment... With some luck I should have a minimal version finished by this afternoon. I'll post a link here as a response!
Re:One Sure-Fire Way to Improve Your Coding by inerte on Thursday May 27, 2010 @07:56PM (#1385272)
I thought about doing this project in the past and I really wanted something on the opposite side of Daily WTF (the code, not the stories).

I remember reading about Quake's inverse square root ( http://betterexplained.com/articles/understanding-quakes-fas... ) and how a website should be dedicated to beautiful code.

I've never got into thinking what features the site should or should not have, for example: comments? forum-like interface? code-wiki so people can improve the submission? user submitted code? editor reviewed, crowd votting? tags to classify code? tales of adoption in production?

Re:One Sure-Fire Way to Improve Your Coding by aarongough on Friday May 28, 2010 @12:06AM (#1385668)
So far I'v got threaded comments, rating of code and comments, flagging, GitHub integration and a very ugly layout :-p

The actual functional side of the code is almost done. I'll be starting work on graphic design/layout in the next hour or so.

I'd be interested to hear feature requests...

Re:One Sure-Fire Way to Improve Your Coding by mistermann on Saturday May 29, 2010 @12:39AM (#1388365)
This will be a brilliant site if you can pull it off nicely, keep on it!
Re:One Sure-Fire Way to Improve Your Coding by there on Thursday May 27, 2010 @10:51AM (#1383770)
so, the opposite of http://refactormycode.com/
Re:One Sure-Fire Way to Improve Your Coding by jcooney on Thursday May 27, 2010 @08:47PM (#1385358)
Two of my friends are working on a "am I hot or not" for code that (AFAIK) has features like this. The url is http://codesmackdown.com/ but there is nothing there yet. Hopefully me posting this on-line will get them to get off their ass and release something.
Re:One Sure-Fire Way to Improve Your Coding by LeonB on Thursday May 27, 2010 @11:19PM (#1385605)
Yeh, myself and another guy are writing a 'codesmackdown' site (source code here: http://bitbucket.org/OJ/codesmackdown ) as a side-project, not as a money-maker, entirely for fun. Life keeps getting in the way though.

So far the only good thing to come out of this project is that I wrote a cheatsheet for mercurial, as I'm a noob and keen to help other noobs ;-) http://www.secretgeek.net/mercurial_flow.asp

Re:One Sure-Fire Way to Improve Your Coding by gnubardt on Thursday May 27, 2010 @04:50PM (#1384912)
Sounds like Beautiful Code (http://oreilly.com/catalog/9780596510046).

Maybe if a user's submission becomes well liked they could be asked to write a more in-depth explanation or article.

Re:One Sure-Fire Way to Improve Your Coding by lawn on Thursday May 27, 2010 @10:58AM (#1383804)
Ah I would love that. Opportunity for a startup maybe?
Re:One Sure-Fire Way to Improve Your Coding by naa42 on Sunday May 30, 2010 @04:22PM (#1391058)
Re:One Sure-Fire Way to Improve Your Coding by tseabrooks on Thursday May 27, 2010 @10:56AM (#1383801)
Completely agree. In fact one of the biggest problems our office has with new hires fresh out of college, many of which are really bright kids, is that they haven't read enough BIG pieces of code.

When working alone it might not matter but when working in a team of 50 coders on a million line code base that goes across 5 continents and 10 different hardware platforms... Being able to consume and understand large chunks of code and how they fit together is essential. Personally, for any young programmers I'd suggest you practice reading and understanding large software modules... example: some big, active, corner of the linux kernel. (I'm a C / C++ systems developer so I'm biased).

Re:One Sure-Fire Way to Improve Your Coding by benatkin on Thursday May 27, 2010 @09:57PM (#1385461)
These types of productivity articles have been an excuse for me to keep spending too much time on HN. The thing is, I already know most of what's in the articles, but I'm not doing such a great job of executing them. Freeing up time by spending less time on HN could help. So, perhaps finding these articles the way I do is a net productivity loss.

Of the articles I've read on the topic, though, I think this is a really good one. I like the point about seeing how something you really like is built. I think this must be how people get started with Cappuccino. It's weird, but it does some really neat things. The same could be said of Cassandra.

Edit: I just realized this comment reads like a Yelp review. It starts completely off topic, and gradually gets on topic. Please forgive me. :)

Re:One Sure-Fire Way to Improve Your Coding by sant0sk1 on Thursday May 27, 2010 @11:01AM (#1383818)
Read any good code lately? I'd love some recommendations.
Re:One Sure-Fire Way to Improve Your Coding by tseabrooks on Thursday May 27, 2010 @11:59AM (#1384027)
For a mind boggling good time (If you can have that in C) take a look aftr.c. This is Comcast's open source ipv4 -> ipv6 routing code. I'm not saying it's pretty... but if your interest lay in C and systems level bit twiddling it's 13000 lines of good times.
Re:One Sure-Fire Way to Improve Your Coding by jcl on Thursday May 27, 2010 @03:17PM (#1384647)
Some recommendations from an HN article a month ago: http://news.ycombinator.com/item?id=1279087
Re:One Sure-Fire Way to Improve Your Coding by jsyedidia on Thursday May 27, 2010 @12:51PM (#1384211)
The Stanford GraphBase, written by Donald Knuth.
Re:One Sure-Fire Way to Improve Your Coding by jafl5272 on Thursday May 27, 2010 @08:20PM (#1385307)
I learned programming on the Apple ][+ by typing in programs and then modifying them. Nothing forces you to read the code better than being forced to type it in!
Re:One Sure-Fire Way to Improve Your Coding by TrevorBurnham on Thursday May 27, 2010 @11:15AM (#1383862)
Reading code on a computer can be tedious, and only a few relics like TeX are available in print. Fortunately, two recent innovations make reading recent code much more pleasant: Github and the iPad. Try it some time.
Re:One Sure-Fire Way to Improve Your Coding by RyanMcGreal on Thursday May 27, 2010 @12:20PM (#1384105)
This piece makes a similar argument with a helpful example:

http://factore.ca/on-the-floor/29-going-to-the-source-of-ope...

Re:One Sure-Fire Way to Improve Your Coding by Pistos2 on Friday May 28, 2010 @09:39PM (#1388178)
> First, note the file structure. This step is aided by an editor that has a folder hierarchy view

http://mama.indstate.edu/users/ice/tree/