Monday, March 08, 2010

Let Me Stack Overflow That For You

I am somewhat active in the Stack Overflow community, and among other things, I find it an very interesting case in behavior, partly due to the reputation system that they've employed. It also makes me worry about the community of software developers that currently exists. Jeff Atwood, one of the creators of the site, famously talked about the 20% Programmers, as referenced in this other post:

There are two "classes" of programmers in the world of software development: I'm going to call them the 20% and the 80%.

The 20% folks are what many would call "alpha" programmers -- the leaders, trailblazers, trendsetters, the kind of folks that places like Google and Fog Creek software are obsessed with hiring. These folks were the first ones to install Linux at home in the 90's; the people who write lisp compilers and learn Haskell on weekends "just for fun"; they actively participate in open source projects; they're always aware of the latest, coolest new trends in programming and tools.

The 80% folks make up the bulk of the software development industry. They're not stupid; they're merely vocational. They went to school, learned just enough Java/C#/C++, then got a job writing internal apps for banks, governments, travel firms, law firms, etc. The world usually never sees their software. They use whatever tools Microsoft hands down to them -- usally VS.NET if they're doing C++, or maybe a GUI IDE like Eclipse or IntelliJ for Java development. They've never used Linux, and aren't very interested in it anyway. Many have never even used version control. If they have, it's only whatever tool shipped in the Microsoft box (like SourceSafe), or some ancient thing handed down to them. They know exactly enough to get their job done, then go home on the weekend and forget about computers.

There is no better demonstration of this than in the Stack Overflow community.  On that site, you have the 80% programmers who ask the most basic, mundane questions, that are easily answered by a simple Google search, and then you have the 20% programmers who are kind enough to Google the answer for them in return for "reputation".  In many cases, no Googling is necessary... we just know the answer.

It's an interesting study in instant feedback and gratification.  It seems that there are a whole host of people who, when faced with the simplest of problems, refuse to do even the most basic searching for an answer. Instead, they head over to Stack Overflow and ask the question.  Odds are that within 30 seconds they'll have a correct answer.  Often times that question has already been asked, and Stack Overflow will even tell you about potential duplicate questions as you are composing it.  But despite this help, people would rather ask their own version of it.

On the one hand, it is a tribute to how useful and well designed the site is. Think about... in 30 seconds, you can have an answer to a question. And yet... in 10 seconds you could have found it yourself. So what did you get in exchange for those 20 extra seconds?  Confidence.  If you really don't know the answer, then a Google search may give you the correct answer in the top couple of hits, but how would you really know? With the community vote system on Stack Overflow, you have a distributed fact checking system at your finger tips.

And yet, when you answer the same basic question over and over again... it really shakes your faith in the programming community. Are there that many programmers out there who don't know the difference between a Static and an Instance method? Are there that many programmers who don't know the difference between and int and a float? What does it say about programmers who would rather have answers spoon fed to them, rather than go out and discover the answer themselves?

I'm all for being helpful. I like to think the answers I've provided on Stack Overflow show that. But at a certain point in time, I wonder if it's really worth helping some of these people.

#    1:38 PM by Nick | No Comments |
 Thursday, October 09, 2008

King of Useless Comments

There is a lot of debate among programmers about the proper way to comment your code.  One type of commenting that is sometimes more difficult, is how to comment code that is related to a bug fix.  We've all encountered the types of comments where the programmer states the obvious:

int i = 0;  // Initialize an integer to 0

But "bug fix comments" can sometimes really be longer than necessary.  Here is a typical example of what I'm talking about:

//######################################################
//#
//# Bug #: 1234
//# Date:  10/2/2006
//# Name:  John Smith
//#
//#######################################################
MethodCallAddedToFixBug();
//#######################################################

This type of commenting drives me nuts for a couple different reasons.  For one, it takes up a huge amount of screen space, which breaks up the flow of the rest of the function, and makes it hard to understand.  Can you imagine if a single method had 3 or 4 of these "bug fixes" in them?

Secondly, for all that space taken up on screen, what information did we get?  We got a name, a date, and a number.  What was the defect?  How did this method call actually fix the defect?  We don't know.  Now, if you feel the need to add a comment when you insert code to fix a bug (and I can be convinced pretty easily that there is value to doing that), why not this?

// JS 10/2/2006 - Added call to fix Bug 1234.  This method includs missing validation logic that was causing exception
MethodAddedToFixBug();
Was that so hard?
#    10:02 PM by Nick | 1 Comment |
 Monday, June 02, 2008

