SEP16

How To Be Ingloriously Unsuccessful - Web App Development Antipatterns

A web application is no longer a bunch of CGI scripts. Web applications can be as rich and complex as traditional software, and as software becomes more sophisticated it is increasingly critical that it is well structured and sensibly managed.

Let's find out how not to do exactly that using antipatterns!

What is an antipattern?

Since this article is all about being contrary, let's look at what an antipattern ISN'T.

Definition: In computer software a design pattern is a reusable approach to solving a commonly-occurring software design problem. A design pattern is a template for solving a problem that can be used in many different situations. - about.com.

Antipatterns are the antithesis of a pattern - they are definable ways of making things horrible and terrible. Antipatterns are to software what being stuck in a lift with Jar Jar Binks is to personal space - invasive, unpleasant and downright frustrating. And, like everyone's least favourite cyber puppet, software suffering from antipatterns can benefit from a good beating with the clue by four.

Design patterns are generally quite well defined, but antipatterns can afford to be pretty loose. Let's take a look at a few of the abominations in the Bestiary of Badditude!

The Golden Hammer

The golden hammer antipattern is the belief that one magical technology product or approach is sufficient for all needs. Perhaps because "we've always done it this way" or "it worked on Project X". Belief in a golden hammer can result in such bad craziness as having presentation html be served from within stored procedures <shudder>.

Besides, gold is a silly thing to build a hammer out of. It'd be too soft.

Not Invented Here

So George, an anthropomorphic personification of a software framework walks into a software house (stop me if you've heard this one before. You may wish to stop me anyway).

Software house: "Who are you? We don't take kindly to strangers around these parts."

George: "I'm a framework! I take care of a lot of the heavy lifting for you and save you lots of time!"

Software house: "We don't have no truck with that kind of shenanigans here. We put in hours of good, honest graft and write our web pages in Assembly! Be off with you!"

George: "But, just try me out! I'm sure you'll like me!"

Software house: "We're much too busy, after all, it takes 10 hours to build each web page this way! Now get out!"

Also known as NIH syndrome, this is a wonderful way to squander resources and reinvent the wheel.

Continuous obsolescence

Working on the web, we are particularly vulnerable to Continuous obsolescence - new frameworks, languages and techniques come out every day. It can be illustrated like this:

"OK! We've ported our C++ app to CGI on the web!"

"Great! But there's this new thing, ASP, that is new and shiny, let's use that!"

(later) "OK, we've just finished the port from CGI to ASP!"

"Umm, OK guys, but ASP.Net has just been released, can we port to that? Also, can we have Flash animations?"

"Sure, OK..."

(later still) "OK, now the UI looks dated, let's switch to jQuery animations..."

And so on and so forth. New technology comes out all the time, such as better browsers, new Javascript libraries, fancy CSS tricks and so on. This progress is great, but sooner or later you have to launch, otherwise you risk becoming a laughing stock like Duke Nukem Forever did!

Premature optimisation

Performance is important, particularly on the web (see our blog post on progress bars for some info on how slow performance can annoy users) so we must optimise our code. Precisely the wrong thing to do is to assume you know what will make a given system slow without testing it. Optimising too soon in the development process can result in a clumsy architecture. Sometimes we do have to mar our beautiful designs for the sake of speed, but just blindly assuming that ugly hacks will improve the product is foolish: we must also factor in developer time, code comprehensibility, and many other factors, and if your code reads like a phonebook that's been through a paper shredder, you're in trouble. Most of the time, a good architecture stands you in good stead because it will scale cleanly.

That said, it is always prudent to profile your code, to find where it is actually slow, rather than the assuming it's slow where you think it is. For example, YSlow is a great tool to help us to measure front end response times on the web, and XDebug with a cache grind program can help you to find where your PHP is bottlenecked (other languages and tools are available).

I've made a little rhyme to help you remember:

Be like Eric Morecambe,
Not like Ernie Wise,
Profile your sourcecode,
Before you optimise

Big ball of mud

Sadly, the big ball of mud antipattern describes most software products: a casually or haphazardly constructed system. There is no kind of structure, just a Hungry Hungry Hippos style free for all. These kinds of systems are the most vulnerable into devolving into our next antipattern, the post-apocalyptic wasteland of many a software project:

Wild Wild West

Some web projects take the concept of a "digital frontier" a bit literally, practically issuing cowboy hats and six shooters to their developers! These projects have no version control, and developers jump onto boxes, hack in changes and log off. This can result in a tangled mess of code (a spaghetti code western, perhaps), often incorporating other antipatterns such as copy and paste programming. Such a project will soon reach critical mass, particularly as there is no definitive codebase.

Fire fighting can be exhilarating in the short term, but it eventually becomes dispiriting, and there's nothing for it for the cowboy to do but to saddle up and ride off into the sunset, ready to screw up another project.

Traumatised?

As a brief and hopefully fun crash course, this hasn't been an exhaustive treatment of antipatterns by any means; there are many more (Ward Cunningham's wiki has a list). Even software houses that are "doing it right" may exhibit antipatterns in test driven development. On the web, we're just as vulnerable to falling into bad habits as with traditional software development. Let's be careful out there, people.

