<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Just a Thought...</title>
    <link>http://bloritsch.d-haven.net</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Random thoughts</description>
    <item>
      <title>Using JUnit 4 Theories to Test Contracts</title>
      <description>&lt;p&gt;I&amp;#8217;ve been putting off upgrading to JUnit 4 for a while.  After all, just how much does it really buy you?  It turns out, that JUnit 4 grants you a number of advantages that weren&amp;#8217;t available with JUnit 3.  One of those features is currently in an experimental phase: Theories.  Theories let you specify a bunch of data points, which can be applied to each theory in your class.  For example, if you want to test some boundary conditions on a class, you can make it happen easily like this:&lt;/p&gt;


&lt;pre&gt;
@RunWith(Theories.class)
public class VerifyMyAlgorithm {
    @DataPoint
    public static int limLow = 0;

    @DataPoint
    public static int limHigh = 3000;

    @DataPoint
    public static int belowLimLow = limLow - limHigh;

    @DataPoint
    public static int aboveLimHigh = limHigh * 2;

    @DataPoint
    public static int median = (limHigh - limLow) / 2;

    @Theory
    public void verifyTwoParameters(int first, int second) {
        assertInRange(limLow, limHigh, MyMath.algorithm(first,second));
    }
}
&lt;/pre&gt;

	&lt;p&gt;I wanted to keep it simple just so you can get the basic idea.  Essentially the @RunWith() annotation changes the basic behavior of your test class.  It enables the use of the following annotations: @DataPoint, @DataPoints (more on this later), and @Theory.  The data points you specified are collected and matched together so that each unique combination of datapoints is applied to the parameters in your theory.  If your theory takes one parameter, the theory is run once per data point.  If your theory takes two parameters it is run with every unique combination (15 times in this case).&lt;/p&gt;


	&lt;p&gt;But wait, there&amp;#8217;s more!  Sometimes we want to generate our datapoints with code.  For example, we may need prime numbers up two four significant digits, or we need to initialize our data.  In order to do that, we can use the @DataPoints annotation.  The return type of your static method will be an array of datapoints.  I could rewrite the example above like this:&lt;/p&gt;


&lt;pre&gt;
@RunWith(Theories.class)
public class VerifyMyAlgorithm {
    @DataPoints
    public static int[] attemptLimits() {
        return new int[] {0,3000,-3000,6000,1500};
    }

    @Theory
    public void verifyTwoParameters(int first, int second) {
        assertInRange(limLow, limHigh, MyMath.algorithm(first,second));
    }
}
&lt;/pre&gt;

	&lt;p&gt;The DataPoints functionality in concert with the theories are the foundation of what is ncessary to automatically test the contracts of each service.  I&amp;#8217;ve thrown together a rudimentary class scanner that uses reflection to iterate over classes in the classpath to determine if they match the criteria for the service.  For example, you can look at all classes that implement an interface, or extend a base class, or even have an annotation.  From that list of classes we can test the contracts of the implementations.  The nice aspect of this approach over creating a base test class and extend it manually for each implementation we write, is that it automatically finds the new implementations for you.  I have yet to release the class scanner, but you can implement your own pretty well.  Here is an example of how it would be used:&lt;/p&gt;


&lt;pre&gt;
@RunWith(Theories.class)
public class EnforceLocakableContracts {
    @DataPoints
    public static Lockable[] collectImplementations() {
        Collection&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; klasses = new ClassCollector()
                .assignableTo(Locakable.class).recurse().collect();

       Lockable[] implementations = new Lockable[klasses.size()];
       int i = 0;
       for (Class&amp;lt;?&amp;gt; klass : klasses) {
           implementation[i] = klass.newInstance();
           i++;
       }

       return implementations;
    }

