Monthly Archives: January 2012

Per Project Settings or How to have different naming styles for my test project

 

One nitpick that I myself and many have had with ReSharper is not being able to have different naming styles for types based on different projects. In my code I normally name classes using CamelCase

 

image

 

and in my test project I use all_lowercase

 

image

 

Unless you add all_lowercase as a valid naming style, you’ll always end up with those squiggly lines under all your tests. And let’s admit it, it’s not a big deal but it’s annoying. #FirstWorldProblem

 

Say hello to my little layer

With ReSharper 6.1 we introduced the concepts of layers, which open up many new possibilities, including sharing settings on DropBox and or setting company wide standards. What you might not know is that it allows Per Project Settings too! No big deal if you didn’t know, since we currently do not support it via the User Interface so it would be hard to figure it out. However it’s pretty simple to do and I’m going to show you how.

 

Our goal here is to allow all_lowercase settings for classes in our test project (Tests) and not permit the same in other projects (Project). This is the sample project layout we’re going to be working with

 

image

To make this happen, we need to create specific settings for the Tests project and allow the possibility of classes being all_lowercase. That is, the Tests project needs its own DotSettings file.

 

Since there’s no specific button or option to add Per Project settings in the UI, this is where we need to kind of use a workaround. We need to have a Settings file for the project and then edit the options and save it to this file. There are many ways to create this new settings files. We can copy the solution one and rename it, we can export the current settings, we can mount a new layer and have ReSharper create it for us, etc.

We’re going to use this last method. Why? Because since ReSharper mounts it when it creates the file, it will allow us to edit the settings too.

 

 

1. With the Solution open, click on Manage Options under ReSharper

 

2. Under This Computer, click on the Add Layer icon (on the right) and select Create Settings File

 

image

 

 

3. Save the file to the Tests project folder, in our case that would be under SolutionDir\Tests and name it (and here’s the important part) Tests.csproj.DotSettings. That is, it should be named with the ProjectName, followed by csproj or vbproj based on the type of project and with the extension DotSettings.

 

4. Now that we have the settings file mounted, we need to change the required settings, which in our case is to allow classes to have all_lowercase (this obviously works for other settings too). As such, double-click the recently mounted file or right click and click on Edit

 

image

 

5. The Options dialog comes up. We want to edit the naming styles

 

image

 

Modify any other settings you wish at this point and once done, hit Save on the Options dialog.

 

image

 

At this point, we can remove the mounted settings as its not required for it to actually work. We can also leave it in order to easily access the settings for the project in the future. If you do leave it, make sure you uncheck the checkbox so that settings are not applied to the entire solution.

 

[Recommendation: If you decide to leave the settings mounted, mount these under Solution Shared or Solution Personal as opposed to This Computer so that you don’t end up with a long list of different settings files]

 

 

As soon as we hit Save, the new settings automatically are picked up by ReSharper and take effect. We can now see that the naming style no longer appears incorrect under the Tests project

 

image

 

and if we try and use the same style in the actual Project we do get the warning

 

image

 

The UI will come

Once you do this once, you can pretty much copy the same file over to your different projects and rename it to match the project name. In one of the next versions of ReSharper we will provide a more intuitive UI (or should we say we’ll provide an actual UI) for this. For now however, I think this minor hack will make a few people happy!

The tangibility syndrome

 

I was reading a post by Phil Haack about Recognition Compensation which was somewhat in reference to recent news over MVP renewals. I feel there’s no further comments required on all the rewards and compensations surrounding this and other programs. This post is not about that, but about something he mentioned, something I’ve come across quite often:

 

The other reason folks want an MVP is to have access to the professional tools. Most companies will easily shell out the money for this, but if you’re a hobbyist or open source developer, it’s a lot of money to shell out.

 

First of all, let me make it very clear that this has nothing to do with OSS. Let me also state that at JetBrains we fully support Open Source Development, and we do this in many ways. Some of our tools are fully Open Source, others have OSS Community Editions. We also provide free licenses to OSS projects of pretty much all of our tools, as well as collaborate with the folks at Codebetter to offer free Continuous Integration and Issue Tracking software for all Open Source Projects (in fact, TeamCity and YouTrack are even provided for free for smaller teams). In addition to this, many of us at JetBrains spend quite a bit of our time working on OSS projects.

These are policies that I identify myself with and that’s why I’m very happy to be part of such a great company. Having said that, let’s move on…

Hobbies cost money

This morning I tweeted:image

Collin’s Dictionary defines Hobby as:

image

In our context, it’s an activity pursued in spare time for pleasure or relaxation.

It’s what people do to switch off. It’s what they do to get away from their daily job. It’s what they do to relax. Stamp Collecting, Photography, Painting, Knitting, Astronomy, Playing a Guitar are examples of hobbies.

Many of these hobbies cost money. Some of these are one-time investments, others have ongoing costs. Photography requires a good camera. Painting requires a constant stock-up. Things which would seem like an upfront only investment also turn out not to be. You buy yourself an electric guitar. Once you learn to play it half-decent, you want a better sounding amp. Next you need a few pedals and ultimately want a better guitar.

how is development as a hobby different?

My main hobby (after stumbling with a guitar) is learning new programming languages, frameworks and stepping outside of my comfort zone. It might be sad that I have little interests outside of my profession, but I find it somewhat fortunate because it means that I love what I do so much that if I weren’t doing it, I’d be doing it, if that makes sense.

I’m also fortunate that my hobby contributes to my career. Of course, I don’t get to play my guitar as much as I’d like to, but I do get to learn new ways of doing things that broaden my horizons. As such, I invest in my hobby, be it with books, software tools, hardware and whatever else I need. And I don’t look at it as a ROI because that’s not what a hobby is about. It’s not about how much bang you get for your buck.

