A site devoted to discussing techniques that promote quality and ethical practices in software development.

Tuesday, August 28, 2007

Unhealthy obsession with using executables - an example of Golden Hammer Anti-pattern

When one is obsessed with anything, it will lead to bad things - in life and in software development.

This is a real-life example of Golden Hammer Anti-Pattern [1]. The characteristic of this anti-pattern is the tell-tale signs of the blind applications of a technique without question of their validity and suitability. The story below will illustrate this concept and the harmful effect that not only has on the product but also the company culture.

This is a story of a product and suffice to say that it is a serious business application. The product has set out with a form of architecture and has for a while religious following it. However, this reliance on executable, most like came from Unix background, soon become an obsession developed into a Golden Hammer Anit-Pattern. Everything has to be an executable. COM is then used to support automation allowing one executable to incorporate functionality that is packaged in another executable.

To be fair, the product does have DLL's but they are not inproc server. Normally using COM local server is not a bad thing but when the organization is trying to put dialog boxes in a COM local server and trying to maintain the modality across the process boundary, the fool-hardiness of such obsession becomes obvious.

This obsession breeds bad programming practice. Since these local server are registered to be single-use, the developers blatantly abuse the use of global variables. Since there is no code review or mentorship, this abuse becomes cancerous making correction relatively expensive and limiting their options.

The obsession is repeated over a number of years and successfully infecting several generations of management and technical leads. No one has raised a question.

The authors [1] are spot on in explaining why this lemming-like behavior is developed:
In many cases, the Golden Hammer is a mismatch for the problem, but minimal effort is devoted to exploring alternative solutions.

This AntiPattern results in the misapplication of a favored tool or concept. Developers and managers are comfortable with an existing approach unwilling to learn and apply one that is better suited.
Further more, the authors suggest the causes of this are:
  • Ignorance, Pride, Narrow-mindedness
  • Reliance on proprietary product features that aren't readily available in other industry products.
Couldn't agree more.

Here are some of the harms in this obsession representing in real term missed opportunities to provide innovative product and to exploit new products/platform:
1) Because everything is packages as COM local server, the product is unable to provide correct user-experience reliably. Often forms packaged in another COM local server fails to sit on top of the 'owner' form (the launcher). Extraordinary amount of effects over the years are expanded on trying to fix this problem ignoring that a simpler solution using in-proc server would immediately fix this courtesy of Microsoft. Pride and Ignorance have a lot to do with the blindness in recognizing this simple solution.

2) Because the process isolation shields the developers of the harmful effect of blatant reliance on global variables, they even use global variable to do the job of the this pointer, an obvious sign of lack of training in OOP.

3) The obsession has produced a culture so blind that when they considered moving to .Net technology, as everyone did, they refused to concede the inappropriateness of the executable model in the .Net architecture. As most .Net developer would tell you that you cannot develop COM local server using .Net languages but you can for in-proc server. "Igorance" as the authors suggest the cause of this disease, blinding them so badly they ignorantly believing .Net Remoting is a replacement of COM local server that needs no registration.

Instead of taking time out "to exploring alternative solutions", they develop a technique to bend the .Net framework to maintain their obsessive behavior using .Net Remoting. This is chalk-and-cheese difference but to them this is brilliant.

The end results are excessive consumption of memory, slow start up etc. producing a laughable implementation that is neither .Net architecture nor Unmanaged COM local server one. Management did not even thought of the inappropriateness of their flawed architecture. Poor customers.

Had they been less blatant in using global variables, they could have easily transformed their code from an executable model to one using assemblies thus giving them registration-free deployment without being obese.

The authors [1] are perfectly in their observation and suggested refactor technique:
Philosophically, an organization needs to develop a commitment to an exploration of new technologies. Without such commitment, the lurking danger of over reliance on a specific technology or vendor tool set exists. This solution requires a two-pronged approach: A greater commitment by management in the professional development of their developers, along with a development strategy that requires explicit software boundaries to enable technology migration.

[snip]

In addition, software developers need to be up to date on technology trends, both within the organization's domain and in the software industry at large.... They can also form book study clubs to track and discuss new publications that describe innovative approaches to software development. In practice, we have found the book club paradigm to be a very effective way to exchange ideas and new approaches....

[snip]

... is to encourage the hiring of people from different areas and from different backgrounds...

Finally, management must actively invest in the professional development of the software developers, as well as reward developers who take initiative in improving their own work.
So true.



[1] "Anti-Patterns - Refactoring software, Architectures, and Projects in Crisis" by William J. Brown, Raphael C. Malveau, Hays W McCormick III, Thomas J Mowbray

Sunday, August 19, 2007

CBA Netbank UI gone from bad to worse

Further to my previous blog on the need to test UI on a number of Desktop settings, Commonwealth Bank of Australia's Internet Bank has just rolled out a new UI.

Sad to say that it has gone from bad to worse. See this layout distortion on 120DPI in IE6:
This is bad. The placements of all the controls are all over the places. When the same page is rendered in Firefox 2, the page layout is good compared to this.

Wooden spoon prize for CBA's Web developer.

Thursday, August 16, 2007

Test your UI with a range of desktop settings

It is getting more and more common to see badly written UI that cannot handle different desktop settings. One reason is that most so called UI text book does not talk about DPI (Dots Per Inch) display settings.

Everyone assumes that it is always the default - 96 DPI. Sorry I have news for you. When you write a Windows program, there are certain things that belong to the users and there are things within your control. One of the things that is beyond your control is Desktop display settings but the operating system has functions to allow you to discover them and to react accordingly. The last bit is often left out by the programmer who then assumes the defaults or the same settings as their desktop.

To change this setting in XP, just bring up the Display applet in the Control panel, go to the Settings tab, then press Advanced button. In the general tab you can change the DPI settings. Many do not even know about this.

My development machine is always set to be different from the standard to catch violators - myself included. It can also work the other way - a program developed with 120DPI will not display properly in 96DPI environment.

So you need to test both and the best way is to use a Virtual Machine. Fortunately WinForm in .Net 2 has a built in facility to adjust for these.

Below are some bad examples.

From the internet banking department of one of the largest banks in Australia - Commonwealth Bank of Australia:When the 'menu' is dropped down, the distortion is more pronounced:

The bank's did not actually leave their customers in the dark. Here is a cop out from the bank:

Why do the navigation tabs within NetBank (i.e. View Accounts, Transfer Money, Bills, Admin & Services) appear to be so large or small?

This could relate to the Dots Per Inch (DPI) setting on your computer.

The normal DPI setting is 96 DPI. If you are using Windows XP the best way to check your DPI setting is as follows:

  • Open Display icon in your control panel;
  • On the Settings tab, click Advanced
  • On the General tab, in the DPI setting list, click the DPI setting you want to use.
This is a real cop out because such demand is not necessary as million of other web pages can handle this issue without any problem. I suggest that it is their programmers' lacking the skill to deal with this. One of their subsidiaries' web page handles this perfectly.

On a smaller scale, the popular NantAddin for Visual Studio demonstrates a very commonly made mistake:

The almost disappeared OK and Cancel buttons are marked in red rectangle.

Friday, August 10, 2007

Rewards for software piracy

I have never subscribed to the excuse that software piracy is harmful and there appears to have research to support this view.

Further proof of piracy has not hurt Microsoft and indeed has recently rewarded the country that has pirated most of their software with a 2/3 price reduction for the price of Vista.

I guess it is like paying them 2/3 of the price of Vista so that Microsoft can count them as their users (you really can't count pirated users as users can you?) to further increase the Vista population.

So in many ways, it is kind of like advertisement budget and is definitely more effective than putting advertisement on the back of shopping dockets or cereal boxes.

In the mean time those countries, like UK, US and Australia, that perceive piracy bad are penalized with having to pay full price. In some case, other country is forced to pay more.

Who says piracy is bad! It is damn good for the consumers. I am just wondering what kind of messages does does this instance projects?

Friday, August 3, 2007

AFR's Strange subscription model.

The premium Australian financial newspaper is called The Australian Financial Review (AFR). Many years ago in the dot com era, it began its entry into digital web media world by having a Web site that reader can read articles.

AFR has a very crazy subscription model some would argue none at all. In both WSJ or Economist they have subscription different rates for printed and electronic form. The costs between the two are quite substantial. However, AFR does not have any differentiation. Electronic access is only available to those that have a minimum of 5-days paper subscriptions annually. As a result, I chose to subscribe to WSJ, which has far more informations of world class quality to read and definitely cheaper. AFR contains a lot of reprints of WSJ's article and saving heaps. This was quite a few years ago.

Apparently things have not changed much and its seems to have gone worse with the upheavals:

Critics have been quick to slam afr.com as slow, irredeemably clumsy, clunky, hard to navigate, inconvenient, expensive, a ploy to charge more for less and a financial disaster.

And if that were not enough, the application has been branded, launched, then rebranded and relaunched in the past 10 months.

Well said and spot on. When I was an AFR subscriber, it was terrible and the organisation is extremely mean as compared to WSJ in archiving their articles. This has not changed either and seems to have gone worse:
To access any services beyond the smattering of open news stories, you need to become a subscriber. A basic subscription involves registration, which allows access to news and investment guides provided from 29 sources and entitles the subscriber to access archived stories at $3 each.

Step up to the Essential level and you'll pay $25 a month (free if you're a subscriber to the print edition), which provides news and investment services, plus 10 free archive accesses. In other words, you'll save $5 on the $30 cost of 10 trips to the library.

The Markets level costs $50 a month and gives 25 archive credits: $75 worth of stories for $50.

The Advanced level costs $150 a month and provides access to the full suite of services: news, market analysis, 80 archive credits (worth $240 a month), market data, economic statistics, industry snapshots, company reports, watch lists, portfolios, charting and so on. Other services at add-on prices can take the total cost of the package to $288 a month or $3456 a year.

It ain't cheap. But it is the only place, other than the printed version, that allows you to access AFR stories. The company last year withdrew from Media Monitors and other copy-sharing services, arguing that it received no compensation for its work.
It does not even tell you that AFR will archive articles in 30 days as compared to say 3 months in WSJ. Once archived, you have to pay to read it! People show boycott this kind of services as it is clearly attempting to fleece their readers. It will be good to see Rupert Murdoch coming in to give Australian reader a choice. Monopoly breeds this kind of contempts for consumers.

Is this plain stupidity or laziness or both?

Recent release of Apple iPhone excites the hackers community so much so that it has now discovered that:

At the top of the list, the device's operating system runs every application with administrator privileges, according to Miller and his cohorts at Independent Security Evaluators, turning a simple breach of any application into a breach of the system. In addition, both the iPhone's stack and heap are executable and the layout of programs in memory are not randomized -- two factors that make exploitation of any vulnerabilities much easier, he said.

"I think people are letting Apple off easy," Miller said. "You need to design the iPhone so that even if there is a problem in Safari, people don't completely take over your phone."

Gee, Apple has unwittingly given the hackers a great helping hand. It is definitely easy to program for iPhone because one needs not be concerned with security.

Blog Archive