ReSharper kills comments

I’ve said before that I really like ReSharper. Apart from Visual Studio itself, it’s the most valuable development tool I have. Whereas Visual Studio increases my productivity by letting me create code faster than I would with a simple text editor and command line tools, ReSharper helps me create better code. It also provides tools that make it easier to understand unfamiliar code and refactor older code to bring it up to modern standards. Altogether, I’ll agree with my friend Dennis who says that if you’re writing C# code professionally and you’re not using ReSharper, you’re probably committing malpractice.

That said, ReSharper has a few annoying features. Fortunately, most of them can be disabled or their behavior modified through options settings. I discovered one yesterday, though, that I find particularly disturbing.

Imagine you have this declaration in your code:

Func<bool> canExecute = () =>
{
// In this case, we can always execute the function because …
return true;
};

ReSharper helpfully recommends converting that into a lambda expression. Seems a reasonable thing to do. If you tell ReSharper to go ahead and make the transformation, you end up with:

Func<bool> canExecute = () => true;

That’s right, it deleted the comment! Not a good thing.

This isn’t a particular problem because I applied the transformation individually and saw the comment disappear. But if you modify the settings to automatically apply the transformation when you run Code Cleanup, you won’t see the comments being removed. I repeat: Not a good thing.

That’s unfortunate because it forces me not to use the automatic “convert to lambda expression” function in Code Cleanup. Not a deal killer, but a little annoying.

Time management?

During the dot-com boom (1998 or 1999), one of my coworkers overheard me discussing stocks with another guy in the office. He later asked me for investment advice–a fairly odd experience for me. My investment knowledge is rudimentary at best. But I knew from previous discussions that my coworker (we’ll call him P) had some pretty significant credit card debt. The conversation went something like this:

Me: P, I can guarantee you 18% on your money.

P: Really? What stock?

Me: No stock. Just take the money you were going to buy stock with and pay off your credit card.

P: But … but … I’m wanting to save money. Invest!

Me: You’re paying 18% or more on your credit card debt. If you’re lucky you’ll average 10% on your stock investments. So even if you do well, you’re losing 8% per year. If you pay off your credit card debt, then at least you break even.

After that we got to the real issue: P was looking for tips on stocks that would skyrocket. 18%? Bah! He was looking for 1,000% gains. I told him that if I knew how to do that I wouldn’t be slaving away at the pixel mines.

I’m no investment guru, but I understand basic math.

Friends fairly regularly ask me where I find the time to do my wood carving. Some seem to think that I’m some great time management guru. Nothing could be further from the truth. I’ll admit that I’m terrible at time management. I’m easily distracted if I’m not very interested in what I have to do, and if I do get interested I’ll get lost in whatever I’m working on. It’s not uncommon for me to look at the clock and find that it’s 3:00 AM when I thought it might be approaching midnight.

Time management is not one of my strong points.

But finding time to work on my wood carving is no problem at all, and I suspect most of the people I know could do the same thing. How? Turn off your television!

According to recent Nielsen data, Americans aged 35 to 49 watch an average of 33 hours of television per week. 33 hours? That’s nearly five hours a day! And that number increases as we get older. Americans older than 65 watch an average of seven hours of television every day. What a waste.

I’ve mentioned this to people before, and they look at me like I’m crazy. “Give up my <insert name of favorite show here>? No way!”

No skin off my nose. But if you’re sitting in front of the idiot box and wondering where I find the time to do things, maybe you should re-think your priorities. My dad used to say, “We find time to do the things we think are important.” In my experience, that’s true. And if the Nielsen data is reliable, most of the people asking me where I find the time are spending five hours a day staring at the answer.

 

Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.