Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops. Juri is also a recognized Google Developer Expert in Web Technologies

Some Usability Thoughts for the Weekend...

2 min read

A couple of days ago I got the order to write a very simple program that would take a bunch of XML input files with the task to elaborate them in terms of grouping them according to some identifier and then to output the result (grouped per directory) in a more user friendly and readable way. While the prog is stupidly simple there are still some potential pitfall one might not realize immediately.

The objective was to give the tool to one of our customers in order to facilitate their work, hence: pay attention to usability factors.
I started with a simple GUI:
So far, nothing special. There is a source folder textbox and a destination folder. They're self-explanatory I guess. What the program should do (for comfortability reasons) is to create the destination folder if it doesn't exist and if it exists already, delete all its content, as it might originate from a previous elaboration.

A naive approach would be to do
if(!Directory.Exists(destinationDir))
{
Directory.CreateDirectory(destinationDir);
}
else
{
//delete all files and directories in destinationDir
}
But attention! What might a "dummy" user do what an "expert" user might not? Probably enter something like this:
Source: C:\sourceFileDirectory
Destination: C:\sourceFileDirectory
Bad: You delete all of the source files.

Or even worse:
Source: C:\sourceFileDirectory
Destination: C:\
Bad: You wipe his C drive :D.

These are exactly the problems that are often overlooked (as they might seem obvious) and which then cause enormous damage. Therefore a possible solution might be..
if(!Directory.Exists(destinationDir))
{
Directory.CreateDirectory(destinationDir);
}
else
{
//create an output directory inside the specified
destinationDir = Path.Combine(destinationDir, "Out");

if(!Directory.Exists(destinationDir))
{
//create it
}
else
{
//Ask the user about wiping the content of the output directory
//Do it if confirmed
}
}
Have a nice weekend :).
Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus