Friday, May 4, 2012

HTML5/JS/CSS or WPF for LOB?

If you have a chance to build a new LOB (Line of Business) application, what client technology you should choose? I have some thoughts recently.

There are many options, but only two come to the final: HTML5/JS/CSS and WPF. HTML5/JS/CSS is the standard technology today to build web applications. It is supported by all modern web browsers and as a result, you can run HTML5 apps in devices including desktops, laptops, tablets and smart phones. WPF is the successor of Windows Forms, and it is the standard technology to build Windows desktop applications. WPF applications can only run in Windows desktops and laptops. They are supported in Windows 8 slates as well (in desktop mode).

In my comparison, only two factors will impact the decision: platform support and development cost. In platform support, HTML5 is a win. But if you are developing business applications, you do not have to worry about WPF too much either, as long as your customers run Windows OS. When comes to development cost, it is a little surprise to me that WPF is a win. I have been using WPF for a while and it has a learning curve. So I thought HTML5 might be easier since it is easier to get into. But talking with a friend who has extensive development experience in both languages, I was convinced with different result. HTML5/JS/CSS is easier to get into, but when you develop more complicated scenarios, it gets harder. WPF is the other way. It's hard to get into, but when you master it, you are really productive and you can work out any hard problem with nice solutions. His estimate is that developing in HTML5/JS/CSS takes 30%-50% longer than developing in WPF. My other co-worker confirmed that this estimate was very accurate.

So the question really depends on your business needs. If all you need are simple screens and wide reach to different devices, HTML5/JS is the way to go. If you need rich-client experience, WPF would be the right choice.

Would WPF die soon as Silverlight? I really don't think we have to worry about it today -- Silverlight is a web technology. Microsoft gets rid of Silverlight because of HTML5/JS. But WPF has no such competitor. WPF is the one chosen by Microsoft as rich-client technology in desktop applications.

Wednesday, November 23, 2011

Finding flows in software development

A while back, I wrote one article for ACM SIGSOFT Software Engineering Notes (Nov 2009) -- Finding Flows in Software Development. See the link here.

I just uploaded the article to Google Docs and you can read the full article online.

The viewpoints I proposed in the article are arguable and you are very welcome to leave the comments on this posting or contact me directly via yu.feng@acm.org.

Unlike the job security in academics, software practitioners always face the fast changing in technology. We are software engineers, however, we rarely read articles/books written 10 years ago. So, how do we accumulate our knowledge? how do we prepare for the future when we are getting older?

This article tried to address those concerns. With the availability of the blog, I hope to find more readers and more to discuss/share with.

Tuesday, November 22, 2011

The joy of a little pair programming

We have been working with Agile methodology for a year and a half, we do scrums, two-week sprint, some TDD, but until two weeks back we started trying pair programming.

I did not like the idea at the beginning since I got used to the fast movement I usually make at work. But I was willing to share with others in the team, so I did not deny it as well. Two weeks passed, it turned out to be quite positive:
  • We have a lot of discussions when we pair program.  The result is very obvious. Everybody on the team gets to the same page. Even if I do not read detail implementations, I have all the changes in my picture. Same to others. We did not have much design sessions before and there were no code reviews, now pair programming addresses those issues.
  • We learned more on TDD. When working solo, it is easy to bypass writing unit tests. We are working on UI framework, a lot of tests are hard to write. When working in group, we find it is a fun to share thoughts not just on design, but also on how to create tests. 
  • We learn "tricks" from each other. I use shortcuts a lot and this time I share many of them with other two developers. Same time I learned several from them.
Since each developer in the team has his own special responsibilities, we divide work into prototyping and implementation. Everyone is involved in the prototyping, but implementation may go to one single developer when others are busy with other tasks.

I think one reason it works well in our team is because each developer in the team is really good. Everybody is very close, either in programming skill or in analytical skill. When you have multiple bright brains think hard on the same issue, you can only increase the quality of the software!

Saturday, November 19, 2011

Impressions with using my Windows 8

I have been using Windows 8 Preview at home every day for a while. I have not really developed any applications for it yet, so far I am using it to access web sites, read emails and play with Metro applications that are built in.

The biggest reason that I use it as the main one at home is for its start-up speed and overall performance. I do not leave computer running over the night when I am not using it, so I need the machine to boot very fast and Windows 8 does.

However, I cannot get rid of my Windows 7 desktop at all simply because the Windows 8 is only at Preview now. I can install most applications I need on Windows 8, but some are not running right. I spent a couple of hours trying to get all my apps into Windows 8, but I gave up after knowing that installation completion did not mean it was working.

I found a fabulous free software called Mouse without Borders. It allowed me to control my Windows 7 desktop and my Windows 8 with one mouse and one keyboard. I used Synergy when I only have Windows 7 and Windows XP, but it is not working on Windows 8. With MwB, it really becomes a joy to access both OS now.

I do feel two inconvenience with Windows 8 though:
  • Switch back and forth between Metro style and Desktop style. Most time I am using Desktop style but when I look for an installed application, I often have to go to Metro style. I started to "pin" more and more apps to avoid that.
  • Shutdown. For some reason, the Settings Charm lost shutdown feature -- it has to be a bug, it was working fine for the first 1 month. Now I have to either Control-Alt-Delete or use command "shutdown /s" to shut it down. I miss the simple shutdown in Windows 7. (Note on 11/22 - today the shutdown charm works right again after being a problem for 2 weeks)
Overall, it is a pleasure to use it on a daily basis.

Friday, November 18, 2011

Reflection on our MVVM implementation

We are refactoring existing framework to use MVVM these days. Everything worked out greatly and so far we have not found the need to check what third-party MVVM libraries would provide.

There were several things that I feel it's worth to write down for this work:
  • Who's creating the objects. ViewModel was supposed to do that. We use XML to define dataset definitions like where to get data and how to save data. We create ViewModel inside the View (XAML), and it's a different stage where the data would be created. So I created a service controller class which is dedicated for creating the data. We later injected the data into the ViewModel.
  • One or more data models. We have a lot of grids in the view (that's very common in business apps). It's very natural to model grid row data into a data model (i.e., an object class). However, there might be other models you want to model in the view... . Originally I created a model list to hold all possible data models for the view, I mean the data models on view level (not the row level). It looked good to me, but not to others when I explained to them. So I decided to make things simple -- all other properties that I want the View to bind to would be defined in the ViewModel, without introducing view level data models.
  • Issue on child collection. We all know that we use ObservableCollection for list of child objects, e.g. if our data model is class A, it contains ObservableCollection<T> ChildB. The question is do I need to fire property changed for ChildB itself (not the items inside ChildB)? That's still not clear and it seems to be working without doing that.

Thursday, November 17, 2011

A 3-hour webex session

Last time that I spent more than 2 hours on a webex session with clients was four years ago when I troubleshoot the connectivity issue inside client's firewall by using Wireshark. Since then, I usually resolved the issues very quickly, so I was really not ready for the surprise today.

The issue came from SecurityManager. The client got "Invalid timezone" error when sync with their QA app server. We've been reading log files they sent to us, but I asked for a webex since the log files did not give me good findings.

The client was waiting for us when we called them, so everything was very smooth at the beginning. They stopped one of their SecurityManager app server, one nMarket app server so that we did not have to worry about clustering. I spent time setting up debug categories, retrieving POST data sent from SecurityManager server. Eventually I was able to reproduce the error from a web browser by using servlet. Everything led us to believe that something was wrong with the OutboundAPI User View. When I ran from the browser, the user view gave me the Invalid Timezone error, however, if I ran from database directly, the view returned data with no error!

What really troubled me was the tool they use to connect to Oracle database. The client has Oracle SQL Developer on the machine, however, he did not know how to use it well. I did not either. So I had to open Google on local machine the same time. I can modify the view, however I was not able to save the view to test!

Since we do not use that tool here at work, I turned help to the client and he had to get their DBA join the webex. It turned out that the DBA did not know either! We had to switch to DBA's desktop to use her Toad for Oracle. Good that the DBA is really good at the tool and SQL itself and she gave me very good advice when I started debugging.

Interesting findings came. When we ran a query against all 253 user login history records, the exception happened and we traced the error to two local time to GMT conversion PLSQL package calls. I started to use binary search algorithm to find the culprit record. It was a joy to do that in a webex. Not after too long, we find the problem was with one database record which contained a date of 11/06/2011 01:42:53AM value. Why the view works with all other records but not this one? Haha, it was daylight switching hour! I wouldn't be surprised if it's a bug in our code.

A quick test SQL script proved that it's true -- the PLSQL function could not handle that time conversion! Since it's client's QA environment, we just changed the data in the table and it worked! The value itself means that one employee in the client company logged into our product at DST switching hour. I feel I am so lucky now -- I was on call for SecurityManager DST change issues and the client only tested in QA but not their PROD environment. Otherwise I would be waked up that morning... .

I felt not bad after the webex. It was a good story and good finding and we would never find it out if we were just asking for log files in emails. Thanks Ross, Russel and Koma!

One lesson I learned from the webex is that I need to get familiar with other Oracle development tools other than the PLSQL Developer that we are using at work.