tag:blogger.com,1999:blog-4445269723137820164.post-88323299875025668942008-01-31T11:09:00.000-08:002008-01-31T11:03:49.744-08:002008-01-31T11:03:49.744-08:00Would you miss Usability if it weren't there?<div style="text-align: justify;">I've firmly believed that developers have as much to do with user experience as designers and functional analysts or product managers - if not more. Look at the checkbox in the screen that says "Erase after Importing".<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_R8-Af9qmXmg/R5Z_hzPyM6I/AAAAAAAAADs/vbgVwtaiPC4/s1600-h/chkbox.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_R8-Af9qmXmg/R5Z_hzPyM6I/AAAAAAAAADs/vbgVwtaiPC4/s320/chkbox.JPG" alt="" id="BLOGGER_PHOTO_ID_5158450641868305314" border="0" /></a>Thanks to the way it is implemented, you can check/uncheck it anytime during the import process, any number of times. It just picks up the last state of the checkbox after import is done.<br /><br />Obvious, you may say. But let's look under the hood to understand how this could have got killed.<br /><br />The right way to implement this is (don't read too much into the syntax, this is just to illustrate the example):<br /><br /><span style="font-family:courier new;"></span><span style="font-family:courier new;"></span><blockquote><span style="font-family:courier new;">for (int index: items) //for each item</span><span style="font-family:courier new;">{</span><br /><span style="font-family:courier new;"> import(index); //do whatever it needs to import</span><br /><span style="font-family:courier new;">}</span><br /><span style="font-family:courier new;">boolean eraseOnImport = chkErase.getValue();// read the checkbox state</span><br /><br /><span style="font-family:courier new;">if(eraseOnImport){</span><br /><span style="font-family:courier new;"> for (int index: items) //for each item</span><br /><span style="font-family:courier new;"> {</span><br /><span style="font-family:courier new;"> delete(index); </span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;">}</span><br /><br /></blockquote>A developer could at the code above and say - Whoops! 2 for loops iterating over the same list is suboptimal - so rewrite it as:<br /><br /><span style="font-family:courier new;"></span><div style="text-align: left;"><blockquote><span style="font-family:courier new;">boolean eraseOnImport = chkErase.getValue();// read the checkbox state</span><br /><span style="font-family:courier new;"> for (int index: items) //for each item</span><br /><span style="font-family:courier new;"> {</span><br /><span style="font-family:courier new;"> import(index);</span><br /><span style="font-family:courier new;"> if(eraseOnImport){</span><br /><span style="font-family:courier new;"> delete(index);</span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;"> }</span><br /></blockquote></div><br />Less lines of code, less variables used, less memory consumed, less processing time.<br />Two birds, one stone.<br />All valid code optimization techniques.<br />Wonderful.<br />But as a feature, this would mean - the first state of the checkbox gets read. You cannot change your mind once the import starts.<br /><br /><br />The lack of the flexibility doesn't make the feature less usable, but its presence pushes the usability up by a notch.<br /><br />It is small things like these that constitute the difference between Customer Satisfaction and Customer Delight, don't you think?<br /><br /><br /><img src="file:///C:/Users/Sowmya/AppData/Local/Temp/moz-screenshot.jpg" alt="" /></div>Sowmya Karmalihttp://www.blogger.com/profile/09200953962645166407noreply@blogger.com