When Good XML Goes Bad

Coding Horror recently went after XML as being a rather poor option for many things.  I generally don't agree with that sentiment, but I do agree with the idea that there is good XML structure and bad.  Here is an example of bad XML structure that is required to use a control library from Janus.  This sample XML snippet is required to define the columns in their grid control:

<Columns Collection="true">
  <Column0 ID="">
    <Caption>Home Term</Caption>
    <EditType>NoEdit</EditType>
    <Position>0</Position>
    <Width>73</Width>
  </Column0>
  <Column1 ID="Column1">
    <Caption>Driver</Caption>
    <EditType>NoEdit</EditType>
    <Key>Column1</Key>
    <Position>1</Position>
  </Column1>
  <!-- ... -->
</Columns>
The controls so far look rather nice, and fairly functional and complete.  At issue here is the use of tag names like "Column0" and "Column1".  A well designed XML structure would just have "Column" tags, and then use some sort of extra identifier... which ironically... they already do!  Yet they require that the tag name matches the identifier.  Definitely not a good use of XML's inherent structure and definition abilities.
#    11:42 AM by Nick | No Comments |
 Thursday, April 24, 2008

My Morning Routine

I hate Internet Explorer 7.0 with a vengeance, but unfortunately due to certain policies at work, I have to use it.  The reason why I hate it may seem trivial, but it just goes to show you how a simple annoyance can eventually upset you to no end.  Internet Explorer refuses, absolutely refuses, to honor "Lock the Toolbars".  You see, I am very anal about what toolbars and strips I have on my screen, and I like to maximize the amount of viewable space for actual browsing.  So I actually try to get as many toolbars scrunched together as I can.  For whatever reason, every morning when I log in and start IE, it reorders my toolbars so that the "Links" bar is below my del.icio.us toolbar, and I have reorder them so they are next to each other.

If for some reason IE crashes on me during the day, and I have to restart it, then I have to do the "move the toolbars" dance all over again.  Why on Earth can't IE actually remember my settings and honor them?!

#    9:37 AM by Nick | 4 Comments |
 Monday, March 17, 2008

I Have a Cube Neighbor...

... that enjoys listening to the radio at a reasonable volume from nine to eleven.

#    1:19 PM by Nick | No Comments |
 Monday, March 10, 2008

But I Need to Get the Dust Out!

