<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Third Party on Craig Pardey</title>
    <link>https://www.craigpardey.com/tags/third-party/</link>
    <description>Recent content in Third Party on Craig Pardey</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 28 Mar 2012 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.craigpardey.com/tags/third-party/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How to insulate yourself from static methods</title>
      <link>https://www.craigpardey.com/post/2012-03-28-how-to-insulate-yourself-from-static-methods/</link>
      <pubDate>Wed, 28 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.craigpardey.com/post/2012-03-28-how-to-insulate-yourself-from-static-methods/</guid>
      <description>&lt;p&gt;Sometimes your code needs to call a static method in a 3rd party library and&#xA;unit testing  suddenly becomes difficult, particularly when that static method&#xA;requires context in order to work.&lt;/p&gt;&#xA;&lt;p&gt;Enter the insulating class (also known as a Facade).&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new interface that declares a method with the same signature as the static method you want to delegate to&lt;/li&gt;&#xA;&lt;li&gt;Create a new Facade class that implements the interface&lt;/li&gt;&#xA;&lt;li&gt;Replace the calls to the static method with calls to your new Facade class&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s assume that the method you need to call looks like this&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to be Agile when using 3rd party software framework</title>
      <link>https://www.craigpardey.com/post/2012-02-17-how-to-be-agile-when-using-3rd-party-software-framework/</link>
      <pubDate>Fri, 17 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.craigpardey.com/post/2012-02-17-how-to-be-agile-when-using-3rd-party-software-framework/</guid>
      <description>&lt;p&gt;It can be difficult to be Agile when working with 3rd party software&#xA;framework.  The vendor product may dictate many aspects of the software&#xA;architecture thwarting your attempts at automated testing and continuous&#xA;build.&lt;/p&gt;&#xA;&lt;p&gt;However there are steps you can take to make Agile easier.  I&amp;rsquo;ll discuss a few&#xA;of the options that have worked for me on my current project.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Insulate yourself from static methods.&lt;/li&gt;&#xA;&lt;li&gt;Introduce wrappers (Facades) to vendor classes.&lt;/li&gt;&#xA;&lt;li&gt;Introduce Spring, with different contexts for testing vs production, to allow easy substitution of vendor classes.&lt;/li&gt;&#xA;&lt;li&gt;Make use of mock objects for testing your code in isolation.&lt;/li&gt;&#xA;&lt;li&gt;If possible, move responsibility into services that live outside the framework.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In our particular case we&amp;rsquo;ve done all of the above and have managed to build a&#xA;stable system with respectable test coverage.  We&amp;rsquo;ve also engaged the vendor&#xA;to see if they can modify some of the framework interfaces to simplify unit&#xA;testing, and they have been open to our suggestions.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