16 comments

  1. research papers said on 19th Apr 2010

    I agree with you, thanks for sharing

  2. Takaful Keluarga said on 23rd Aug 2011

    Hi there! I know this is kind of off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having trouble finding one? Thanks a lot!

  3. uggbootsd4 said on 11th Oct 2011

    There Are Ways To Save Money On Your Car Spendings


    Most people living in the US are forced to drive cars since the country does not have a public transportation system. Oil prices are soaring, for a variety of reasons, be they simply supply and demand, risky speculation, or just plain avarice on the oil companies' part. Tips on on ways to save on oil would thus be welcome in the present situation. Saving a little here and a little there soon adds up.

    The most apparent savings in the first place can come from having a fuel-efficient car, such as a sedan, or, if you are inclined to spend more, a hybrid. There are some simple ways to save money, though, like mostly keeping your speed down and not picking up speed quickly, that will apply to all cars, and especially to older, thirstier ones. Learn to take advantage of the momentum of the vehicle to keep it going forward, with your foot off the accelerator, whenever it's appropriate, to save on fuel. There are several small ways that can keep gas in your tank for longer.

    The same grade of fuel is not specified for all vehicles, or even for all places, so see to it that you stick to what's specified for yours. Premium fuel, for instance, costs more but will benefit only particular cars, so don't waste money here if your automobile is not one of them. You can save money on gasoline if you drive slower, and remove any surplus weight from your car. Driving fast means more air must be transplaced and that drag increases, which all means a reduction in fuel efficiency. Aside from the increased risk posed by high speed driving, slowing down will keep money in your purse.

    One piece of excess weight you can remove to save gasoline, unless you need it to transport something, is a roof rack. Fuel consumption is affected not only by the weight, but by the increased drag produced by roof racks also. It may not save you a huge amount, but there is no reason to lug around surplus weight in your trunk without it being a necessity. Our choices, with fuel prices ostensibly set on an upward path, are limited: search for fuel substitutes and alternatives, and apply ways to cut down on how much we use, or merely resign oneself to the high prices. It's hard to get people to do more than just complain, and so the most continue in their usual ways and just pay the higher costs.

    The only evident change is that a lot of people are now buying vehicles that flaunt greater fuel-efficiency. Most of the people who try to bring down their gasoline consumption are those whose budgets exclude them from trying the other alternatives. It will likely take an education campaign to get more people to realize that conserving fuel is something worth doing. Aside from the money that would be saved, persuading every person to drive more slowly would make our roads a lot safer and cleaner.

    Alabama Crimson Tide Jerseys
    Nashville Predators Jerseys

    Detroit Lions
    cheap nhl jerseys

    Kids Jerseys
    Columbus Blue Jacket

    Chicago Bulls
    Washington Nationals

    Philadelphia 76ers
    nfl wholesale jerseys from china

  4. AppearLem said on 1st Nov 2011

    Recently looked the thread. great job! Walmart Gift Cards.

  5. ChooneeatochE said on 18th Nov 2011

    vVhoSrpjLlp cheap ugg boots fOcxBoiiEht http://www.littlefitness.com hLpxEsszZod

  6. BoutLooky said on 29th Nov 2011

    noclegi rewal

  7. inseveachic said on 2nd Jan 2012

    Drop in on us at the moment to obtain more knowledge and facts in the matter of Visit us at the moment to grasp more information and facts anyway Ulotki

  8. weekevarp said on 14th Jan 2012

    gjX hermes replica rtU http://www.chain-reaction.org/index.php?/member/13318/ isU gucci outlet stores tfW http://parklandinstitute.ca/member/28063/ piC gucci stores adO http://gd.risd.edu/www/member/16333/ inY replica gucci bags xkH http://my-bilingual.com/wordpress/guccibeltbag5988/2012/01/14/gucci-sale-outlet-gucci-handbags/

  9. Bugslattwrata said on 16th Jan 2012

    YvIP ghd green EwUG http://www.transfermarketnews.com/index.php?do=/louisvuittonartsy5659/blog/ghd-stockists-size-originates/ SkHR ghd factory NhBI http://www.woolp.com/ghdoutlet116/blog/ghd-for-sale-opinionated/ IbYO ghd iv salon styler IdMK http://www.ubbusinessnetworking.co.uk/louisvuittonstore5666/blog/pink-ghd-improvement-after-a-while/ MjPT hermes constance bag ZgGC http://orbicula10.insanejournal.com/319.html

  10. Cymnmaurice said on 17th Jan 2012

    look at best-knockoff-designerbags.com online shopping best-knockoff-designerbags.com for more detail

  11. DogSmellissa said on 18th Jan 2012

    best for you aabags.com , just clicks away aabags.com at my estore

  12. opeplaroreste said on 18th Jan 2012

    nHW ghd hair straighteners cheap yQL http://guccireplica118.tradea.org/501056/If+you+possibly+can+ghd+flat+iron+think+.html oXM cheap ghd straighteners zRD http://www.cheapghd5988.ewebsite.com/articles/ghd-hair-australia-so-that-you.html yKA cheap ghd straighteners eQM http://articlicious.com/467667/seeds-ghd-iv-pellets-tend-to-be-tiny/ oIG replica hermes birkin kDH http://www.citysquash.org/member/25734/

  13. online pharmacy reviews said on 25th Jan 2012

    certainly like your web site but you need to check the spelling on several of your posts. Many of them are rife with spelling problems and I to find it very bothersome to tell the reality nevertheless I will definitely come again again.

  14. Loowdenindy said on 27th Jan 2012

    VITXELNKJW ugg boots uk ABCIVRENME http://cheap-uggbootsukonline.co.uk

  15. GotoGrodork said on 30th Jan 2012

    olU hermes bags for sale opX http://mym8.eu/louisvuittonbag6388/blog/83599/

  16. Gorobeela said on 30th Jan 2012

    rSY hermes belt vRV http://louisvuitton130.multiply.com/journal/item/4/number_of_hermes_belt_internet_retailers

    Post Comment

    About The Author

    Gavin Davies
    Gav is a Senior Developer at Box UK, with an interest in Java, design patterns and test driven development. He plays in a cheesy weddings band, climbs mountains in winter and trains in mixed martial arts. His favourite animal is the kitty, followed by the puffin.

    We're hiring

    Want to work with people like us?

    Check out our developer vacancy.