Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

Doing the unexpected constitutes poor design

I just went to a website for a company that a friend now works for. They have included a search engine in their site. Given that I am interested in the contents of this site, I thought I would give the search a go.

No matter what search criteria I enter, I get taken to a FAQ page. So is this a bug in their code, or were there just no results and they assumed that I would figure that out?

This is a great example of poor design. If the user is expecting results, don’t give them something else. If there really are no results, just say so. Don’t take the user somewhere they didn’t ask for.

Here ends the rant.

Read More

Lack of softie unit testing

I have been trying to pull off something very interesting in recent days. I need to hijack the rendering of a DetailsView control so that it renders different html rather than the inbuilt table element structure.

I have mostly pulled this off by using browser files and control adapters to hook into the rendering process at which time I can get the control to render into a custom HtmlTextWriter. This is great because the page developer just needs to use Microsoft’s DetailsView rather than a custom one.

There is a hitch though. In an attempt to allow certain fields to not render in certain DetailsView modes, I need to render additional information into the html which the HtmlTextWriter can pick up so it will know what HTML to ignore and what HTML to render.

Overriding the RenderBeforeTag and RenderAfterTag of the HtmlTextWriter looked like the go. Unfortunately there is a really simple bug in the framework which I can’t do anything about. See here for more info.

Simple unit testing should have picked this one up. This puts a serious road-block in my path.

Read More

Geek vs Nerd

What is the difference between geeks and nerds?

I have heard this one hit around a few times in the last couple of years. If I have to pick one of these for myself, I would say I was a geek rather than a nerd. Nerd just doesn’t seem to fit. Not that I have anything against nerds, but I can’t stand it if someone calls me a nerd. Geek isn’t so bad, but I would prefer not to be called either.

To fit my view of the world, I like to think that geek = nerd + social skills. To counter that, my wife says (in jest) that geek = nerd - intelligence.

What’s your view?

BTW, she also said that putting this question out to the blogging community is a bit of a skewed sample, so you should also ask any non geek/nerds in your life. [:D]

Read More

Finally, a decent training session

I haven’t done much training this year. We were in New Zealand for January, and for the last two months, I have helped with instructing on many of the nights that I would normally train. This has been because I was either a little sick and couldn’t train or other instructors couldn’t make it.

This weekend was the first decent training session that I have had this year. It was fantastic to do a decent workout and practise my patterns and sparring.

I am going to train with the advanced class now which should be really good as I will get more training per week than I have had previously. Really looking forward to it. This should also help me grade the next few levels very quickly as well. I hope to get to ChoDanBo (trial black belt) by the middle of the year.

Read More

I am ACE

It has taken me several weeks to get around to this one. My ACE came in the mail. Very cool, but hard to take a photo of.

Read More

Code conversion pitfalls

After doing four days of training and meetings in Brisbane, I am now back in the office reviewing some code. I had originally developed some web custom controls in VB (the organisations language of choice) that were then put into an architecture framework. This required that the code be converted from VB to C# which is the language of the framework involved. This work was done by another person while I was back in my prior UI design team.

Doing a code review of C# that is based on my VB code has put me in a new situation. Not having done this before, I am trying to think of scenarios that look safe, but are trouble under the surface. Turns out I found one very quickly. In this case, string comparisons are the danger. The VB code often had statements like this:

Read More

Update to Geoff's enum to string converter

When I get some spare time here and there, I am developing a template driven code generator which uses a database schema as a data source. In doing this, I want the templates to specify what type their output is. To support this, I have defined an enum TemplateTypes with the values of TSQL, VisualBasic, CSharp and Unknown. I want to be able to convert the names of the enum values to more friendly values so I can use them in things like the tooltip text of nodes in a treeview. I remembered that Geoff had previously posted about using type converters with enums to achieve this.

To avoid reinventing the wheel, I took his code and ran. What I found though, is that when the enum value name is converted to a nice string, it adds a space each time that it encountered an uppercase character that wasn’t the first character in the name. This means that TSQL was converted to T S Q L. I made minor changes to his EnumToString function so that it only adds a space when it finds that the previous character is lowercase. I also added a conversion of _ to spaces as well.

The function now looks like this:

Read More

WebBrowser.DocumentText doesn't always update the browser contents

I have been developing some new software which uses the WebBrowser control. Depending on what is selected in a TreeView control, the browser will be instructed to load some HTML that has been created and manipulated in memory.

The problem I have encountered is that once the HTML has been determined, setting the DocumentText property hasn’t been updating what is displayed in the browser. It only displays the HTML that was orginally assigned to the control. The reason for this not working is hinted at in the help documentation for the Document Text property. The documentation says this:

Use this property when you want to manipulate the contents of an HTML page displayed in the WebBrowser control using string processing tools. You can use this property, for example, to load pages from a database or to analyze pages using regular expressions. When you set this property, the WebBrowser control automatically navigates to the about:blank URL before loading the specified text. This means that the Navigating, Navigated, and DocumentCompleted events occur when you set this property, and the value of the Url property is no longer meaningful.

Read More

How important is UI design for software?

I have been thinking about this question ever since I started my first ‘real’ job in the industry when I was half way through university. Each time I think about UI design and what it means to software, I come to the same conclusion.

Market acceptance and widespread use of software is now becoming proportionate to the quality of the UI design of that software.

Traditionally, UI design wasn’t seen as important as functionality, regardless of what the user liked to see. UI design was seen as an unnecessary project expense. There didn’t seem to be a link made between UI design and usability. I believe that design and usability go hand in hand and usability will always impact on the functionality of software or at least the users willingness and ability to use the functionality provided. Unfortunately, this still seems to be the case in many software projects today.

Robert Scoble recently had an interview with Jenny Lam, a designer on the Microsoft User Experience team. It was very interesting to hear about the progress Microsoft and the rest of the industry has made with regard to UI design. As it should, UI design is now starting to become more important in the overall software design process. Although I am a developer, my current role is in a UI design team and I also see many of the struggles in trying to get UI design recognised as important to a product.

Read More

That beginners feeling - Episode 23

Like most things in life, if you haven’t needed to do a particular task before, then you probably don’t know a lot about it, let alone how to actually do the task.

Today, I felt like a novice programmer. Something very simple, but also simply misunderstood, was causing me grief. The issue was caused by multi-dimensional arrays. I simply haven’t had a need for multi-dimensional arrays, probably since uni. To me, multi-dimensional arrays are about relationships between data and that normally screams databases to me, not arrays.

Each time I need to loop though an array, I will loop while the index is less than MyArray.Length. Until today, this has always been fine. Now I have a multi-dimensional array, Length is returning a much larger number than I expected. I initially thought that the Length property was returning the length of the first dimension x the number of dimensions. I thought this because I had a [24, 2] array declaration and Length was returning 48. Logical conclusion right?

Read More