I was just walking back to my cubicle, and I heard a banging noise coming from one of the cubes I was walking past.  Being the curious type, I stopped and looked in to see one of the call center supervisors (who shall remain nameless... I'll caller her "J") holding her keyboard upright and banging the edge of it against the desk and then shaking it upside down.

Me:  What are you doing?
J:  I'm cleaning my keyboard.
Me:  You could damage your keyboard by doing that you know.
J:  No I can't.  I do this all the time and it still works.  Besides, how else am I supposed to do it?
Me:  They have little vacuum cleaners you can use, or a can of compressed air.
J:  I'm not paying money for a stupid can of air when I can just do this.
Me:  I'm telling you, that's like cleaning your car by crashing into a light post to shake the dirt off.
J:  Oh Nick, stop exaggerating.

These are the people we design computers and software for.  Always remember that.

#    12:10 PM by Nick | No Comments |

The TSA Should Be Required to Read Slashdot

After all, if they're going to be the arbiters of who can and cannot board a plan based on the technology you carry, they should be up to date on what the latest technology is.  Here's the story of someone who missed their flight because the TSA didn't believe that a Mac Book Air was a real laptop:

Only... today, something is different. Instead of my bags trundling through the x-ray machine, she stops the belt.  Calls over another agent, a palaver. Another agent flocks to the screen. A gabble, a conference, some consternation.

They pull my laptop, my new laptop making its first trip with me, out of the flow of bags. One takes me aside to a partitioned cubicle. Another of the endless supply of TSA agents takes the rest of my bags to a different cubicle. No yellow brick road here, just a pair of yellow painted feet on the floor, and my flight is boarding. I am made to understand that I should stand and wait.  My laptop is on the table in front of me, just beyond reach, like I am waiting to collect my personal effects after being paroled.

I'm standing, watching my laptop on the table, listening to security clucking just behind me. "There's no drive," one says. "And no ports on the back. It has a couple of lines where the drive should be," she continues.

Your tax dollars at work.  Via Engadget.

#    9:06 AM by Nick | No Comments |
 Monday, February 11, 2008

Yahoo! The Bid Was Rejected!

Count me among those who was absolutely terrified that Microsoft was going to buy out Yahoo!  Also count me as one of the ones who is breathing a sigh of relief at the news that Yahoo rejected the offer, for now.  Actually, I was a little nervous when Yahoo bought Flickr, and also del.icio.us, but as it tuns out, those fears were unfounded.  Flickr has changed very minimally, and del.icio.us hasn't changed at all.  In fact, both services have have changed so little as far as integration with Yahoo (Flickr only changed their login) that I really have to wonder why Yahoo bothered at all.  My only explanation is that Yahoo did it to prevent Google from buying either service.  Google had bought Picasa, which I found to be a very strange purchase, since at the time, Picasa didn't have a web presence.  Google also didn't have a bookmarking service.  Google ended up having to build Picasa's web album infrastructure, and they built their own bookmarking infrastructure.  Neither of which have taken off like Flickr and del.icio.us.  Windows Live services have tanked as well.

But where Yahoo was smart and left those services alone to excel as they had prior the purchase, I have absolutely no faith in Microsoft to do the same.  Flickr will first get wrapped up in Windows Live ID, and then have their content pulled in with Windows Live as fast as humanly possible.  They will also replace the very capable Flash engine with Silverlight.  Just wait and see.  I have no idea what would happen to del.icio.us.  They'd probably port all your bookmarks to Windows Live and then close up that shop.

Anyone disagree?

#    9:27 AM by Nick | No Comments |
 Friday, June 15, 2007

Web 2.0 People!

Yesterday at work I was trying to scan around MSDN at some documentation on Excel automation, and it was super slow.  It was really bugging the hell out of me.

Me:  Man... MSDN is slow today.

Coworker:  Actually, I'm trying to browse somewhere else and it's just crawling.

Me:  Don't we have dual T1's coming in here?

Coworker:  Yeah, I don't get it.

Then a few minutes later it all began to make sense.  A high priority email came in from one of our other offices, sent to the majority of the company (just shy of the "Everyone" list) that had a 6 MB WMV file.  It was a clip from a news broadcast talking about Microsoft Surface.

Who sends video files as email attachments to an entire company any more?!  Have you not heard of Google Video, YouTube, or the many other video sharing websites in existance?  Send a link to a YouTube video... it will take up a lot less bandwidth.  And who sends it as a high priority email to boot?!

Web 2.0 people... learn it... live it... love it.  And here is one video that demonstrates Surface... from YouTube of course.

#    8:18 AM by Nick | No Comments |
 Tuesday, June 12, 2007

Annoying Outlook Bug

My new laptop for work is a really nice Dell.  In fact, it's the same Dell laptop I bought for myself a few months ago, except it doesn't have some of the extra features I got like Bluetooth and the nicer screen.  Anyway, we use Exchange here and I have Outlook 2007 installed.  However, whenever someone sent me a meeting request, even if they set it up as one time, it was always showing up as recurring.  After some searching, I found the following on Google Groups.  The suggestion was to look in Add/Remove Programs and find the following item:

Sure enough... I looked and there it was.  If you uninstall that, the problem goes away.  I also noticed that uninstalling this program makes Outlook load a lot faster than before.  Previously it seemed like my entire machine was hanging for about 1 minute after Outlook started.  The poster in the forum made it sound like this was something Dell installs by default.

What the heck could be the purpose for this program?!

#    1:44 PM by Nick | No Comments |
 Monday, May 07, 2007

Make It Stop!!!

The floor where I sit at work is shared between developers, and call center personnel.  In an effort to drown out the call center from the developers, and likewise drown out the developers to the call center folks, they recently installed white noise generators in the ceiling.  Today it sounds like they turned up the volume.

It's driving me insane!  It's like having a television over your head where you only hear the snow coming through because the cable is out.  I'd rather listen to the call center people (which I can still actually hear somewhat).  They've simply replaced one type of noise with another.  Except this noise is much more distracting, and it feels like its burrowing deep into my subconscious.

I can't work.  I can't concentrate.  I'm getting a headache.  I've already yelled at someone this morning.

I think I've finally discovered what causes people to go postal at work.

Update:  I've just been informed that the volume increasing is by design, and that they're going to bump it up again next week.  They're supposedly doing this incrementally so that we get used to it gradually.  I already can't work... I can't imagine how much worse it will be next week.

I was feeling kind of depressed at work last week (when the volume was lower), and couldn't put my finger on it.  I feel worse today... and this has to be the reason.  I'm also definitely more on edge and moody too.  I am seriously kicking myself for forgetting my MP3 player.  But you know, sometimes when I work, music can be distracting.  But now my choices are going to be distracting music, or painful white noise.  What kind of choice is that?  Why would a company purposefully do this to it's employees?!

Update II:  After a round of complaints by everyone, they've turned the volume back down to the same level as it was last week.  So now the headache is much more mild, and at least I can concentrate again.  Of course, I can still hear the call center folks on the other side of the hall, which begs the question... why bother with the white noise at all?  If the volume has to be at annoyingly high levels to drown out the call center, then what's the point?

#    4:32 AM by Nick | 2 Comments |
 Thursday, March 22, 2007

Why Case Insensitivity Blows

I ran into this problem at work today, which reminded me why case insensitive languages (like Visual Basic) suck.  Or if you prefer, I found a bug in a Microsoft tool.  I was using xsd.exe to generate a type safe class for an XML schema that I received from a company we do business with.  Instead of reproducing all the schema and code here, I'll boil it down to the simplest code which still reproduces the problem.  Let's say you have an XML schema that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Node">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="VALUE" type="xs:string" use="required" />
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

And here is an XML fragment which will obey this schema:

<?xml version="1.0" encoding="utf-8" ?>
<Root>
  <Node VALUE="Hello">World</Node>
</Root>

Pretty simple so far, right?  If you save that schema off as XmlDoc.xsd, and then run xsd against it using the following command line options:

xsd XmlDoc.xsd /c /f /l:VB

You will get the following class definition as output:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.42
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System.Xml.Serialization

'
'This source code was auto-generated by xsd, Version=2.0.50727.42.
'

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42"),  _
 System.SerializableAttribute(),  _
 System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true),  _
 System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=false)>  _
Partial Public Class Root
    
    '''<remarks/>
    Public Node As RootNode
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42"),  _
 System.SerializableAttribute(),  _
 System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true)>  _
Partial Public Class RootNode
    
    '''<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()>  _
    Public VALUE As String
    
    '''<remarks/>
    <System.Xml.Serialization.XmlTextAttribute()>  _
    Public Value As String
End Class

What you'll notice is that that RootNode class has two fields named Value.  One of them is upper case (as it was in the schema declaration), and the other is Pascal case.  This second one is marked with the XmlTextAttribute, meaning that it is the property which represents the Element Text value (in my sample XML document it would be equal to "World" while VALUE would equal "Hello").

If we were doing this in C#, all would be fine and dandy since it's case sensitve.  However, with Visual Basic, this generates a compiler error.  In the case of my 1300 line schema file at work, I had to modify 42 different fields that met this pattern.  And because I had to hand modify an auto-generated file, there is no way that I can automate this generation as part of a build process... which sucks if the schema ever changes.

Wouldn't it be nice if xsd.exe were actually smart enough to verify that there was no name collision with the Value field before it used it, and chose an alternate name... or perhaps had a command line argument were you could provide a name to override the default?

#    7:54 PM by Nick | 4 Comments |
 Friday, February 23, 2007

If a Programmer Screams in a Construction Site...

... and the pile driving is so loud that nobody can hear it, is he still frustrated?

#    9:28 AM by Nick | No Comments |
 Friday, December 29, 2006

Spreading the Word

It all started with Jeff Atwood, and then I saw another one from Omar Shahine, so I'll add my own to the mix.  Instead of talking about simplifying the login process, or going to a .com site faster, I'm going to talk about opening up Windows Explorer.  Hopefully Jeff won't take offense to stealing this format, and helping to start a dreaded blog meme.

Every computer with Windows has Windows Explorer, that everyone has to use to manage their files.  It's pretty much unavoidable that you'll have to use it most every day.

As much as we see Windows Explorer every day, you'd think we would have mastered it by now. Unfortunately, we haven't. Here's what I've observed users doing, over and over again:

  1. Click the mouse on the Start button.
  2. Click the mouse on Program Files.
  3. Click the mouse on Accessories.
  4. Click the mouse on Windows Explorer.

Every time I watch someone do this, a little part of me dies inside. And I see it all the time*.

I'm not just talking about casual users like our parents. I'm talking about our fellow software developers, and other users who work with the computer for most of the day. People who really should know better.

What kills me about this is all the needless, painful mouse clicks. You've needlessly clicked your mouse and waited for menus millions of times-- just add a little Windows Logo+E to the mix! I'm no keyboard Nazi. All I want is to save users a few precious seconds of their day as they slog through their computer files during their work day. And it's so darn easy:

  1. Press the Windows Logo button + E

See? Wasn't that nice? Now it's your turn to play Keyboard Appleseed and spread the word so your fellow coworkers can spend less time opening programs - and more time getting actual work done.

* A variation I also see is when people right click on the Start button and click Explore from the context menu.  Although it's fewer mouse clicks, it needlessly takes you deep into your directory structure where your Start menu shortcuts are stored, and so is also a waste of time.

#    9:45 AM by Nick | 1 Comment |
 Wednesday, November 22, 2006

I Think Not

C|Net has compiled a list of the top 10 Geek Girls.  Among those on the list are Ada Byron (the world's first programmer) and Grace Hopper (who found the first computer 'bug').  Also on the list is Paris Hilton, apparently because her fetish for pink electronic goodies, and slutty ways, make it irresistible.  Talk about an insult to women everywhere.  You couldn't find an actual female geek to put on that list to round out your top 10?

She's not an actress (despite being on TV), not a singer (despite putting out a record), and definitely not a geek.  She's a tramp... and #1 on that list.  Oh yeah, Lisa Simpson made the list too.

#    10:46 AM by Nick | 1 Comment |
 Tuesday, September 19, 2006

Reason #1 Why I Still Use MP3

I am very proud of the fact that I do not have a single piece of DRM protected music on my computer.  Period.  I want to own my music, and be sure that if I buy a new device, it will play said music.  Period.  Here is a perfect example of why I do this:

In yesterday's announcement of the new Zune media player and Zune Marketplace, Microsoft (and many press reports) glossed over a remarkable misfeature that should demonstrate once and for all how DRM and the DMCA harm legitimate customers.

Microsoft's Zune will not play protected Windows Media Audio and Video purchased or "rented" from Napster 2.0, Rhapsody, Yahoo! Unlimited, Movielink, Cinemanow, or any other online media service. That's right -- the media that Microsoft promised would Play For Sure doesn't even play on Microsoft's own device. Buried in footnote 4 of its press release, Microsoft clearly states that "Zune software can import audio files in unprotected WMA, MP3, AAC; photos in JPEG; and videos in WMV, MPEG-4, H.264" -- protected WMA and WMV (not to mention iTunes DRMed AAC) are conspicuously absent.

That's right.  Microsoft's own player won't even play music that has been protected by the DRM format they pushed.  From a business perspective, this is just stupid.  Microsoft has actually had a very strong history of backwards compatibility.  Windows is a great example of this commitment.  Why they're screwing their customers now, for really no good reason, is a complete mystery.

But more to the point... my faith in the MP3 format is once again justified.  Via Slashdot.

#    9:51 AM by Nick | No Comments |
 Friday, June 23, 2006

Regular Expressions are Evil

As I'm prone to do from time to time... here is another programming rant.  One of the books on my shelf at work is Mastering Regular Expressions from O'Reilly.  It's a very good book on the topic, and if you're interested in learning regular expressions, I highly recommend it.  Recently a coworker came into my cube, noticed the book and said "Wow, you have a regular expressions book.  I really want to learn about them, because they look so great!"  Her voice was filled with excitement.  I had to say it, but felt bad when I killed that excitement by saying, "They're not.  They're evil.  They should be used as little as possible."

Regular Expressions are very versatile, very powerful, and can do an amazing number of functions, and if I had my way, I'd never use them.  From my experience in industry, the programmer who generally likes regular expressions is also the type of programmer who never comments their code.  They're also the type of programmer who tries to combine as many operations as possible into one statement.  They like compact.  Compact looks cool... but compact can't be understood easily.

The reason why I think regular expressions are evil is because, unless you are a true regular expressions expert (and few really exist), you can't look at a regular expression and quickly say what it does.  It's this weird black box of strange characters strung together that's difficult to interpret.  It probably works, and it probably does the job very well.  But when you come back to that section of code in 3 months, will you be able to say what it does?  Will someone else who didn't write that expression be able to come in tomorrow and know what it does quickly?  Or will they have to spend an hour parsing through it in order to determine its purpose?

I do use regular expressions sparingly... but I comment the hell out of them.  I tend to use 3 times the number of comment lines when I embed regular expressions than normal code.  You have to if you want to know what you did a month later.  I say regular expressions are evil, because my goal is to always write code that someone can come in and look at, and know what it does without having to tear their hair out.

I don't always succeed in that goal, but at least I try.

#    10:49 AM by Nick | No Comments |