Friday, September 2, 2011 #

Embrace Problems – They Will Lead You to Knowledge

 

If you are a developer, you will encounter countless problems in your career. As a developer, problem solving is what you do. Still, some may try to shy away from problems in order to make their lives easier. I say do not, especially if you are a new developer or are learning a new technology. Learn to embrace problems as they come along.

I am not simply referring to basic business problems, but issues that you encounter that cause weird problems that you must solve in order to continue. I’ll give you an example.

Today the other developer on my team asked me for some help. We are using Entity Framework (EF) for our custom ERP program. We had created a view in the database for a piece of our application and had added to our Entity Data Model (EDM). The other developer found that there were duplicates in the view query results and so changed the SQL to eliminate it. However, when he tried to refresh the view in the EDM, it didn’t work because it couldn’t infer an entity key (since views do not have primary keys).

After delving into the problem, we found that EF requires a non-binary, non-nullable field in order to infer an entity key. The old query had a column that was the result of a COUNT() function that EF was using as an entity key and we got rid of it. We ended up having to add the entity manually to the CSDL and the SSDL, assigning an entity key of our choosing.

While some problems can make you bang your head against a wall and frustrate you, understand that these kinds of issues ultimately increase your understanding of the underlying technology. I know much more about how EF works since I now had to create an entity from scratch in the XML, despite the natural want for it to “just work.” Next time this problem arises, I’ll know what to do. And I found it to actually be fun. Remember that knowledge is the treasure that you find when you keep digging to solve problems.

Posted On Friday, September 2, 2011 8:52 PM | Comments (0)

Build UIs the way you would want them to be built

A lesson I learned while building a module in the custom ERP I am working on at my job: build the UI the way you would want it to be built. What do I mean by this?

I’ll explain by sharing my experience. There was a piece of the application that had a textbox that the user used to enter a client number. They then click the Search button to bring back the results. When I launched the application to test it out, I found myself typing in the client number and hitting the Enter key. It kind of came naturally. The Command was not bound to the Enter key so nothing would happen. Also, the requirements did not say that the user will be able to use the Enter key to search. So what did I do?

I bound the command to the Enter key which is actually quite simple. Just add the following XAML to your view (a UserControl in my case):

 

   1:  <UserControl.InputBindings>   
   2:       <KeyBinding Key="Enter"   
   3:                   Command="{Binding SearchCommand}" />   
   4:  </UserControl.InputBindings>
   5:

Here is the moral of the story:

If an action feels natural to you, it will feel natural to your users. While you are building the application, your users will not immediately get to use it as much as you will. So when you notice that a feature just “makes sense” from a user experience standpoint, just do it. Your clients/users will appreciate the forethought.

Posted On Friday, September 2, 2011 8:45 PM | Comments (0)

Copyright © jboyer

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski