KBD

Keith Devens .com

Tuesday, December 2, 2008 Flag waving
Ever wish you could freeze frame a moment in your day, and look at it and say "this is not... – Daniel (Mrs. Doubtfire)

Archive: December 30, 2004

← December 29, 2004December 31, 2004 →

Daily link icon Thursday, December 30, 2004

  1. Two good articles from Victor Davis Hanson:

       (0) Tags: [Opinions/Politics]
  2. Economist.com | 100 years of Einstein, via /..

       (0) Tags: [Science]
  3. Harry Fuecks rounds up a whole bunch of stuff about comment spam, via Joseph.

       (0)
  4. Slashdot | Ken Jennings Gets a New Challenge. They're going to have a tournament of past 5-time winners and pit the best two up against Jennings for a pot of $2 mil. 2nd and 3rd place get $500k and $250k respectively. I think it'd be neat if they had a 3-game playoff, and the one with the highest score at the end of three games wins. Though, that might completely change the final Jeopardy strategy. Anyway...

       (0)

Where to put your curly braces

Obviously people are going to disagree, but this weblog gives me a way to gripe about things that annoy me, and damnit, I'm going to use it.

Why oh why do people like to put their curly braces on their own lines? You waste a whole line for one character. For whatever reason I've seen this style used all over the place lately. Its use in this article just pushed me over the edge to where I'm now posting about it, but it was this article on continuations in web apps as well as someone else's code I've been working on that have made me so frustrated. Here's an example from that continuations article:

 1: if (zone=="A")
 2: {
 3:     if (qty >= 100)
 4:     {
 5:         discount=0.1;
 6:     }
 7: }
 8: else if (zone=="B")
 9: {
10:     if (qty >= 200)
11:     {
12:         discount=0.2;
13:     }
14: }

What a waste:

 1: if (zone=="A"){
 2:     if (qty >= 100) discount=0.1;
 3: }else if (zone=="B"){
 4:     if (qty >= 200) discount=0.2;
 5: }

But even if it was a more conventional:

 1: if (zone=="A"){
 2:     if (qty >= 100){
 3:         discount=0.1;
 4:     }
 5: }else if (zone=="B"){
 6:     if (qty >= 200){
 7:         discount=0.2;
 8:     }
 9: }

That's still much better. The less physical space code takes up the easier it is to take in at one glance, and therefore the easier it is to comprehend. It's a shame to waste a precious line for a mere curly brace.

  1. Blue: The Next Orange? Claudia Rosett calls for regime change at the UN. Via Jayson at PoliPundit.

       (0) Tags: [Opinions/Politics]
  2. Gravatar - Globally Recognized Avatar. Really neat idea. If a weblog supports Gravatars you can have your own avatar in comments -- it keys your e-mail address to your avatar.

       (0)
  3. JournURL, via. It's a hosted service that's got a little bit of everything - weblog, wiki, forums. Seems kind of like LiveJournal to me, except with slightly more features and uglier URLs.

       (0)
  4. Photo Matt » Announcing bbPress.

       (0)
← December 29, 2004December 31, 2004 →
December 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 6 posts

Recent comments XML

new⇒Perl 6 1.0 in March?

Doh, my mistake. I'm aware of the​relation between Parrot and Rakudo​but I'...

Keith: Dec 2, 1:03am

Free image hosting sites

Well, TinyPic has this in its​FAQ:

> Images and videos is in​your accoun...

Keith: Dec 1, 1:13am

Join a NameValueCollection into a querystring in C#

Well with a lamba expression, this​is what I came up​with:

?!code:csharp...

Gustaf Lindqvist: Nov 30, 4:38pm

Why no generic OrderedDictionary?

Check​http://www.codeproject.com/KB/recip​es/GenericOrderedDictionary.aspx?d...

Gabrielk: Nov 27, 6:57am

WhatIsMyIP.com

http://www.thesysteminfo.com is​another good alternate to​whatismp.com... I...

Kripz: Nov 26, 8:51pm

Girls, please don't get breast implants

Actually I think it's sweet when a​man loves a woman whether she's big​or n...

218.186.12.228: Nov 26, 9:40am

Generated in about 0.053s.

(Used 7 db queries)

mobile phone