DUX – Developer User Experience

Sometimes, I wonder why things are not simple and expressive.

One thing that I try to advocate for many years is something that I should call DUX – Development User Experience. It means what it should mean : the user experience while you are doing your development.

We know that good software is hard to achieve and that most of the times people care only about what is visible. Crafting all the parts of the code in the right way is also important. The final end user experience is not the only part…

When you build frameworks or lower level components, even if their target is to be used by developers for higher level software, never forget that you still users! Your users are the developers working with your libraries.

Why do I complain? Because DUX is also an important part of the things you should care when you are building libraries. Framework developers usually though about:

  • Try to provide the functions needed for the framework with a defined priority order (maybe defined by marketing guys…)
  • Try to provide as much functions as possible because a richer framework is better than a framework providing a small set of things.
  • Use some unit tests for internal use because most people do.
  • Try to care about performance because a framework should do
  • Try to fit as much as possible in the current ecosystem
  • …certainly a lot of other things

I don’t know if all these things are the main reason I prefer to use open source libraries but in most cases these ones provide a slightly different results when they are realized with a decentralized¬†unordered¬†team:

  • Functions are provided because people really needs them
  • Delivery and functionalities are not subsidiaries of the market
  • You can control functionalities with the unit tests provided and also see how it works (most of the times this is much more efficient than a regular documentation…)

Another good point with open source is that the good and the bad are automatically currated by the community. If your framework doesn’t deserve enough needs, if it is not enough clear about it’s usage and so on, it will die. Simple and efficient.

Frameworks have to be simple and fun to use. The .Net world has a lot of legacy stuff and history that tends to be complicated by essence because it takes its roots in entreprise. Alternatively languages like Ruby have things simple and expressive mostly because it is a developer to developer platform with pragmatism in mind.

Take a simple exemple. Suppose, you are building a shell application. You want to print messages and draw some lines to present things clearly, like this:

 

--------------------------------------------------------------
-- My App (c) 2013
--------------------------------------------------------------

In C# to build lines like this, you should write all the line in a string and print it like that:

Console.WriteLine("--------------------------------------------------------------");

Or with an iteration if you want to get more reusability :

public string Repeat(string pattern, int timesToRepeat)
	{
		string[] resultArray = new string[timesToRepeat];
		string result = pattern;
		for (int i = 1; i < timesToRepeat; i++)
		{
			result = result+pattern;
		}
		return result;
	}
...
Console.WriteLine(Repeat("-",80));

Instead of that, in the ruby world, you just do that:

puts "-" * 80

Which literally means : “put in standard output the string ‘-‘ repeated 80 times. Which one sounds better for you?

Attention: please note that I am a .Net developer, we are just trying to talk about DUX, I am far than saying that Ruby is better than C#, yeap?

Btw, C# is a very high level platform and you have a lot of better things but that’s not the problem here. And In fact you should get more fluent things with a simple extension method like that:

public static string Repeat(this string pattern, int timesToRepeat)
	{
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < timesToRepeat; i++)
		{
			sb.Append(pattern);
		}
		return sb.ToString();
	}
...
Console.WriteLine("-".Repeat(80));

If you want a shortest way to achieve that you should also try:

String.Join("",Enumerable.Repeat("-",80))

 

Never forget that software is complicated by essence, so, don’t help this complication, try to make things clean even if your audience are developers!

Posted in Articles Tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>