Joel Liu's Library tagged → View Popular, Search in Google
Jan
4
2012
Jan
2
2012
-
"This guy’s code sucks!" It’s something we’ve all said or thought when we run into code we don’t like. Sometimes it’s because it’s buggy, sometimes it’s because it conforms to a style we don’t like, and sometimes it’s because it just feels wrong. Recently I found myself thinking this, and automatically jumping to the conclusion that the developer who wrote it was a novice. The code had a distinct property that I dislike: lots of nesting. But the more I think about it, the more I realized that it’s not really something I’ve heard discussed much.
-
I argue that this is bad code. Every added level of nesting is another piece of context that your brain has to keep track of. Each nested block is one you have to line up by eye to see what conditional it lines up with (even if your editor helps at this with visuals, it doesn’t remove the issue entirely.) And this is just a straightforward example where we just return the user at the end, let’s take a look at an example that does something more complicated:
Nov
16
2010
Oct
29
2010
Selected Tags
Related Tags
Top Contributors
Groups interested in html5
Related Lists on Diigo
-
Interoperability and The Quest For A Universal File Format
Bookmarked pages related to ...
Items: 12 | Visits: 242
Created by: Gary Edwards
-
webdesignデザイン集め
デザインまとめサイト
Items: 27 | Visits: 23
Created by: izumi shogo
-
HTML + CSS
HTML and CSS links and tutor...
Items: 144 | Visits: 13
Created by: Cameron Morgan
Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »
Join Diigo
