329 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Back to black
Sat, Feb 23rd 2013 362
The music post
Tue, Feb 19th 2013 283
IBM Connect 2013: the last post
Thu, Feb 14th 2013 437
IBM Connect 2013: the third post
Tue, Feb 5th 2013 357
IBM Connect 2013: the second post
Mon, Feb 4th 2013 409
IBM Connect 2013: the first post
Sun, Feb 3rd 2013 359
Quote of the day
Mon, Jan 7th 2013 466
Top 10
Headline of the year
Mon, Dec 31st 2012 543
Quote of the day
Mon, Jan 7th 2013 466
IBM Connect 2013: the last post
Thu, Feb 14th 2013 437
Wise words
Sun, Nov 25th 2012 417
IBM Connect 2013: the second post
Mon, Feb 4th 2013 409
Back to black
Sat, Feb 23rd 2013 362
IBM Connect 2013: the first post
Sun, Feb 3rd 2013 359
Netgear ReadyNAS & OS X: fixing printing
Mon, Sep 12th 2011 358
IBM Connect 2013: the third post
Tue, Feb 5th 2013 357
Codeyear and site design
Wed, Jan 4th 2012 327


Making code test-able
Ben Poole    

There are two things a developer needs to make his or her output testable (and therefore more robust. Hopefully):

  1. The “How would I test for xyz” mind-set, and;
  2. A fast simple development environment

That’s it, that’s all you need. The first comes with practise, and the second is pretty straightforward nowadays. Of late I have been writing a lot of PHP in Eclipse, Coda and the new kid on the block, Sublime Text 2 (check it out: very nice). All of these tools make it easy to write test-able code, because one simply pulls in the unit testing framework of choice, and then one writes code: job done, very low barrier to entry.

As a small aside, I am constantly amazed at how much PHP stuff goes out the door with minimal-to-no tests, especially when one considers the fluid nature of the language (its typing and such). This contrasts sharply with the mind-set we see amongst Rubyists, who regard their language’s dynamism as raison d’être for excellent test coverage.

