YOUR FEEDBACK
sahil wrote: help
AJAXWorld RIA Conference
October 20-22 San Jose, CA
Register Today and SAVE !..


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP COLDFUSION LINKS


The Power of Antipatterns
The Power of Antipatterns

It seems that lately, you can't pick up a book or magazine without hearing about design patterns. If you're new to the idea of design patterns, they're simply time-tested solutions to common problems.

Design patterns began with the work of Christopher Alexander, a PhD in architecture (as in buildings). Alexander noted that certain problems have optimal solutions, and designated these solutions as "design patterns."

Here, Alexander describes design patterns (from his Web site, patternlanguage.com): "For example, if you are building a house you need to go from outside to inside and there are centuries of experiments on how to do this in a 'just so' way. Sometimes the transition is marked not by just a door but by a change in elevation (steps, large, small, straight, or curved), or a shaded path, or through a courtyard. We wrote up this knowledge in the form of a pattern about entrance transitions."

While design patterns got their start in architecture, they were even more successful in influencing the object-oriented programming community. Four brilliant programmers and theorists (dubbed the "Gang of Four") saw analogies between building architectures and software architectures, and decided to document design patterns in software. The result was a seminal work called Design Patterns.

It's not light reading, but it does reward the student with insight into "just so" solutions. Experienced programmers can document the designs they have found to work, sparing learners from repeating mistakes. As they say, a good programmer learns from his/her mistakes, but a great programmer learns from the mistakes of others.

I think the interest in design patterns in the ColdFusion community is great - it indicates that our community is maturing and growing. But this isn't an article on patterns, but one on antipatterns.

An antipattern is just what it sounds like - the opposite of a pattern. While a pattern documents a proven solution, an antipattern documents a proven fiasco. Perhaps the spirit of antipatterns was best captured by the American newspaperman and curmudgeon, H.L. Mencken in this quote: "For every complex problem, there is an answer that is clear, simple - and wrong."

Antipatterns are those clear, simple, and wrong ideas that, in our haste or inexperience, we may find ourselves drawn to. While design patterns provide us with valuable advice on what to do, antipatterns provide us with invaluable advice on what not to do.

Table 1 shows some antipatterns that are not software related to help get you into the spirit.

As can be seen from the Monty Hall antipattern, sometimes the wrong choice just feels right. No wonder, then, that we get suckered into an antipattern. (If you're absolutely sure that I'm wrong on my advice regarding the game show, head over to www.halhelms.com, where I'll try to show you that your intuition is wrong in this case.)

Some time ago, I wrote an article about how to write really bad code, inspired (as I claimed) by the realization that the sheer amount of bad code out there indicated that people really wanted to write bad code, and I stepped up to help them.

While it's fun to write (and hopefully, read) such articles, there is a deeper truth at work. Sometimes, we can learn more from failures than successes. When we succeed, we may not know why we succeed and any lessons we "learn" from our successes may be nothing more than coincidences. We see this caricatured in superstitious people who wear lucky clothing or work through rituals that they have somehow associated with good things happening.

But failure has a way of clearing the mind of such specious associations. Sometimes pain can actually be therapeutic, if it leads us to question our assumptions and be relentless in searching for the truth. That's just where antipatterns can help us.

Some antipatterns are strictly technological while others have broader implications. Look at the real antipatterns shown in Table 2, taken from a Web site devoted to this topic, www.antipatterns.com.

Studying antipatterns tells us about things we don't already know. As my students can attest to, I consider cut-and-paste programming one of the true evils of programming, but I had never considered the solution to the Boat Anchor problem - and there lies the value of antipatterns: they can help us see things in a new light.

Antipatterns are growing in popularity as people find that studying failure can actually lead to success. Among the resources available are these:

  • www.antipatterns.com: Good information on the site and links to buy various books on antipatterns.
  • www.bitterjava.com: A Java-centric resource (and book), but an excellent one that can be utilized by developers working with ColdFusion components.
  • http://mindprod.com/unmain.html: This wonderfully written site is both fun to peruse and instructive.

    I've been involved in many "post mortems" where the project went wrong - sometimes badly wrong. Too often, these sessions turn into a search for personalities to blame. Why were we late on delivering the software? Because Sue's group was late with the SQL queries! One way out of this ugly situation is to direct the attention of the group toward discovery of antipatterns rather than toward a hunt to punish the guilty.

    Years ago, W. Edwards Deming, justly famous for being the "man who taught the Japanese quality," invented a game that, he said, mirrored the quality situation in virtually all American companies. He called it the "Red Bead Game." In the game, thousands of white beads are placed into a drum, and for every nine white beads, a red bead is added, making the percentage of red beads to the total number of beads 10%.

    Certain audience members representing workers were given paddles into which 100 indentations had been made. Each indentation held a bead. They were then told to insert their paddles into the drum of beads and withdraw it with the paddle filled with beads. The number of red beads would then be measured. "Quality" was defined as having fewer than ten red beads. The game was played with great gusto, with "managers" inventing quotas and rewarding "good" workers who got less red beads while punishing "bad" workers.

    Of course, none of this worked in the slightest since the workers had no control over how the beads fell into the holes made for them. The problem with quality, Deming drove home, is almost never in the people themselves; it is in the system. Or, putting it just slightly differently, there are antipatterns at work that produce bad results.

    The same is true with software development. Rather than trying to identify "bad" programmers, we're much more likely to succeed if we identify antipatterns and work together to refactor a solution in which everyone can win.

    About Hal Helms
    Hal Helms is a well-known speaker/writer/strategist on software development issues. His monthly column in CFDJ contains his Musings on Software Development and he has written and contributed to several books. Hal holds training sessions on Java, ColdFusion, and software development processes. He authors a popular monthly newsletter series. For more information, contact him at hal@halhelms.com or see his website, www.halhelms.com.

  • CFDJ LATEST STORIES . . .
    Kevin Lynch, who will be keynoting on October 21, 2008, helped originally coin the term "Rich Internet Application" in 2002. He has been at the center of innovation in Flash and Adobe AIR since their inception, and currently drives Adobe’s technology platform for designers and develo...
    Rich Internet Applications offer the potential to fundamentally change the user experience and in doing so, yield significant business benefits. The theme of this October's AJAX World Conference & Expo 2008 West is 'Beyond AJAX to the RIA Era' and the Call for Papers, which is still op...
    Join Scott Guthrie as he discusses Microsoft’s commitment to web standards development, Rich Internet Applications and how Microsoft is contributing to help move the web forward. Join Adobe’s Kevin Lynch as he demonstrates how Flash and HTML come together to make the most engaging,...
    Virtualization has become a critical part of Enterprise IT strategy. Why and how has it become one of the most important change agents in our industry? To answer these questions I had the good fortune recently to be able to speak to a select group of top IT industry executives who join...
    SQL Injection attacks are one of the easiest ways to hack into a website. One recent hack, using a script from verynx.cn, involves injecting sql into a web form that then appends some JavaScript code into fields in a database that then gets executed on the client side when a user views...
    Recursion Software released a private beta version of their Voyager mobile platform, with powerful interoperability for Android, Microsoft .NET and Compact Framework (CF), all Java editions (JME CDC, JSE and JEE), and more than 15 embedded operating systems. The Voyager platform is a p...
    SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
    SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


    SYS-CON FEATURED WHITEPAPERS

    MOST READ THIS WEEK
    ADS BY GOOGLE