Whatever the hobby, be it playing a guitar or collecting stamps, people have little problem with spending money on it. Yet why do we draw the line when it comes to software?

I do this as a hobby, why should I pay?

 

Is it because software is not tangible?

We see this outside of developer and hobbyist circles too. People will spend thousands of euros on a MacBook Pro, but then look for free password keepers instead of paying $70 to buy 1Password. They’ll use free alternatives even if they’re half as good as a paid one. And of course, in countries like Spain, where we’re ranked as second highest in software piracy in Europe, it’s just downloaded off of some torrent site.

We, developers, of all people, the ones that charge money to write or aid in writing end-user software, should be the first to know that the value of software is not measured by how much it weights or what it feels like. If we understand that, why do we suddenly feel that working on something as a hobby doesn’t deserve monetary investment?

Errors: Handle with care

Went to renew my driving license this morning, a process the DGT (Traffic Authority in Spain) has made extremely simple now: you just head over to a private clinic, pay quite a bit more than you actually should and have them deal with the bureaucracy.

It was meant to be a 30 minute process and quite straightforward:

1. Ask for customer’s details
2. Run some medical tests
3. Get a temporary driving authorization until your license arrives in the post

I ended up being there about an hour and not getting it renewed.

The real process went something like this:

1. Was asked for all my details at reception and waited as they were typed in.

2. Taken into examination room. Waited 15 minutes until they could start the computer since the fan was acting up. Thankfully the technician (which was actually a Doctor) came in, kicked the box (literally) and it turned on. As he walked out he said:

“these computers are scared of me…”

3. Asked for my details again. When I questioned why I was being prompted for them  a second time, the answer was somewhat expected:

“This computer has nothing to do with the other one. This one runs the DGT program. The other one runs ours. “

Stupid me!

4. Went through some appropriate tests. Again, this was delayed because the second computer failed to boot.

1st Error handling mistake  – the human

I waited patiently until my details were submitted to the DGT system. Everything seemed fine until I was suddenly asked:

Operator: “Are you sure you haven’t lost any points on your driving license?”

Me: “Em no. In fact I think I now have 14 as opposed to 12”.

Operator: “Hmm, something is very wrong. It’s giving me Undetermined Error 611

Me: “OK, so what does that mean?”

Operator: “There’s a problem with your driving license. I think….”

Me: “You think or you’re sure?”

Operator: “I can’t know exactly. As it stands I can’t process your renewal. You’ll have to leave this with me. If I don’t call you back today then you’ll need to go to DGT and do it yourself. But don’t worry, we won’t charge you anything”

Now you have to admit, that’s awfully kind of them not to charge me for something they haven’t managed to do.

2nd error handling mistake – the stupid developer

Up to now, my customer experience, as a user of this clinic has been somewhat lower than par one could say. I’ve witnessed operator incompetency, lack of care of technical equipment and overall no inspiration of confidence.

This clinic has a ER unit, in-house care, pediatricians and various other specialties. Suffice to say, it does not inspire any confidence in me for me to ever return there, specially when dealing with something serious as health issues. They’ve lost a customer.

The second user experience however comes from the developers that created the system. It was that damn undetermined error 611.

As a developer, when you see “Internal Error”, “Undetermined Error” or “Catastrophic Failure” you pretty much know what the developer was thinking at the time:

“I don’t give a shit about controlling errors in this scenario. Too many things can go wrong for me to control”

Now I am right in assuming that this error code is only valid for the developer. Otherwise he/she is really stupid to display an error message to the user making them either have to memorize error codes or look them up in some manual.

As such, that leaves one of two options: 611 is just the number they use to define what an undetermined error is (i.e. 500 Internal Server Error) or 611 provides them some valuable insight into the error, which then begs the question of why it’s undetermined.

Whatever the case though, this is yet another UX fail. Not only does it not provide any kind of valuable information to the user, but it also, as is in my case, when faced with a somewhat incompetent user, causes a certain level of concern (WTF is wrong with my license? Has it been revoked?).

Handle with care

Time and time again I’ve seen applications fail when it comes to handling errors. Most common excuses given when observing bad error management are, that it’s too complicated to know what’s gone wrong. The irony of this is that much of this complexity is caused by the way we design the system, as opposed to the underlying business rules. The only time error handling is too complex to deal with is when a human decision is required. In these scenarios, we need to also deal with the error, but using a different approach.

Providing error codes or ambiguous messages to a user should never be done. Anything that interacts with a user, a consumer of your application, should use language the user understands, not something they need to look up. That’s what computers are good for: looking up information.

Now, while writing this post, I got a call from the clinic. The undetermined error ended up being a user error. The operator had asked for my nationality and I had said Spanish. She had entered Spain as my place of birth. DGT had Iran on their records. There was a mismatch. The operator failed in using the system. But the system failed her even more by not handling errors correctly.

Much of this would have not taken place if instead of

“Undetermined error 611”

it would have displayed

“There is a mismatch between the place of birth entered and that on record”

Something as simple as this would have saved me and the clinic time, annoyance and money.

So never supply error codes?

When switching to the context of developers, it is fine to provide log details and stack traces. In this context you can provide codes. HTTP does it. It’s useful to automate error handling and machine-to-machine interaction. But in addition to these codes, you still need to provide a valuable message so that a developer can understand where to look, what’s gone wrong.

And if everything does go wrong and there’s no way to handle the situation, consider providing a more re-assuring message to the user, something that doesn’t leave him thinking he’s lost all his points on his driving license:

“It’s OK. You didn’t screw up. We did. We’ll sort it out and get back to you”