So a diligent approach to testing is one thing, but contrast my comments about editors above with other recent experiences writing Java in an Eclipse-based editor called Domino Designer (some of you may be familiar with it). Making that code test-able has been more problematic, given DDE’s reluctance to play nice with plug-ins like JUnit, and the way a typical Java agent is structured. So, a couple of tips:

  1. Abstraction is key: write as much of your Java code as you can abstracted away from the Domino object model. This way you can code in a proper Eclipse instance, and you can write easy test cases. Break up big problems into small solvable components, and test them. Your Java agents should be very “light”—minimal code perhaps just looping a collection or whatever. Let your custom, tested classes do the heavy lifting.
  2. If you’re like me, and not at Lotusphere, you will be missing out on a session from Messrs. Myers and Robichaux covering effective Java in the Domino environment. As soon as their presentation is made available, I have it on good authority that you will want it, and that the Wookiee has some tricks up his sleeve when it comes to JUnit :-).
  3. (Finals words of “wisdom”: it is a lot quicker, and simpler, to write test-able code up-front. Adding tests after the fact is always more burdensome).



    ---------------------
    http://benpoole.com/weblog/201201170736
    Jan 16, 2012
    143 hits



    Recent Blog Posts
    362


    Back to black
    Sat, Feb 23rd 2013 7:28a   Ben Poole
    Mr. Mooney recently posted about his old Apple MacBook, which he received in recognition for all his hard work with ILUG in 2007. Seeing his post reminded me of the “mb4bp” initiative that Volker kicked off: In December 2006, through the wonderful kindness of the wider IBM Lotus community, I was able to buy my first professional grade (and new to boot) machine. This started something big. Within eight months of receiving that splendid little laptop I had formed my own company and resigned f [read] Keywords: ibm ilug lotus apple community laptop macbook
    283


    The music post
    Tue, Feb 19th 2013 3:28p   Ben Poole
    An astounding year for music so far, and we’re only in February! First up, I was delighted to find that a relatively new discovery of mine released a new album in January. These fellows hail from Manchester and are called Dutch Uncles. Prog-pop is the description they’re most tagged-with, and I suppose it suits. Think a joyful amalgam of 80s King Crimson, Talking Heads and Sparks. Some fantastic odd guitar figures, shimmering keys and a unique vocal style from leader Duncan Wallis. Excellent [read] Keywords:
    437


    IBM Connect 2013: the last post
    Thu, Feb 14th 2013 3:56p   Ben Poole
    And so to the last day of Connect, Thursday (this post is a bit of a ramble, I warn you now). I started off poorly by missing Mark and Julian’s show ’n’ tell, “Buried Treasure: Finding the Hidden Gold in IBM Notes Data”. Damn! Instead, a little work and then off to the various Q&A sessions, kicking off with Gurupalooza, hosted by the wonderful Susan Bulloch. This is always a fun session, and the “re-education bat” added a certain je ne sais quoi. Gurupalooza was followed by [read] Keywords: connections domino ibm inotes notes xpages apple blogger development enterprise java javascript mobile server twitter wiki
    357


    IBM Connect 2013: the third post
    Tue, Feb 5th 2013 3:43p   Ben Poole
    Tuesday was a superb day in Orlando, really enjoyed it. And I’ll tell you for why… (said in best Uncle Bryn voice): First up, a load of work, and chat in the rotunda. Always good! And then, just before lunch we had a gem of a session: Spark Ideas, put together by the Nerdgirls. It was just wonderful. I nearly ended up blubbing like a baby (thanks Graham :-)) and also laughed like a drain. Nothing technical, nothing about IBM. Just a group people I respect (more than ever) laying a little o [read] Keywords: domino ibm xpages apple application applications eclipse java server wiki
    409


    IBM Connect 2013: the second post
    Mon, Feb 4th 2013 3:20p   Ben Poole
    And so to Sunday. I suppose one would class this as the first “proper” day of IBM Connect as Jumpstart sessions get going, and there’s business development stuff going on. In the Woodward / Myers / Poole suite pit things were somewhat muted and slow to start. We all had things to do, so the day was spent gently faffing. Mark and I even got a decent brunch in (one of the few proper meals enjoyed during the week!) Predictably, the evening started early at the pool-side reception, and finishe [read] Keywords: ibm application development interface
    359


    IBM Connect 2013: the first post
    Sun, Feb 3rd 2013 3:30p   Ben Poole
    A taxi, a plane, a train, a walk, another train, and another walk. Left the Dolphin just after 5pm on Thursday, and walked through my front door in Blighty exactly fourteen hours later. And what a trip! As long-time readers will know (!) I don’t do the Lotusphere thing very often. I went courtesy of my old employer in 2006 and then thanks to team Elguji got to go again in 2010 as the indy coder I am now. Despite this paucity in my attendance record, Lotusphere always feels welcoming, it just [read] Keywords: ibm lotusphere google wiki




    466


    Quote of the day
    Mon, Jan 7th 2013 4:30a   Ben Poole
    Just catching up on Robert Fripp’s diaries. He was discussing the various interactions he’d had with people on-line over the years, and this line stood out: It is not possible to discuss the weather with a person whose head is placed where sunshine never falls, and yet who feels themselves to be a climate expert. Read more… [read] Keywords:
    543


    Headline of the year
    Mon, Dec 31st 2012 7:57p   Ben Poole
    … possibly. ‘Oompa Loompas’ sought by police over Norwich assault. Happy 2013 everybody. Sorry for the radio silence for so long. It has been one hell of a mad year! I hope to see many people during the course of the next. Sorry, this. Yes. [read] Keywords:
    417


    Wise words
    Sun, Nov 25th 2012 1:47p   Ben Poole
    Something I just read whilst catching up on Robert Fripp’s diary—a piece of advice to a struggling musician colleague, but I think there’s a little nugget in there for all of us: My advice: re-establish the morning sitting. Life without the morning sitting is like trying to walk without legs. This is the beginning, the foundation, of strengthening personal presence. If we are absent, then life is all stuff. Nothing real happens; so when things go wrong, it’s not possible [read] Keywords:
    253


    Nobody does it better…
    Sat, Oct 20th 2012 4:50a   Ben Poole
    Alan Partridge narrates the opening of The Spy Who Loved Me. Wonderful. [read] Keywords:




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition