Monday, March 15, 2010

DevExpress XtraGrid anonymous column

Well I found myself needing to bind a DevExpress XtraGrid to a generic List of strings. I found their ListBox to be rather limited and figured a one-column grid massaged the right way would serve quite well as a faux ListBox.

On my first attempt, I bound the list directly to the grid and found that the text did not wrap. That I could fix by setting the ColumnEdit to a MemoEdit and setting the Options.View.AutoHeight property to True. There was only one catch. At design time, I did not know what FieldName I should use in order to bind to the values in the List. If I were binding to a List of Users, I would specify a FieldName such as UserName or EmailAddress and it would bind just fine. What FieldName do you bind to when you just want to bind to a List of strings? "Column". Yes, just "Column".

I discovered this arbitrary value by getting the FieldName from the column at runtime when binding directly to the grid with no columns specified at design time. Hope this helps someone.

Tuesday, March 9, 2010

VS2010 Annoyances (part 1)

I don't want to come off sounding like a whiner, and I may very well have already done that, but I am planning to write a series of posts outlining the issues I encounter as I use VS2010 to create an ASP.NET MVC application. I am doing this both to vent and to get feed back from readers. To balance out the tone of my posts, I will also provide an equal number of aspects of the software that I like.

The Issues
  • Performance. VS2010 is the first non-gaming application that has ever taxed my laptop to the point where the fans run all the time. Granted, the laptop is 6 years old, but I can vouch for it as a workhorse (I hope all of you Dell 600M owners can relate to this). I can imagine this application is a literal drag on battery life. As someone who loves to program on the go, this will probably be hindrance. Of course, I haven't done any benchmarks to move this from the realm of the anecdotal to the realm of fact.
  • Closing Files. In VS2005 and VS2008, file tabs were closed by clicking on one shared button in the top right corner of the editor window. This meant that you could close a large number of files quickly by just clicking on that button repeatedly. VS2010 places the close button on each individual file tab. To close windows, you have to move the mouse to each tab. I know you can right click on a file and close all other files, but this is not the same as allowing me to close the files I choose to close in a quick and easy fashion.
Things I like

  • WPF UI. The first thing I like about the fact that the UI was made using WPF is that Microsoft has invested in it's own technology. I hate the term "dog fooding"; it conjures up images of lovely domesticated animals being slaughtered to create shapeless pieces of meat. But Microsoft is eating it's own now and that means they feel the same pains we feel. The second thing I like about this is that it provides an example of what can be accomplished with WPF when developing business applications beyond image galleries and media streaming applications. I don't know about the other Average Joes, but there has not yet been a point in my career where I've had to create a streaming media player. Embedding Media Player into my application, yes. Recreating Media Player, no.
  • ASP.NET MVC 2. While not technically a feature of the IDE itself, the overall package offers a seamless experience when working with MVC projects. They were made for each other, almost literally.
As I was writing about the things I like, I started thinking of other things I don't like. I will certainly write about those at a later date, but here are some hints: Intellisense, EF4 Entity Editor.

Monday, March 8, 2010

Why we do what we do

I had the fortune of trusting my gut instinct today and watching the Geoffrey Moore talk on innovation at the Business Of Software 2009 conference. I would not typically embark on watching something that feels "soft" as contrasted with the "hard" technological video of my last post. As an aspiring software entrepreneur, I would be a fool to avoid the knowledge that I couldn't otherwise learn except through painful experience.

During the speech, Mr. Moore talks about why good engineers are good at what they do and why they do it. What he said hit home in a big way given the past few days at the office. Engineers, according to Mr. Moore, are committed to solving the problem put before them, regardless of what solving that problem will mean to the business. I was just coming to the same conclusion in light of the fact that I spent the past two days solving a worthy problem without giving thought to why I was going through all the trouble. Sure, the problem had been assigned to me. Sure I had carte blanche to come up with a solution. Sure, the solution could potentially see life in my current project.

I attacked the problem with an excitement I rarely feel. It was a brain teaser and the path to the answer was full of ups and downs, but even as I was half way through I knew that I would succeed if I just pressed through it. So I did. After a day's worth of programming, I had my answer. It worked and I tested it back and forth until I was happy with it.

Then I had a few minutes to think about how I was going to use this new piece of technology. That was when it hit me. I was solving a problem that didn't need to be solved. This wasn't the right solution for the problem we had. It was a solution. My manager and I were both interested in it and we both agreed it posed an interesting challenge, but it introduced a large amount of risk for the small reward of not having to write a few lines of code. So after some thought, I approached my manager and explained that we should take a different direction. One that would not require solving any challenging problems. It would simply require a pragmatic approach and a few dozen lines of that plumbing code we hate to write.

Thursday, February 11, 2010

First it giveth...

Watching the Microsoft SilverLight 4 Overview session from this year's PDC made me realize that Microsoft's vision of progress involves an accelerated traipse leading to technological dead ends and a whole lot of compromise.

How is it that we, as developers, have to come to water at the mouth in anticipation of a rich text editor? Why is that we applaud a proper security model as a feature for version 4 of a framework? Didn't we have these things? Now we get them back again? It seems like Microsoft's approach to progress is to toss out a series of incomplete products, tout them as the next best thing, and then crowd source the QA and design processes.

I would rather see 3 complete products than 12 incomplete products. If Microsoft believed in them and did not kill them off, thereby protecting my investment in their technology, that would help too.

P.S. I work with Microsoft Technology for a living and often find it to be a pleasant experience. This post doesn't represent an anti-Microsoft stance, but rather just the view from one average Joe programmer. Not Mort, but also not a Rockstar. Average.