    @Theory
    public void lockShouldApplyToOneUser(Lockable lockable) {
        User one = TestSupport.createUser("one");
        User two = TestSupport.createUser("two");

        assertFalse(lockable.isLocked());

        lockable.acquireLock(one);

        assertFalse(lockable.canAccess(two);
    }

    @Theory
    public void lockableShouldBeAccessibleByLocker(Lockable lockable) {
        User one = TestSupport.createUser("test");

        assertFalse(lockable.isLocked());

        lockable.acquerLock(one);

        assertTrue(lockable.canAccess(one);
    }
}
&lt;/pre&gt;

	&lt;p&gt;So on and so forth.  Just add a new Theory for each aspect of the implementing class you want to test.  With this approach, testing implmentations of an interface is essentially future proofinf yourself against lazy programmers.  There are some aspects that this approach doesn&amp;#8217;t handle well just yet, such as complex setup for each object.&lt;/p&gt;


	&lt;p&gt;As of JUnit 4.7 there are a few problems, but they are not insurmountable:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;You see one pass/fail per theory (not per implementation)&lt;/li&gt;
		&lt;li&gt;Failures do not show what implementation failed (fixed in the stacktraces provided by JUnit 4.8.1)&lt;/li&gt;
		&lt;li&gt;The first failure kills future tests.  You may have errors in multiple implementations but you won&amp;#8217;t be able to find it until you fix the first implementation.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The best thing is to upgrade to JUnit 4.8.1, which is still not available in Maven repositories yet.  However, you can also use the System.out approach to find out what the last thing tested was.&lt;/p&gt;


	&lt;p&gt;There is a feature request for theories to allow you to run them discretely.  I.e. each run gets displayed in your test report individually with the parameters supplied in the test name.  That will address the shortcomings and make this an even better approach.&lt;/p&gt;</description>
      <pubDate>Tue, 09 Feb 2010 16:08:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f38fddaf-acb2-4175-a674-012bdcbcb962</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2010/02/09/using-junit-4-theories-to-test-contracts</link>
      <category>junit</category>
      <category>testing</category>
      <category>contract</category>
      <category>java</category>
      <category>development</category>
      <category>TDD</category>
    </item>
    <item>
      <title>What's the purpose of the new iPad from Apple?</title>
      <description>&lt;p&gt;No new technology has stirred up consternation like Apple&amp;#8217;s new iPad introduced last month since the release of the iPhone.  Apple purports that there is a market for something in between a laptop and an iPhone/iTouch.  I agree with them on that point; however, the market may or may not jump on the iPad.  Time will tell, of course.&lt;/p&gt;


	&lt;p&gt;In the keynote, Apple compares the iPad to something called a &amp;#8220;NetBook&amp;#8221;.  NetBooks users can be divided into two major camps: people who want a cheap way to do Windows, and people who just want to browse the web and check email.  The current NetBook market has offerings with Windows and Linux.  They are tiny, have cramped keyboards, and really aren&amp;#8217;t that remarkable.  The iPad would be a great alternative for folks who don&amp;#8217;t care about Windows.  But I don&amp;#8217;t think that&amp;#8217;s the market, really.&lt;/p&gt;


	&lt;p&gt;Amazon has this thing called a Kindle, and Barnes and Noble has their version of a competing product.  The Kindle is pretty cool, it is designed to make reading electronic books an enjoyable pastime.  I see commuters with Kindles all the time.  The Barnes and Noble device is a direct competitor, and because it doesn&amp;#8217;t do a whole lot more, they will have a hard time taking over the Kindle.  The good points about the Kindle include battery life an Apple device can only dream of, and a display that is easy on the eyes.  I noticed Apple&amp;#8217;s new book store app with books you can download.  I think Apple is aiming for this market with a vengeance&amp;#8212;doing for books what they did to the music industry.&lt;/p&gt;


	&lt;p&gt;The kindle uses something called &amp;#8220;liquid paper&amp;#8221; which consumes very little energy and is very easy on the eyes.  It&amp;#8217;s not backlit, and has a similar contrast to what you get with a regular paper book.  The liquid paper only consumes energy when the screen has to change.  The downside?  Only 16 shades of gray.  We haven&amp;#8217;t had limitations like that since the Commodore 64.  However, for reading it is a superior technology.  Because of it, the Kindle can hold a charge for more than a week with normal use.  That beats iPad&amp;#8217;s 10 hour limit handedly.  The very thing that makes viewing pictures and watching movies great on the iPad is what makes reading books for extended periods of time a strain on the eyes.  The contrast is too great for comfortable reading.&lt;/p&gt;


	&lt;p&gt;That said, the iPad&amp;#8217;s market is bigger than just replacing the Kindle.  Think about a commuter.  They hop on a bus, run to a train, and take more than an hour to get to work.  Many commuters keep themselves entertained watching movies, playing games, texting, reading, studying, and sleeping.  Often times on the train you are lucky if you can sit down.  A laptop is just a non-starter in this arena.  Smart phones, iPods/iTouches, Kindles, newspapers, and physical books rain supreme.  They have an advantage that they can be held with one hand while people are staring at them.  The other hand comes in to play if the user is texting or interacting with an app.  I think the iPad will work very well in this market.&lt;/p&gt;


	&lt;p&gt;People need something unobtrusive to take notes with, yet is natural and intuitive to use.  Even better would be the ability to have your reference material (Bible, text books, etc.) open so you can reference parts of it in your notes.  It&amp;#8217;s a matter of time before there&amp;#8217;s a really good note taking app for that.  The casual internet user will prefer to have something like the iPad than a desktop or laptop hooked up in a room.  If you have FiOS, they give you a wireless router in the package.  Why not have a couple devices that make good use of it?&lt;/p&gt;


	&lt;p&gt;Consider going to a meeting where you are presenting.  Now, if your iPad has your slide deck you can really limit the amount of cruft you have to take with you.  With the right adapter, you can display the slides on a projector or large screen.  However, if you forget the connector and you have a small number of people you are briefing, you still have a big enough display to work with.  You can at least see your notes while you are presenting.&lt;/p&gt;


	&lt;p&gt;There&amp;#8217;s going to be a lot more uses for this thing that have yet to be imagined.  The exciting thing is that Apple has thrown down the gauntlet and created a new platform&amp;#8230; again.  What people choose to do with it has yet to be seen.  The early adopters will be the commuters, and their enthusiasm will infect others.&lt;/p&gt;


	&lt;p&gt;Apple does consumer devices like this very well.  Sure it lacks the ability to run multiple applications at once.  It&amp;#8217;s not designed for that to begin with.  It&amp;#8217;s designed for the user who is going to do one thing at a time.  Did you notice that the iPhone/iTouch/iPad doesn&amp;#8217;t have a window based UI?  Each app takes up the full screen.  You are supposed to do only one task at a time.&lt;/p&gt;


	&lt;p&gt;Am I going to buy one when it comes out in March?  Maybe not.  I&amp;#8217;m going to stick with my iTouch until the iPad starts to really define its market.&lt;/p&gt;</description>
      <pubDate>Thu, 04 Feb 2010 00:08:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c3c33c3a-032a-43ea-8346-e25c337200dc</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2010/02/04/whats-the-purpose-of-the-new-ipad-from-apple</link>
      <category>iPad</category>
      <category>random</category>
      <category>thoughts</category>
    </item>
    <item>
      <title>Naked Objects, Point - Counterpoint</title>
      <description>&lt;p&gt;The &lt;a href="http://www.pragprog.com/"&gt;Pragmatic Programmer&lt;/a&gt;  folks have a new book out called &lt;a href="http://www.pragprog.com/titles/dhnako/domain-driven-design-using-naked-objects"&gt;Domain-Driven Design Using Naked Objects&lt;/a&gt;  which caught my attention.  The title caught my attention, and I figured the author was using Naked Objects in the same vein as Jamie Oliver as &amp;#8220;The Naked Chef&amp;#8221; (old series on Food Network).  Essentially, the ingredients are used to their full potential, complimenting each other without the heavy use of spice.  So I decided to do some research on where this came from.  My suspicions were confirmed, and made even more sense when I found the original thesis came from someone at Trinity College, Dublin.&lt;/p&gt;


	&lt;p&gt;I found the original thesis by Richard Pawson entitled &lt;a href="http://www.nakedobjects.org/downloads/Pawson%20thesis.pdf"&gt;Naked objects&lt;/a&gt;  where he details the principles behind the concept.  The thesis is very readable, as theses go.  It is broken up into an introduction, a case study, guiding principles, etc.  What I found more interesting was the forward written by the pioneer of the &lt;span class="caps"&gt;MVC&lt;/span&gt; pattern, Trygve Reenskaug.  The concept of Naked Objects isn&amp;#8217;t exactly new, and it should be lauded for its intent of getting back to the proper intent of object oriented design and programming.  Of course, as a technology, and as some of the design constraints of naked objects, the thesis is not without detractors.  For example a short paper by Larry Constantine called &lt;a href="http://foruse.com/articles/nakedobjects.pdf"&gt;The Emperor Has No Clothes: Naked Objects Meet the Interface&lt;/a&gt; .&lt;/p&gt;


	&lt;p&gt;The true value in something like Naked Objects is to get you to adjust the way you are thinking.  The main concept is to build the complete logic of the system using a finite set of domain objects.  The framework is designed to take care of database persistence and user interface.  According to the forward in the thesis, the spirit behind &lt;span class="caps"&gt;MVC&lt;/span&gt; is that each view is mapped to only one object, although each object might be mapped to many views.  The controller is responsible for mapping the events of the view (inputs, etc.) to the domain model.  Essentially the domain model (or model) uses views for output and controllers for input.  This is different from the way it was originally described to me and I originally understood the pattern.  Pawson argues that the framework can generate the user interface views and controllers automatically.  Further advances in the concept also automatically maps the domain model to a relational database using &lt;a href="https://www.hibernate.org/"&gt;Hibernate&lt;/a&gt; .&lt;/p&gt;


	&lt;p&gt;The software developer side of me likes this concept.  It&amp;#8217;s less plumbing to worry about.  I don&amp;#8217;t have to know how to code a user interface.  I can get my work done quicker.  However, the user interface design side of me loathes the concept because the user interface (admittedly by Pawson) is not easily grasped without training, nor is it particularly accessible.  The architect in me is thinking about how I can have my cake and eat it too.  Ignoring the problem of database mapping for a moment, the real challenge is in the view/controller (VC) layer.  Pawson sites arguments from advocates of Object Oriented User Interface (OOUI) design that there is only one true correct way of representing an object.  Yet turns around and presents two: an icon to represent the object and a dialog box to represent the content in the object.  In my own project I am working on now, there are at least two representations of every object: the view in a list, and the view of the full content of the object.  Nevertheless, there still remains concepts I can leverage.&lt;/p&gt;


	&lt;p&gt;In some respects &lt;a href="http://wicket.apache.org"&gt;Wicket&lt;/a&gt;  would be an ideal candidate for dynamic generation of VC code.  Or at the very least, due to its attempt to treat the view layer in an object oriented manner, some extensions to the application can dynamically generate the controller side.  I have some reservations about pursuing that too far at the moment.  The real conundrum is in the presentation layer.  Managing information and behavior is something that object oriented languages are designed to handle.  It is right and good to take advantage of the features of your language to properly model the business domain.  However, representing that same information to the user in a way that makes sense to the user is a completely different discipline.  I can argue against the principles in &lt;span class="caps"&gt;OOUI&lt;/span&gt; till I&amp;#8217;m blue in the face, but that doesn&amp;#8217;t solve the fundamental problem.&lt;/p&gt;


	&lt;p&gt;What we need is a way for the programmers to create the functionally complete object oriented domain model, while your user interface specialists concentrate on their responsibility.  While frameworks such as Wicket have tried to address that very problem, it is my personal opinion that they fall a little short.  I don&amp;#8217;t think the fault lies with Wicket.  The fault lies within the current set of &lt;span class="caps"&gt;W3C&lt;/span&gt; standards and differing levels of browser compliance.  The &lt;span class="caps"&gt;W3C&lt;/span&gt; is still stuck on a model that prefers static information.  If the &lt;span class="caps"&gt;W3C&lt;/span&gt; were to truly pursue a model where the user interface layer is bound to certain objects and the browser makes calls to the server to render these objects we might have a better solution.  We&amp;#8217;ve already started down this path with &lt;span class="caps"&gt;AJAX&lt;/span&gt; and the myriad of Javascript frameworks to make this work.  Needless to say that there is a lot of future work that has to be done in order to truly see a synergy from functionally complete domain models and an object oriented user interfaces.&lt;/p&gt;


The goal of such an endeavor should be to allow user interface designers these freedoms:
	&lt;ul&gt;
	&lt;li&gt;Create the representations of the objects as they see fit&lt;/li&gt;
		&lt;li&gt;Create the rules of how to select the correct view from the different possibilities.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The controller logic should be built into the browser already, in terms of invoking the domain model (or representations of a remote object).&lt;/p&gt;


	&lt;p&gt;While I&amp;#8217;m on the subject of Naked Objects and domain models, I&amp;#8217;d like to make a minor rant on Object/Relational Mapping tools.  One of the problems is that &lt;span class="caps"&gt;ORM&lt;/span&gt; tools tend to require accessor and mutator methods (getters and setters) for every field that is going to be persisted to the database.  While you are &lt;em&gt;technically&lt;/em&gt; encapsulating the internal state of the object, in 99.44% of the cases there is no difference in using the accessor and mutator methods and directly accessing the underlying attributes of the class.  In a properly designed object, you only need to expose information via accessors that the user is allowed to see, and you only provide mutator methods for what the user is allowed to change.  &lt;span class="caps"&gt;ORM&lt;/span&gt; tools require you to violate those principles if you want to persist the information down to the database.  Some &lt;span class="caps"&gt;ORM&lt;/span&gt; tools (ActiveRecord) generates these accessors and mutators dynamically for you.  That&amp;#8217;s great for convenience, but terrible for a properly designed domain model.  For the time being, there really is no alternative unless you write the &lt;span class="caps"&gt;ORM&lt;/span&gt; layer yourself.  Not recommended if you can help it.&lt;/p&gt;</description>
      <pubDate>Fri, 18 Dec 2009 14:27:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c5e2d08d-66ce-4de7-b918-1b00ed550077</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/12/18/naked-objects-point-counterpoint</link>
      <category>naked</category>
      <category>objects</category>
      <category>orm</category>
      <category>wicket</category>
      <category>domain</category>
      <category>model</category>
      <category>design</category>
      <category>user</category>
      <category>interface</category>
    </item>
    <item>
      <title>Wicket Impressions</title>
      <description>&lt;p&gt;I chose Wicket for this project, partly because I met some people who were very enthusiastic about the framework, and partly because I wanted something that was easily tested.  My client requires a Java solution, so Ruby on Rails was out.  I did a quick little shoot out between three Java framework options, and Wicket passed the first impression stage.&lt;/p&gt;


	&lt;p&gt;Now I&amp;#8217;ve got a couple of iterations of software development with it under my belt and I&amp;#8217;m starting to feel a bit more comfortable with the framework.  As far as Java web frameworks go, its pretty good, but&amp;#8230;  I would do things a bit differently.  The application is written in a style that would actually better fit Ruby, SmallTalk, Lisp, or some language that supported passing in procedures or lambdas (as the language gurus call them) natively.  Take for instance the Link class.  In order to do anything useful, you need to subclass and implement the &lt;code&gt;onClick&lt;/code&gt; callback method&amp;#8212;even if all you want is to go to another page.  Here is an example:&lt;/p&gt;


&lt;pre&gt;
add(new Link("wicketId") {
    @Override
    public void onClick() {
        // do fancy logic
        setResponsePage(new IncidentPage(incident));
    }
});
&lt;/pre&gt;

	&lt;p&gt;If this were Ruby the code would look like something like this:&lt;/p&gt;


&lt;pre&gt;
self &amp;lt;&amp;lt; Link.new("wicketId") do 
    // do fancy logic
    respond_with(IncidentPage.new(incident)
end
&lt;/pre&gt;

	&lt;p&gt;So am I complaining about semantics?  Possibly.  However, there are more &amp;#8220;Java&amp;#8221; ways of accomplishing the same class&amp;#8212;particularly if you want to manage all business logic in a few classes.  The more &amp;#8220;Java&amp;#8221; way would be something like using the java.lang.Runnable interface.  That would allow you to set up an enum to include all your business logic like this:&lt;/p&gt;


&lt;pre&gt;
enum IncidentLogic implements Runnable {
    EDIT {
        @Override
        public Page run() {
            // do fancy logic
            return new IncidentPage(incident);
        }
    }
}
&lt;/pre&gt;

	&lt;p&gt;and it would be used in your page like this:&lt;/p&gt;


&lt;pre&gt;
add(new Link("wicketId", IncidentLogic.EDIT));
&lt;/pre&gt;

	&lt;p&gt;I&amp;#8217;ve also experimented with using a dynamic proxy to bind any method to an interface.  That would let you set up a logic utility class and reference it like this:&lt;/p&gt;


&lt;pre&gt;
add(new Link("wicketId", Linker.link(IncidentUtility.class, "edit"));
&lt;/pre&gt;

	&lt;p&gt;It&amp;#8217;s not as pretty but it works.  Now here&amp;#8217;s the nice thing about Wicket.  If I feel strongly enough about it, I can create my own subclass of the Link object to implement that approach myself.  My DynamicLink would look something like this:&lt;/p&gt;


&lt;pre&gt;
public class DynamicLink extends Link {
    public static interface Executable {
        Page do();
    }

    private final DynamicLink.Executable click;

    public DynamicLink(String wicketId, DynamicLink.Executable action) {
        super(wicketId);
        this.click = action;
    }

    @Override
    public void onClick() {
        setResponsePage(click.do());
    }
}
&lt;/pre&gt;

	&lt;p&gt;In fact, I think I may just do that.  It&amp;#8217;s better than having bits and pieces of behavior spread throughout the Pages and panels defined in the application.  I think I find it a bit frustrating when i need to do things like that just to format dates the way I want.  Why can&amp;#8217;t the provided DateFormatter let you set the pattern you wanted to use?  Why do I have to subclass the one in Wicket just to get that feature?&lt;/p&gt;


	&lt;p&gt;At the end of the day, my complaints are minor and the Wicket community is helpful.  I&amp;#8217;m fine with that.  The Wicket framework is probably one of the leaders in providing a test harness that can be used easily in your JUnit tests.  That is a much bigger selling point to me.&lt;/p&gt;</description>
      <pubDate>Fri, 04 Dec 2009 14:02:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:76c6c437-6c1b-42a8-b5f1-69fd083eb958</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/12/04/wicket-impressions</link>
      <category>wicket</category>
      <category>java</category>
      <category>web</category>
      <category>framework</category>
      <category>impressions</category>
      <category>review</category>
    </item>
    <item>
      <title>Wicket, Spring, Hibernate, Testing... Yeah, it's like that.</title>
      <description>&lt;p&gt;I have to deliver a product using Java.  Due to politics and approved baselines, etc.  I can&amp;#8217;t use Ruby on Rails.  I&amp;#8217;ve done my own thing in the past, and so this time I decided to save some time by incorporating Wicket, Spring, and Hibernate using auto-wiring, and attributes.  Getting it all to talk together took the better part of a day, but I got it to deploy and run fine.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m an avid unit tester, so I was happy to learn that Wicket has some facilities to make testing a bit easier without forcing you to create your own Servlet mock objects.  I was really happy about that, so I decided to try it out.  Unfortunately, I ran into a rather nasty roadblock.  Spring was complaining about the ContextLoaderListener not being loaded.  It&amp;#8217;s defined in my web.xml file, but the autowiring requires the spring context to be loaded in a particular location.  Finding out how to fix that problem took me the better part of half a day.&lt;/p&gt;


	&lt;p&gt;The problem is that Wicket hides the &lt;code&gt;ServletContext&lt;/code&gt; object away from you.  You can&amp;#8217;t add values, because the test framework is initialized on construction.  Attempts to obtain the ServletContext and manually add the Spring web application context just weren&amp;#8217;t working.  That&amp;#8217;s because it is configured when the &lt;code&gt;WicketTester&lt;/code&gt; object is constructed and ignored after that.  I needed to be able to inject my own ServletContext with the Spring integration taken care of.  I finally figured it out here, because the forums just working for me.  Please note that this is tested with Wicket 1.4 and not any of the earlier versions:&lt;/p&gt;


&lt;pre&gt;
final MyApplication app = new MyApplication();
tester = new WicketTester(app) {
    @Override
    public ServletContext newServletContext(final String path) {
        // web context
        ServletContext context = new MockServletContext(app, path);
        // spring context
        XmlWebApplicationContext spring = new XmlWebApplicationContext();
        spring.setServletContext(context);
        // configure spring
        spring.setConfigLocation("classpath:application.xml");

        // put spring where Wicket can find it
        context.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, spring);
        return context;
    }
};
&lt;/pre&gt;

	&lt;p&gt;So let me explain what I did.  I created an anonymous subclass of the &lt;code&gt;WicketTester&lt;/code&gt; class so I could override the factory method &amp;#8220;newServletContext&amp;#8221; to inject my spring configuration.  Done properly, the wicket folks can take care of this by providing a &lt;code&gt;SpringWicketTester&lt;/code&gt; subclass in their spring integration library.  The SpringWicketTester would let you specify the location of your Spring configuration file, and it would override that method for you.  For now, you&amp;#8217;ll have to do it yourself.&lt;/p&gt;


	&lt;p&gt;I put the WicketTester initialization in a subclass of the JUnit &lt;code&gt;TestCase&lt;/code&gt; class.  That way I don&amp;#8217;t have to repeat myself for setting up my Wicket testing.&lt;/p&gt;</description>
      <pubDate>Tue, 10 Nov 2009 16:57:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9a6bec44-047e-4fbb-b82e-81f78ce4d1f0</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/11/10/wicket-spring-hibernate-testing-yeah-its-like-that</link>
      <category>wicket</category>
      <category>wicket14</category>
      <category>spring</category>
      <category>hibernate</category>
      <category>junit</category>
      <category>testing</category>
      <category>framework</category>
      <category>web</category>
      <category>java</category>
    </item>
    <item>
      <title>Ruby IDEs Come of Age</title>
      <description>&lt;div style="float: right;background-color: #505050;text-align:center;"&gt;&lt;a href="http://aptana.org"&gt;&lt;img src="http://aptana.org/images/logo.png" alt="Aptana logo" border="0"/&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;a href="http://www.jetbrains.com/ruby/nextversion/index.html"&gt;&lt;img src="http://www.jetbrains.com/img/banners/rm2beta_sb.png" alt="RubyMine 2.0" border="0"/&gt;&lt;/a&gt;&lt;/div&gt;
There&amp;#8217;s nothing better than finding that sweet spot with developing your software where your tools work with you, and all is right with the world.  With Java that started when JetBrains introduced their IntelliJ &lt;span class="caps"&gt;IDEA&lt;/span&gt; product.  That product changed the way we think about integrated development environments, and even the open source alternatives like &lt;a href="http://eclipse.org"&gt;Eclipse&lt;/a&gt;  imitated the features included in the &lt;span class="caps"&gt;IDEA&lt;/span&gt; product.  At some point they specialized differently, each with their own set of pros and cons.

	&lt;p&gt;The Ruby development environment lagged seriously behind with people content to use glorified text editors.&lt;/p&gt;


	&lt;p&gt;Ruby on Rails brought a whole new community of developers to the Ruby platform, many who were curious malcontents from the Java arena like me.  For folks who were used to the &lt;span class="caps"&gt;IDE&lt;/span&gt; integrating with your version control system, and even your issue tracking system, going back to text editors alone wasn&amp;#8217;t going to cut it.  Yet, so strong was the pull from Rails that some enterprising folks started creating a Ruby &lt;span class="caps"&gt;IDE&lt;/span&gt;: RadRails.  RadRails is now a plugin for the Aptana web development platform, and Eclipse based tool.  &lt;a href="http://aptana.org"&gt;Aptana&lt;/a&gt; was my &lt;span class="caps"&gt;IDE&lt;/span&gt; of choice for quite a while.  Since I was already used to Eclipse, and I had a set of plugins that I already enjoyed using, there really wasn&amp;#8217;t much reason to switch.  Except for this nagging feeling things could be better.  I was still sorely missing refactorings, decent intentions, and working type-ahead for the Ruby &lt;span class="caps"&gt;API&lt;/span&gt;.  Sure I was aware of the technical limitations, but I knew it could be done.&lt;/p&gt;


	&lt;p&gt;I limped along until I noticed that the &lt;a href="http://ruby-lang.org"&gt;Ruby Language&lt;/a&gt;  had made Ruby 1.9.1 the new official Ruby.  It had Rake and RubyGems as standard components, so there will be no issues with the stinking Linux distros that refuse to make an &lt;span class="caps"&gt;RPM&lt;/span&gt; for RubyGems.  It&amp;#8217;s all included.  Of course, there are still some growing pains with some gems.  Check out &lt;a href="http://isitruby19.com/"&gt;Is it Ruby 1.9&lt;/a&gt;  for details (they have a sister site for JRuby in case you are interested).  I had an upgrade project ahead of me that required some features from Ruby 2.3.x, cleaning up, and security enhancements.  Since I had to re-implement the site anyway, Ruby 1.9 was measured to execute faster, and I had the liberty of doing so, I decided to make Ruby 1.9.1p243 the new baseline.&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s where my troubles began.  It wasn&amp;#8217;t just the Gems either.  The IDEs just couldn&amp;#8217;t handle it.  They turned into glorified text editors with the ability to track commits.  The debug feature was broken.&lt;/p&gt;


	&lt;p&gt;I remembered the Zen like experience that I had with JetBrains &lt;span class="caps"&gt;IDEA&lt;/span&gt; from the Java world, and knew they also had a product for .NET.  I hoped they had a product for Ruby, and sure enough they have the &lt;a href="http://www.jetbrains.com/ruby/"&gt;RubyMine&lt;/a&gt;  product.  If you are looking at Ruby 1.9, or Rails 2.3.3+ don&amp;#8217;t look at RubyMine 1.1.1.  Look at their new RubyMine 2.0-beta.  This is what Ruby programming should be.  The price point is currently $79 &lt;span class="caps"&gt;USD&lt;/span&gt; with the current promotion, but normally it is $99.  That puts it in the range that mere mortals like me can afford.  It works quite nicely with Ruby 1.9, and even Rails 2.3.4 (although that wasn&amp;#8217;t the version they developed against).  I have my refactorings, my intentions, my effortless subversion integration.  Formatting works.  It&amp;#8217;s fast.  Type-ahead doesn&amp;#8217;t flake out.  Debug works (made possible with coordinated efforts between myself, the debug-ruby-ide gem maintainer and the JetBrains team&amp;#8212;the latter two doing the heavy lifting).  Let me tell you, JetBrains is as good and responsive as they always were, and the Ruby community is like the Java community used to be, but better and more pragmatic.&lt;/p&gt;


	&lt;p&gt;Aptana and RadRails will catch up, it&amp;#8217;s a matter of time.  However, JetBrains RubyMine works now, and it works better and faster than Aptana.  On Windows, RubyMine performance is acceptable (on par with Eclipse), but on Mac it sings.  Eclipse/Aptana&amp;#8217;s performance doesn&amp;#8217;t change no matter what platform you are on.&lt;/p&gt;


	&lt;p&gt;While I&amp;#8217;m at it, I do have a major gripe with the Eclipse baseline.  As a developer, I have a list of plugins I depend on because those features don&amp;#8217;t come out of the box with Eclipse.  However, the Eclipse developers who are ever moving forward, break the plugin &lt;span class="caps"&gt;API&lt;/span&gt; and the plugins I need to use.  I can&amp;#8217;t download a version of Eclipse and expect it to work properly.  Then, if I have to hunt around for an older version, God help me.  At least Aptana goes through great efforts to provide a stable and usable baseline.  OK Eclipse, how is it that you provide an &lt;span class="caps"&gt;IDE&lt;/span&gt; for developing enterprise applications, and you don&amp;#8217;t bundle the plugins for Subversion, &lt;span class="caps"&gt;CVS&lt;/span&gt;, and &lt;span class="caps"&gt;GIT&lt;/span&gt;?  If Aptana can do it, why can&amp;#8217;t you?  It&amp;#8217;s unthinkable that a responsible developer will touch code without the safety net of a version control system.  Give them tools out of the box so they don&amp;#8217;t have to separately install these plugins.  Support the open source projects around you, so open source version control systems should have preferred status.  And don&amp;#8217;t release a version of Eclipse until you&amp;#8217;ve got those plugins working with it.  Really.  I mean it.  It helps you out in the long run.&lt;/p&gt;</description>
      <pubDate>Fri, 16 Oct 2009 02:07:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:27821451-605a-49e3-ab23-c6072dd9c7b3</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/10/16/ruby-ides-come-of-age</link>
      <category>review</category>
      <category>IDE</category>
      <category>ruby</category>
      <category>Eclipse</category>
      <category>Aptana</category>
      <category>RubyMine</category>
      <category>IDEA</category>
      <category>Ruby19</category>
    </item>
    <item>
      <title>Web Accessibility</title>
      <description>&lt;p&gt;I&amp;#8217;ve been spending a lot of time looking into accessibility for web sites to finally get a grip on what needs to be done.  Sadly, it is overlooked by the big guys when it doesn&amp;#8217;t really have to be so hard.  There are several types of disabilities including:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Visual (full, partial, or color blindness; Photo-Epileptic Seizure [PES] susceptibility)&lt;/li&gt;
		&lt;li&gt;Motor control (full or partial disabilities preventing the use of a mouse)&lt;/li&gt;
		&lt;li&gt;Cognitive disorders (dyslexia and the like)&lt;/li&gt;
		&lt;li&gt;Auditory (full or partial deafness)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The main issue with accessibility is the lack of knowledge and reasonable resources available to help.  In particular, the tools that are needed to support people who have the disabilities are expensive and complicated.  There are tools available that everyone can have at their fingertips that will help.  Most are Firefox plugins, some require you to use an external site.  Below are a few of the resources I&amp;#8217;ve found:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/402"&gt;Fangs screen reader emulator&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://juicystudio.com/article/colour-contrast-analyser-firefox-extension.php"&gt;Color contrast analyzer&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.totalvalidator.com/"&gt;Total validator&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://colorfilter.wickline.org/"&gt;Colorblind Webpage Filter&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The folks at &lt;a href="http://webaim.org/resources/quickref/"&gt;WebAIM&lt;/a&gt;  have several good recommendations.  For example, you know those &amp;#8220;edit in place&amp;#8221; controls on Flickr?  You can make them keyboard accessible by applying the attribute &amp;#8220;taborder=&amp;#8217;0&amp;#8217;&amp;#8221;.  The control will be in the page&amp;#8217;s natural tab order.  I did a little experimentation and the control supplied by &lt;a href="http://script.aculo.us"&gt;Script.aculo.us&lt;/a&gt;  can take care of all these things for you.  The only issue is that &lt;span class="caps"&gt;IE 6&lt;/span&gt; won&amp;#8217;t put the control in the tab order unless it is in the original markup.  Dynamically changing the &lt;span class="caps"&gt;DOM&lt;/span&gt; to put it in won&amp;#8217;t put the control in the tab order with that browser.&lt;/p&gt;</description>
      <pubDate>Tue, 04 Aug 2009 15:08:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:55c4782a-5a28-4025-91ca-5ebe7333c0ef</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/08/04/web-accessibility</link>
      <category>accessibility</category>
      <category>web</category>
      <category>design</category>
      <category>tools</category>
    </item>
    <item>
      <title>Web Design 101</title>
      <description>&lt;p&gt;This is a departure from the film and darkroom printing posts, so apologies and I&amp;#8217;ll be back on that later.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;d like to think I&amp;#8217;m a pretty good application designer, although some of the things that I&amp;#8217;ve seen on other sites have left me a bit jealous.  Face it, I didn&amp;#8217;t have a background in web design.  I know what I &lt;em&gt;should&lt;/em&gt; be able to do, and what it ends up looking like.  The problem is familiar to anyone who has designed for the web: IE and non-standard implementations of &lt;span class="caps"&gt;HTML&lt;/span&gt;, JavaScript, &lt;span class="caps"&gt;CSS&lt;/span&gt;, etc.  The way it&amp;#8217;s supposed to work is you whip open the standards, see what &lt;span class="caps"&gt;CSS&lt;/span&gt; can do for your style, and do it.  When you see impressive use of &lt;span class="caps"&gt;CSS&lt;/span&gt; from the &lt;a href="http://www.csszengarden.com/"&gt;&lt;span class="caps"&gt;CSS&lt;/span&gt; Zen Garden&lt;/a&gt;  you start thinking, why can&amp;#8217;t I do that?&lt;/p&gt;


	&lt;p&gt;I come from an application development background, where we can design our desktop apps with nice grid based layouts and do all kinds of fancy things.  From there I went on to web development, and have always been frustrated with my inability to escape using tables for layout.  Tables are great for lining things up, but they can cause their own issues when you start incorporating &lt;span class="caps"&gt;AJAX&lt;/span&gt; and other goodies.  Then you have to worry about what your client&amp;#8217;s browsers can do and what they can&amp;#8217;t do.  At least I don&amp;#8217;t have to worry about Netscape 4 and it&amp;#8217;s 30 second lag time to sort out nested tables anymore.&lt;/p&gt;


	&lt;p&gt;So, I think I&amp;#8217;ve solved the worst of my problems.  I solved the nonstandard JavaScript implementation problem by using &lt;a href="http://prototypejs.org"&gt;Prototype.js&lt;/a&gt;  which really made it easy to take care of &lt;span class="caps"&gt;AJAX&lt;/span&gt; support for tags and made some of my complex form handling easier.  I was still doing my own JavaScript implementations of type-ahead controls and the like.  Then I discovered &lt;a href="http://script.aculo.us"&gt;Scriptaculous&lt;/a&gt;  which took the pain out of 90% of the more advanced control issues I had.&lt;/p&gt;


	&lt;p&gt;But what could be done between the presentation hell that Internet Explorer puts me through compared to other browsers on the market?  IE positioned things just a bit off, and handled the positioning of divs a little crazy as well.  If I was going to both have a nice visual grid layout and use markup the way it was intended, I needed a solution like prototype and scriptaculous to help me out.  Enter &lt;a href="http://blueprintcss.org"&gt;Blueprint &lt;span class="caps"&gt;CSS&lt;/span&gt;&lt;/a&gt;  to take away the pain and suffering of using divs to align your content.  Now blueprint provides some nice little &amp;#8220;plugins&amp;#8221; that use &lt;span class="caps"&gt;CSS&lt;/span&gt; to do pretty buttons or decorate links with graphic icons all with pure &lt;span class="caps"&gt;CSS&lt;/span&gt;.  The graphic icons degrade gracefully as &lt;span class="caps"&gt;IE 6&lt;/span&gt; does not support the type of selectors it uses.  However, the library included a couple PNGs with transparencies.  So what does one do about the fact that &lt;span class="caps"&gt;IE 6&lt;/span&gt; does not render that nicely?  Fix it up with &lt;a href="http://labs.unitinteractive.com/unitpngfix.php"&gt;Unit &lt;span class="caps"&gt;PNG&lt;/span&gt; Fix&lt;/a&gt;  of course.&lt;/p&gt;


	&lt;p&gt;Now my header looks like this:&lt;/p&gt;


&lt;pre&gt;
    &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;My Site&amp;lt;/title&amp;gt;
        &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;
        &amp;lt;link rel="stylesheet" href="css/screen.css" type="text/css" media="screen, projection"&amp;gt;
        &amp;lt;link rel="stylesheet" href="css/print.css" type="text/css" media="print"&amp;gt;
        &amp;lt;!-- Fix nonstandard IE spacing --&amp;gt;
        &amp;lt;!--[if lt IE 8]&amp;gt;&amp;lt;link rel="stylesheet" href="css/ie.css" type="text/css" media="screen, projection"&amp;gt;&amp;lt;![endif]--&amp;gt;

        &amp;lt;!-- Site CSS --&amp;gt;
        &amp;lt;link type="text/css" href="css/mysite.css" rel="stylesheet"/&amp;gt;

        &amp;lt;!-- Fix IE6 PNG transparency issues --&amp;gt;
        &amp;lt;!--[if lte IE 6]&amp;gt;&amp;lt;script type="text/javascript" src="lib/unitpngfix.js"&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;![endif]--&amp;gt;

        &amp;lt;!-- Prototype.js/Script.aculo.us  --&amp;gt;
        &amp;lt;script type="text/javascript" src="lib/prototype/prototype.js"&amp;gt;&amp;lt;/script&amp;gt;
        &amp;lt;script type="text/javascript" src="lib/scriptaculous/scriptaculous.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;/head&amp;gt;
&lt;/pre&gt;

	&lt;p&gt;It seems like a lot, but it makes my life so much easier.  I highly recommend &lt;a href="http://headfirstlabs.com/books/hfwd/"&gt;Head First Web Design&lt;/a&gt;  as it covers all these wonderful concepts and more.&lt;/p&gt;</description>
      <pubDate>Fri, 17 Jul 2009 19:25:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:350b4587-3156-4f81-b2b2-c71c665ffa42</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/07/17/web-design-101</link>
      <category>web</category>
      <category>design</category>
      <category>javascript</category>
      <category>scriptaculous</category>
      <category>prototypejs</category>
      <category>blueprintcss</category>
      <category>css</category>
    </item>
    <item>
      <title>Print a Month Project</title>
      <description>&lt;p&gt;Starting in July, I&amp;#8217;m starting a new project to help sharpen my skills and maintain a consistent production.  The basic principles are as follows:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Every month I take a new picture&lt;/li&gt;
		&lt;li&gt;That picture is then manipulated and prepared to the best of my ability&lt;/li&gt;
		&lt;li&gt;The final result is a matted print&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The goals are to fine tune my process, try new techniques, and increase my proficiency.  The reason for dealing with a print is is for the work to reach its full potential.&lt;/p&gt;


	&lt;p&gt;Why every month, and not every week or every day?  Mainly because I want to have an attainable goal.  Something that is reasonable for me to do, yet will push me.  Due to my schedule between work and church, I have far less time than I really want in the darkroom.  I&amp;#8217;m trying to make better use of my time in the darkroom.  Additionally, the goal of one print a month allows me to really dig deep into a print and experiment with ways to make it better through dodging, burning, toning, or more creative approaches.&lt;/p&gt;</description>
      <pubDate>Fri, 26 Jun 2009 12:44:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ce242972-1f0a-441e-974f-349e82ffdd94</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/06/26/print-a-month-project</link>
      <category>project</category>
      <category>darkroom</category>
      <category>print</category>
      <category>final</category>
    </item>
    <item>
      <title>&amp;quot;Beyond&amp;quot; the Zone System</title>
      <description>&lt;p&gt;In the process of trying to coerce a working system in my darkroom, I purchased the book &amp;#8220;Beyond the Zone System&amp;#8221; because I know it has a lot to help understand sensitometry.  What appeals to me is the ability to both test the speed of your film and the development time within 6 sheets.  Since Ansel Adam&amp;#8217;s film speed test takes seven sheets and an unknown amount of sheets for the dev test (at least one but in practice a few more), I&amp;#8217;m all about conserving resources.  The cost of the sheet of film is only one part of the cost&amp;#8212;it&amp;#8217;s the investment in time that I&amp;#8217;m most concerned about.&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;BTZS&lt;/span&gt; starts out with a nice little overview of how paper and film work together to make the finished image.  It also has a review of all the types of math and graphing theory that pertains to this testing process.  The math&amp;#8217;s not that hard, but the problem is in the way it&amp;#8217;s presented.  You can tell the author has a wealth of information, and he tries to make it accessible all in one or two chapters, but you almost end in confusion.&lt;/p&gt;


	&lt;p&gt;Where my head really starts swimming is when he gets in to calculating film speed.  With Ansel Adams, it&amp;#8217;s simply a density of 0.1 over film base+fog.  The author covers the history and the pros and cons of how film speed was calculated over time, instead of just choosing one and teach how to do that one.  It&amp;#8217;s useful information, but the alternatives could be moved to an appendix to make that section more accessible.&lt;/p&gt;


	&lt;p&gt;With a proper handle of the basics of how the film and paper relate to each other, you can intelligently make decisions on exposure, development, and printing decisions.  The road to understanding taken in the &lt;span class="caps"&gt;BTZS&lt;/span&gt; approach is very technical, which is not for the feint of heart.  However, once you&amp;#8217;ve learned the basics, you learn useful bits of information.  For example, changing development times is similar to changing apertures&amp;#8212;they both follow the same geometric progression of numbers (4, 5.6, 8, 11, 16&amp;#8230;) to produce the same changes in final density.  Shutter speed times and film speed numbers follow the same progression of numbers.&lt;/p&gt;


	&lt;p&gt;If you are serious about understanding more about how your materials work and respond to light, this book is definitely something you should have in your library.  It will take time to &amp;#8220;get it&amp;#8221;, but once you do it will help you with your final results.  You have a better understanding of why you choose a particular density for your print materials.  You also have a better understanding of how zones don&amp;#8217;t equal stops of exposure&amp;#8212;yet the two still relate predictably.&lt;/p&gt;</description>
      <pubDate>Mon, 22 Jun 2009 12:14:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0a3954a9-f87a-45d3-a9dd-827bc4381f01</guid>
      <author>Berin Loritsch</author>
      <link>http://bloritsch.d-haven.net/articles/2009/06/22/beyond-the-zone-system</link>
      <category>zone</category>
      <category>system</category>
      <category>exposure</category>
      <category>BTZS</category>
      <category>book</category>
      <category>review</category>
    </item>
  </channel>
</rss>
