<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SwiftKey &#187; Tech Wizardry</title>
	<atom:link href="http://www.swiftkey.net/en/category/blog/tech-wizardry/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swiftkey.net/en</link>
	<description>Just another SwiftKey Language Network site</description>
	<lastBuildDate>Thu, 23 May 2013 10:34:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Scoble: SwiftKey No 1 reason I switched to Android</title>
		<link>http://www.swiftkey.net/en/blog/scoble-swiftkey-no-1-reason-i-switched-to-android/</link>
		<comments>http://www.swiftkey.net/en/blog/scoble-swiftkey-no-1-reason-i-switched-to-android/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 11:35:13 +0000</pubDate>
		<dc:creator>ruthbarnett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company news]]></category>
		<category><![CDATA[Tech Wizardry]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[ben medlock]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[keyboards]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[scoble]]></category>
		<category><![CDATA[SwiftKey]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/en/?p=5303</guid>
		<description><![CDATA[<p>Startup evangelist Robert Scoble recently said SwiftKey was the &#8220;number one reason&#8221; he switched from iOS to Android. He interviewed co-founder and CTO Ben Medlock because he wanted to find out more about the &#8220;geek behind SwiftKey&#8221;. Watch his Google Hangout with Ben and CMO Joe Braidwood here: Scoble, Rackspace&#8217;s Startup Liaison Officer and a familiar...</p><p>The post <a href="http://www.swiftkey.net/en/blog/scoble-swiftkey-no-1-reason-i-switched-to-android/">Scoble: SwiftKey No 1 reason I switched to Android</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Startup evangelist Robert Scoble <a title="Read more from Robert Scoble" href="https://plus.google.com/+Scobleizer/posts/bsgGmSGhnmY" target="_blank">recently said</a> SwiftKey was the &#8220;number one reason&#8221; he switched from iOS to Android.</p>
<p>He interviewed co-founder and CTO Ben Medlock because he wanted to find out more about the &#8220;geek behind SwiftKey&#8221;.</p>
<p>Watch his Google Hangout with Ben and CMO Joe Braidwood <a title="Robert Scoble on YouTube" href="https://www.youtube.com/watch?feature=player_embedded&amp;v=gwF2u4TdGaY#" target="_blank">here</a>:</p>
<div class="blog-video">
    			<iframe width=600 height=338 src=http://www.youtube.com/embed/gwF2u4TdGaY?autoplay=0&wmode=opaque frameborder=0 allowfullscreen></iframe>
			</div>
<p>Scoble, Rackspace&#8217;s Startup Liaison Officer and a familiar face on the tech scene around the world, said he&#8217;d only been using his Android smartphone a day but was already 40% faster at typing thanks to SwiftKey.</p>
<p>Where do you stand on Android versus iOS? Join the debate in the comments or on the<a title="Like SwiftKey on Facebook!" href="http://facebook.com/swiftkey" target="_blank"> SwiftKey Facebook page</a>.</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/scoble-swiftkey-no-1-reason-i-switched-to-android/">Scoble: SwiftKey No 1 reason I switched to Android</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/scoble-swiftkey-no-1-reason-i-switched-to-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bitbar &#8211; Automated cloud-based testing for Android</title>
		<link>http://www.swiftkey.net/en/blog/bitbar-automated-cloud-based-testing-for-android/</link>
		<comments>http://www.swiftkey.net/en/blog/bitbar-automated-cloud-based-testing-for-android/#comments</comments>
		<pubDate>Thu, 15 Nov 2012 15:07:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/?p=3676</guid>
		<description><![CDATA[<p>One of the things we enjoy at SwiftKey is meeting other companies, large and small, and sharing knowledge with them. Today we played host to Jouko Kaasila and Henri Kivelä from Bitbar, who came to talk to us about automated cloud-based testing for Android. Michele Sama (second from right), SwiftKey’s Test Architect, will tell us...</p><p>The post <a href="http://www.swiftkey.net/en/blog/bitbar-automated-cloud-based-testing-for-android/">Bitbar &#8211; Automated cloud-based testing for Android</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>One of the things we enjoy at SwiftKey is meeting other companies, large and small, and sharing knowledge with them.</p>
<p>Today we played host to Jouko Kaasila and Henri Kivelä from <a href="http://testdroid.com/" target="_blank">Bitbar</a>, who came to talk to us about automated cloud-based testing for Android.</p>
<p>Michele Sama (second from right), SwiftKey’s Test Architect, will tell us a little about what they talked about.</p>
<p><span id="more-3676"></span></p>
<p>Software testing is a critical activity for any software company. From a purely commercial perspective bugs and slow performance are the main reasons for which users stop using a piece of software. From a managerial perspective the cost, in terms of development time, of detecting and fixing bugs increases exponentially the longer a bug exists in the code.</p>
<p>The combination of continuous integration and automated testing is one of the most powerful instruments which quality engineers have to improve the quality of their software during any stage of development.</p>
<p>Developing for mobile platforms such Android proposes an additional challenge to traditional continuous integration systems: the variety of devices on which your software must work. It may sound obvious but even if your tests pass on an emulator your application may still have problems with certain devices. Such problems are known as “integration issues” and are detected by the so called “integration tests”.</p>
<p>Here at SwiftKey we support 7 versions of Android, on at least 10 different screen sizes with over 50 languages. To test all of those combinations we would have to run our integration tests on 7 * 10 * 50 = 3,500 configurations. This would be eventually possible by using, for instance, Jenkins and by running our tests on a matrix of configurations using the Android emulator.</p>
<p>Should we run our tests 3,500 times?</p>
<p>The answer is probably not. First, not all of those combinations exist, which means that in case of errors you will need to exclude false positives. Second, a configured emulator is still an emulator and it will not detect device-related integration faults. Third, when a single test fails then you will have 3,500 failures!</p>
<p>How should we run our integration tests then?</p>
<p>That is simple. You should run them on all the devices that you support. How much will it cost you? How difficult would it be to maintain them? Well&#8230; a lot.</p>
<p>The people at BitBar think they have the answer.</p>
<p>The idea behind Testdroid is simple. They own a cloud of devices, including more than 150 different models, and they let you run your tests on those devices using their web frontend. You can then configure a set of “must work” devices (including the most popular devices) and you run your tests on those at every commit using a Jenkins plugin.</p>
<p>The next step is to test the integration with more of the market devices to see which ones your application supports. Once again we can create two cluster of phones, one with all the “fully supported” devices and one with the “not fully supported” ones. You can then, daily or weekly or every now and then, check which devices you support and make sure that all the tests pass in those ones that are fully supported. On each test run Testdroid also collects CPU and memory usage of your execution, making it possible for quality engineers to check for performance issues or memory leaks. You can also select the language with which to configure your devices before the execution.</p>
<p>The latest addition to the tools available in Testdroid cloud is the Android app crawler. In a similar way in which a web crawler browses a web site, the app crawler explores your application view by view and generates a graph representation of each view, including a screenshot for each device. Being able to obtain screenshots from all the devices under test without manually clicking through is very useful.</p>
<p>One thing that scares me as a quality engineer is the adoption of new tools and library. Before adopting one I always need to write down what I call the “adoption risk analysis”. I absolutely do not want to be forced to ask the team to rewrite all the tests because we have to change a testing tool. With Testdroid this is absolutely not an issue. Testdroid runs (and generates) normal Android instrumentation tests which means that there are no adoption (and no leave) costs.</p>
<p>To thank Jouko and Henri for their visit, after all they came all the way from Finland to give us a talk, we decided to show them a preview of few new tools which we have developed internally.</p>
<p>Keith is a pre-build configuration tool which uses a set of Python scripts to change the Android resource files for a specific build. Keith lets you define products (targets) and modifiers (rules) and lets you apply modifiers to each product.</p>
<p>SlimChimp is a Java extension of MonkeyRunner inspired by ChimpChat which lets you install and control Android applications exploring the elements on the screen of the device. With SlimChimp not only we can install and enable SwiftKey as a keyboard during our tests but we can also test it on third party applications of which we do not have the source code.</p>
<p>Chauffeur is an Android testing support tool which avoids code duplication in your test setUp and tearDown method by configuring and restoring your test environment for you.</p>
<p>You will probably hear more about these tools in near future.</p>
<p>You can find out more about Bitbar and what they do at <a href="http://testdroid.com/" target="_blank">http://testdroid.com/</a>.</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/bitbar-automated-cloud-based-testing-for-android/">Bitbar &#8211; Automated cloud-based testing for Android</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/bitbar-automated-cloud-based-testing-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building APKs with different features from a single source</title>
		<link>http://www.swiftkey.net/en/blog/building-apks-with-different-features-from-a-single-source/</link>
		<comments>http://www.swiftkey.net/en/blog/building-apks-with-different-features-from-a-single-source/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 15:12:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/?p=1074</guid>
		<description><![CDATA[<p>This one is for the Android nerds out there! Today, at DroidCon UK 2011, I presented the TouchType way of dealing with configuring Android APKs. We&#8217;ve come up with a clean framework to generate different APKs from a single source tree according to given feature requirements. (Our system is a bit clever than the slides...</p><p>The post <a href="http://www.swiftkey.net/en/blog/building-apks-with-different-features-from-a-single-source/">Building APKs with different features from a single source</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>This one is for the Android nerds out there!</p>
<p>Today, at DroidCon UK 2011, I presented the TouchType way of dealing with configuring Android APKs. We&#8217;ve come up with a clean framework to generate different APKs from a single source tree according to given feature requirements. (Our system is a bit clever than the slides suggest, but it gives you a good basis to start from.)</p>
<p><a href="http://www.swiftkey.net/wp-content/uploads/2011/10/product_configuration.pdf">Download the presentation slides here</a></p>
<p>My question to you is this: If we open-sourced our framework for APK configuration would you find it beneficial?</p>
<p>Chetan.</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/building-apks-with-different-features-from-a-single-source/">Building APKs with different features from a single source</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/building-apks-with-different-features-from-a-single-source/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Test-Driven Development on Android using native Scala Mocking and Dependency Injection</title>
		<link>http://www.swiftkey.net/en/blog/test-driven-development-on-android-using-native-scala-mocking-and-dependency-injection/</link>
		<comments>http://www.swiftkey.net/en/blog/test-driven-development-on-android-using-native-scala-mocking-and-dependency-injection/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 12:37:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=496</guid>
		<description><![CDATA[<p>This week I gave a talk to Londroid testing enthusiasts on how we do TDD on Android at TouchType. Our system uses RoboGuice (an Android version of Google Guice) and an open-source Scala mocking framework called Borachio, developed by Paul Butcher, our Chief Software Architect. We write our tests concisely, in Scala, and we run...</p><p>The post <a href="http://www.swiftkey.net/en/blog/test-driven-development-on-android-using-native-scala-mocking-and-dependency-injection/">Test-Driven Development on Android using native Scala Mocking and Dependency Injection</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>This week I gave a talk to <a title="Londroid on meetup.com" href="http://www.meetup.com/android/" target="_blank">Londroid</a> testing enthusiasts on how we do TDD on Android at TouchType. Our system uses <a title="RoboGuice" href="http://code.google.com/p/roboguice/" target="_blank">RoboGuice</a> (an Android version of <a title="Google Guice" href="http://code.google.com/p/google-guice/" target="_blank">Google Guice</a>) and an open-source <a title="Scala programming language" href="http://www.scala-lang.org/" target="_blank">Scala</a> mocking framework called <a title="Borachio.com" href="http://borachio.com/" target="_blank">Borachio</a>, developed by Paul Butcher, our Chief Software Architect. We write our tests concisely, in Scala, and we run the tests on Android devices. We&#8217;re pretty sure we&#8217;re the only people in the world to use this approach to testing on Android and we&#8217;ve found it to be very useful. If you&#8217;d like to know more watch the presentation via the link below.</p>
<ul>
<li><a title="Video of TDD on Android talk" href="http://skillsmatter.com/podcast/os-mobile-server/mocking-and-testing/js-1930" target="_blank">Video of the talk</a></li>
<li><a href="http://www.swiftkey.net/wp-content/uploads/2011/06/TDD_with_Borachio_Guice.pdf" target="_blank">TDD on Android slides</a></li>
<li><a title="Borachio &amp; Guice example on GitHub" href="http://github.com/jaley/borachio-warehouse" target="_blank">Sample code</a></li>
</ul>
<p>If you have ideas of how we can improve testing on Android, please get in touch! You never know&#8230; we might just hire you!</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/test-driven-development-on-android-using-native-scala-mocking-and-dependency-injection/">Test-Driven Development on Android using native Scala Mocking and Dependency Injection</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/test-driven-development-on-android-using-native-scala-mocking-and-dependency-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are you a super web dev?</title>
		<link>http://www.swiftkey.net/en/blog/a-you-a-super-web-dev/</link>
		<comments>http://www.swiftkey.net/en/blog/a-you-a-super-web-dev/#comments</comments>
		<pubDate>Thu, 12 May 2011 15:05:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company news]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=468</guid>
		<description><![CDATA[<p>We&#8217;re looking for a full-stack web developer to join the best company in the world &#8211; TouchType &#8211; to do a variety of fun, engaging and innovative things with our technology. Do you think you fit the bill? If so, check out our job description here. No recruiters please. Cheers! Joe</p><p>The post <a href="http://www.swiftkey.net/en/blog/a-you-a-super-web-dev/">Are you a super web dev?</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>We&#8217;re looking for a full-stack web developer to join the best company in the world &#8211; TouchType &#8211; to do a variety of fun, engaging and innovative things with our technology.</p>
<p>Do you think you fit the bill? If so, check out our <a href="http://touchtype-online.com/jobs">job description here</a>. No recruiters please.</p>
<p>Cheers!</p>
<p>Joe</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/a-you-a-super-web-dev/">Are you a super web dev?</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/a-you-a-super-web-dev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mock objects on Android with Borachio: Part 3</title>
		<link>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-3/</link>
		<comments>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-3/#comments</comments>
		<pubDate>Thu, 05 May 2011 10:08:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=442</guid>
		<description><![CDATA[<p>As we saw in part 2 of this series, mocking Android&#8217;s PowerManager service directly is impossible. But there is an alternative approach that gives us something close enough. This article describes that approach. The code of the application described here is checked into GitHub. Given that we can&#8217;t mock PowerManager directly, instead we&#8217;re going to...</p><p>The post <a href="http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-3/">Mock objects on Android with Borachio: Part 3</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>As we saw in <a href="http://www.swiftkey.net/blog/?p=439">part 2</a> of this series, mocking Android&#8217;s <code>PowerManager</code> service directly is impossible. But there is an alternative approach that gives us something close enough. This article describes that approach.<br />
<span id="more-442"></span></p>
<p>The code of the application described here is <a href="https://github.com/paulbutcher/powercontrol">checked into GitHub</a>.</p>
<p>Given that we can&#8217;t mock PowerManager directly, instead we&#8217;re going to create an interface that we <em>can</em> mock:</p>
<pre>public interface PowerControl
{
    void disablePowerOff();
    void enablePowerOff();
}</pre>
<p>Together with an implementation which will be used in production code:</p>
<pre>public class PowerControlImpl implements PowerControl
{
    public PowerControlImpl(Context context) {
        PowerManager powerManager = (PowerManager)
            context.getSystemService(Context.POWER_SERVICE);
        wakeLock = powerManager.newWakeLock(
            PowerManager.FULL_WAKE_LOCK, "PowerControl");
    }

    public void disablePowerOff() {
        wakeLock.acquire();
    }

    public void enablePowerOff() {
        wakeLock.release();
    }

    private PowerManager.WakeLock wakeLock;
}</pre>
<p>We won&#8217;t be able to test this implementation, but hopefully it&#8217;s so simple that (as <a href="http://en.wikipedia.org/wiki/C._A._R._Hoare">Hoare</a> puts it) it obviously contains no deficiencies (as opposed to contains no obvious deficiencies).</p>
<p>But we <em>do</em> now have something that we can mock, so we can test that the code that calls it does so correctly.</p>
<p>The first challenge we&#8217;re going to have to overcome is how to inject a <code>PowerControl</code> implementation (the real one or the mock) into the code under test. We could use a dependency injection framework like <a href="http://code.google.com/p/roboguice/">RoboGuice</a>, but for the purposes of this article I&#8217;m going to keep things simple and use a custom <code>Application</code> class which implements a <code>getPowerControl</code> method:</p>
<pre>public class PowerControlApplication extends Application
{
    public void onCreate() {
        powerControl = new PowerControlImpl(this);
    }

    public PowerControl getPowerControl() {
        return powerControl;
    }

    protected PowerControl powerControl;
}</pre>
<p>Our activity calls this during onCreate:</p>
<pre>public class PowerActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        PowerControlApplication app =
            (PowerControlApplication)getApplication();
        powerControl = app.getPowerControl();
    }

    public void startImportant(View button) {
        powerControl.disablePowerOff();
    }

    public void stopImportant(View button) {
        powerControl.enablePowerOff();
    }

    private PowerControl powerControl;
}</pre>
<p>We can now write a test to verify that <code>startImportant</code> calls <code>disablePowerOff</code>:</p>
<pre>class PowerActivityTest
  extends ActivityUnitTestCase[PowerActivity](classOf[PowerActivity])
  with MockFactory {

  val startIntent = new Intent(Intent.ACTION_MAIN)

  def testStartImportant {
    val mockPowerControl = mock[PowerControl]
    val application = new PowerControlApplication {
      powerControl = mockPowerControl
    }
    setApplication(application)
    startActivity(startIntent, null, null)

    withExpectations {
      mockPowerControl expects 'disablePowerOff once

      getActivity.startImportant(null)
    }
  }
}</pre>
<p>Our test first creates a mock <code>PowerControl</code> object:</p>
<pre>    val mockPowerControl = mock[PowerControl]</pre>
<p>And then creates an application object that returns this mock instead of a &#8220;real&#8221; <code>PowerControl</code> instance:</p>
<pre>    val application = new PowerControlApplication {
      powerControl = mockPowerControl
    }</pre>
<p>We tell Android&#8217;s test framework to use this application object by calling <code>setApplication</code>:</p>
<pre>    setApplication(application)</pre>
<p>Finally, we set our expectation (that <code>disablePowerOff</code> is called once) and call <code>startImportant</code>:</p>
<pre>    mockPowerControl expects 'disablePowerOff once

    getActivity.startImportant(null)</pre>
<p>The post <a href="http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-3/">Mock objects on Android with Borachio: Part 3</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mock objects on Android with Borachio: Part 2</title>
		<link>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-2/</link>
		<comments>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-2/#comments</comments>
		<pubDate>Thu, 05 May 2011 10:08:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=439</guid>
		<description><![CDATA[<p>In part 1 of this series, I showed how to mock an interface that we created ourselves under Android. That&#8217;s useful, but mocking really pays dividends when mocking OS services—doing so allows us to test our code in isolation, verify that it interacts with the OS correctly and that it handles errors properly. But there&#8217;s...</p><p>The post <a href="http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-2/">Mock objects on Android with Borachio: Part 2</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>In <a href="http://www.swiftkey.net/blog/?p=432">part 1</a> of this series, I showed how to mock an interface that we created ourselves under Android. That&#8217;s useful, but mocking really pays dividends when mocking OS services—doing so allows us to test our code in isolation, verify that it interacts with the OS correctly and that it handles errors properly.</p>
<p><span id="more-439"></span></p>
<p>But there&#8217;s a wrinkle. Android is the most test-hostile environment I&#8217;ve ever had the misfortune to find myself working in. I wonder sometimes if its designers deliberately designed it to make testing as difficult as they possibly could. It <em>can</em> be done, and I&#8217;ll show how in <a href="http://www.swiftkey.net/blog/?p=442">part 3</a>, but if you&#8217;ll forgive me a digression, in this article I&#8217;m going to try the simple, &#8220;obvious&#8221; solution and demonstrate why it doesn&#8217;t work.</p>
<p>I&#8217;m going to try to write a simple test of an application that uses Android&#8217;s <a href="http://developer.android.com/reference/android/os/PowerManager.html"><code>PowerManager</code> service</a>. <code>PowerManager</code> allows us to control when the device switches on or off. If we&#8217;re about to start some critical operation that must complete without the device switching off, we can obtain a <a href="http://developer.android.com/reference/android/os/PowerManager.WakeLock.html">WakeLock</a>, which is what this sample app does.</p>
<p>The code is <a href="https://github.com/paulbutcher/androidistesthostile">checked into GitHub</a>. Here&#8217;s the code that we want to test:</p>
<pre>package com.paulbutcher.powercontrol;

import android.app.Activity;
import android.os.Bundle;
import android.os.PowerManager;
import android.view.View;

public class PowerControl extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public void startImportant(View button) {
        PowerManager powerManager =
            (PowerManager)getSystemService(POWER_SERVICE);
        wakeLock = powerManager.newWakeLock(
            PowerManager.FULL_WAKE_LOCK, "PowerControl");
        wakeLock.acquire();
    }

    public void stopImportant(View button) {
        wakeLock.release();
    }

    private PowerManager.WakeLock wakeLock;
}</pre>
<p>Let&#8217;s try to write a test that verifies that <code>startImportant</code> calls <code>PowerManager.newWakeLock</code>. Our first task is going to be working out how to inject a mock <code>PowerManager</code> into the code under test.</p>
<p>That code obtains its <code>PowerManager</code> instance by calling <code>Context.getSystemService</code>. Happily, Android provides <a href="http://developer.android.com/reference/android/test/mock/MockContext.html"><code>MockContext</code></a> and <a href="http://developer.android.com/reference/android/test/ActivityUnitTestCase.html#setActivityContext(android.content.Context)"><code>ActivityUnitTestCase.setActivityContext</code></a>, so we should be all set.</p>
<p>Before we get carried away, let&#8217;s just verify that we can get a test using a MockContext to run at all:</p>
<pre>  def testAttempt1 {
    val mockContext = new MockContext;
    setActivityContext(mockContext)
    startActivity(startIntent, null, null)
  }</pre>
<p>Let&#8217;s see what happens when we run that:</p>
<pre>Failure in testAttempt1:
junit.framework.AssertionFailedError
  at android.test.ActivityUnitTestCase.startActivity(ActivityUnitTestCase.java:148)</pre>
<p>Hmm—apparently this isn&#8217;t going to be as easy as we hoped.</p>
<p>The problem is that <code>startActivity</code> calls our <code>MockContext</code>. Specifically it calls <code>getSystemService("layout_inflater")</code> which fails because <code>MockContext</code>&#8216;s methods are non-functional and throw <code>UnsupportedOperationException</code>.</p>
<p>It turns out that what Android means by &#8220;mock&#8221; isn&#8217;t what the rest of the world means. As Martin Fowler says in <a href="http://martinfowler.com/articles/mocksArentStubs.html">Mocks Aren&#8217;t Stubs</a>, mocks are:</p>
<blockquote><p>objects pre-programmed with expectations which form a specification of the calls they are expected to receive.</p></blockquote>
<p>Never mind—there is another way. Android&#8217;s <a href="http://developer.android.com/reference/android/content/ContextWrapper.html"><code>ContextWrapper</code></a> allows us to wrap an existing context, only changing those bits of functionality we&#8217;re interested in for the purposes of our test:</p>
<pre>  def testAttempt2 {
    val testContext =
        new ContextWrapper(getInstrumentation.getTargetContext);
    setActivityContext(testContext)
    startActivity(startIntent, null, null)
  }</pre>
<p>That works, so now we just need to modify it to return a mock PowerManager when getSystemService is called:</p>
<pre>  def testAttempt3 {
    val mockPowerManager = mock[PowerManager]
    val testContext =
      new ContextWrapper(getInstrumentation.getTargetContext) {
        override def getSystemService(name: String) = name match {
          case "power" =&gt; mockPowerManager
          case _ =&gt; super.getSystemService(name)
        }
      }
    setActivityContext(testContext)
    startActivity(startIntent, null, null)
  }</pre>
<p>Which looks great, right up until we run it:</p>
<pre>Error in testAttempt3:
java.lang.IllegalArgumentException: android.os.PowerManager is not an interface</pre>
<p>Borachio, in common with most other mocking frameworks, can only mock interfaces, and <code>PowerManager</code> is a class, not an interface. There are mocking frameworks that can mock classes, for example <a href="http://code.google.com/p/powermock/">PowerMock</a>, but they rely on code generation, which Android&#8217;s Dalvik VM <a href="http://code.google.com/p/android/issues/detail?id=6322">doesn&#8217;t (yet) support</a>. So that&#8217;s not going to be any help <img src='http://cdn.swiftkey.net/en/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>There&#8217;s one final thing we can try. As well as mocking interfaces, Borachio can also mock functions. So we can derive from <code>PowerManager</code> and just mock the single method we&#8217;re interested in like this:</p>
<pre>  def testAttempt4 {
    val mockNewWakeLock =
      mockFunction[Int, String, PowerManager#WakeLock]
    val mockPowerManager = new PowerManager {
      override def newWakeLock(flags: Int, tag: String) =
        mockNewWakeLock(flags, tag)
    }
    val testContext =
      new ContextWrapper(getInstrumentation.getTargetContext) {
        override def getSystemService(name: String) = name match {
          case "power" =&gt; mockPowerManager
          case _ =&gt; super.getSystemService(name)
        }
      }
    setActivityContext(testContext)
    startActivity(startIntent, null, null)
  }</pre>
<p>But, when we compile this, we get:</p>
<pre>PowerControlTest.scala:53: error: constructor PowerManager cannot be accessed in anonymous class $anon
    val mockPowerManager = new PowerManager {
                               ^</pre>
<p><code>PowerManager</code>&#8216;s constructor is private <img src='http://cdn.swiftkey.net/en/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>And at this point, we&#8217;re out of easy options. We can&#8217;t play the same trick with <code>PowerManager</code> as we played with <code>Context</code>, as there&#8217;s no <code>PowerManagerWrapper</code> or similar.</p>
<p>We&#8217;re not beaten yet—I&#8217;ll show how to get around this problem in <a href="http://www.swiftkey.net/blog/?p=442">part 3</a> of this series. Small wonder, however, that most of the Android code I&#8217;ve seen has virtually no tests!</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-2/">Mock objects on Android with Borachio: Part 2</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mock objects on Android with Borachio: Part 1</title>
		<link>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-1/</link>
		<comments>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-1/#comments</comments>
		<pubDate>Thu, 05 May 2011 10:07:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=432</guid>
		<description><![CDATA[<p>In the next few &#8220;Technical Wizardry&#8221; articles, we&#8217;re going to look at the approach we&#8217;ve developed to help with testing Android code (first published here). One of my biggest frustrations with writing code for Android has been the fact that none of the current Java mocking frameworks work on Android&#8217;s Dalvik VM. I recently released...</p><p>The post <a href="http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-1/">Mock objects on Android with Borachio: Part 1</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>In the next few &#8220;Technical Wizardry&#8221; articles, we&#8217;re going to look at the approach we&#8217;ve developed to help with testing Android code (first published <a href="http://www.paulbutcher.com/">here</a>).</p>
<p><span id="more-432"></span></p>
<p>One of my biggest frustrations with writing code for Android has been the fact that none of the current Java mocking frameworks work on Android&#8217;s Dalvik VM. I recently released <a href="http://borachio.com/">Borachio</a> a native Scala mocking framework which does work on Android.</p>
<p>Because Borachio is written in Scala, you&#8217;ll need to write your tests in Scala. But it can be used to test code written in Java.</p>
<p>This post demonstrates how to get basic mocking working. Things get more complicated when you try to mock bits of Android itself, but I&#8217;ll cover that in a subsequent article.</p>
<p>This is an Android version of the example in Martin Fowler&#8217;s article <a href="http://martinfowler.com/articles/mocksArentStubs.html">Mocks Aren&#8217;t Stubs</a>. The code is checked into GitHub <a href="https://github.com/paulbutcher/warehousemanager">here</a>. You&#8217;ll need to have the <a href="http://developer.android.com/sdk/index.html">Android SDK</a> and <a href="http://www.scala-lang.org/downloads">Scala 2.8</a> installed to run this code.</p>
<p>We&#8217;re going to build a (very) simple ordering system. Orders will succeed if there&#8217;s enough inventory in our warehouse and fail if not. Let&#8217;s start by creating a very simple little Android application for us to test:</p>
<ol>
<li>Create a new project with:
<pre>android create project -p WarehouseManager -t android-8
    -p warehousemanager -k com.example.warehousemanager
    -a WarehouseManager</pre>
</li>
<li>The core abstraction is a warehouse, represented by a <code>Warehouse</code>interface:
<pre>package com.example.warehousemanager;

public interface Warehouse {
    boolean hasInventory(String product, int quantity);
    void remove(String product, int quantity);
}</pre>
</li>
<li>And here&#8217;s a very simple concrete implementation of <code>Warehouse</code>:
<pre>package com.example.warehousemanager;

import java.util.HashMap;

public class RealWarehouse implements Warehouse {
    public RealWarehouse() {
        products = new HashMap();
        products.put("Talisker", 5);
        products.put("Lagavulin", 2);
    }

    public boolean hasInventory(String product, int quantity) {
        return inStock(product) &gt;= quantity;
    }

    public void remove(String product, int quantity) {
        products.put(product, inStock(product) - quantity);
    }

    private int inStock(String product) {
        Integer quantity = products.get(product);
        return quantity == null ? 0 : quantity;
    }

    private HashMap products;
}</pre>
</li>
<li>We remove things from the warehouse by placing an <code>Order</code>:
<pre>package com.example.warehousemanager;

public class Order {

    public Order(String product, int quantity) {
        this.product = product;
        this.quantity = quantity;
    }

    public void fill(Warehouse warehouse) {
        if (warehouse.hasInventory(product, quantity)) {
            warehouse.remove(product, quantity);
            filled = true;
        }
    }

    public boolean isFilled() {
        return filled;
    }

    private boolean filled = false;
    private String product;
    private int quantity;
}</pre>
</li>
<li>We&#8217;ll need a UI to allow us to make orders, so modify <code>main.xml</code>to look like this:
<pre></pre>
</li>
<li>And finally, here&#8217;s the implementation of <code>WarehouseManager</code>:
<pre>package com.example.warehousemanager;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class WarehouseManager extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        productEditText = (EditText)findViewById(R.id.product);
        quantityEditText = (EditText)findViewById(R.id.quantity);
    }

    public void placeOrder(View view) {
        String product = productEditText.getText().toString();
        int quantity = Integer.parseInt(quantityEditText.getText().toString());
        Order order = new Order(product, quantity);
        order.fill(warehouse);

        String message = order.isFilled() ? "Success" : "Failure";
        Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
        toast.show();
    }

    private Warehouse warehouse = new RealWarehouse();

    private EditText productEditText;
    private EditText quantityEditText;
}</pre>
</li>
</ol>
<p>You should now have a little Android application that can be compiled and installed with <code>ant install</code>. Here&#8217;s what it looks like:</p>
<p><img src="http://www.swiftkey.net/wp-content/uploads/2011/05/WarehouseManager.png" alt="Screenshot" /></p>
<p>So, now that we&#8217;ve got something to test, let&#8217;s create a test project to test it:</p>
<ol>
<li>Create a test project with:
<pre>android create test-project -p test -m .. -n WarehouseManagerTest</pre>
<p>Next, we&#8217;ll convert this to a Scala project, as described <a href="http://lamp.epfl.ch/~michelou/android/">here</a>.</li>
<li>Add <code>scala.dir</code> and <code>proguard.dir</code> to <code>local.properties</code>. Here&#8217;s what I added to mine (you&#8217;ll need to change the paths to match your local installation):
<pre>scala.dir=/opt/local/share/scala-2.8
proguard.dir=/Users/paul/android-sdk-mac_86/tools/proguard/</pre>
</li>
<li>Copy <a href="http://lampsvn.epfl.ch/svn-repos/scala/android-examples/trunk/android-sdk/HelloActivity/build-scala.xml"><code>build-scala.xml</code></a> into the root of the test project and add the following to <code>build.xml</code>:
<pre></pre>
</li>
<li>Delete the <code>proguard.cfg</code> file and copy the <a href="http://lampsvn.epfl.ch/svn-repos/scala/android-examples/trunk/android-sdk/HelloActivity/configs/"><code>configs</code></a> directory into the test project. Add the following to the bottom of both <code>default-debug.cfg</code> and <code>default-release.cfg</code>(to ensure that ProGuard doesn&#8217;t discard our test classes:
<pre>-keep public class * implements junit.framework.Test { public void test*(); }</pre>
</li>
<li>Copy the <a href="http://scala-tools.org/repo-releases/com/borachio/borachio_2.8.1/0.6/borachio_2.8.1-0.6.jar">Borachio JAR</a> to the <code>libs</code> directory.</li>
<li>Finally, we can write our tests, which create mock instances of the <code>Warehouse</code>interface:
<pre>package com.example.warehousemanager;

import junit.framework.TestCase
import com.borachio.junit3.MockFactory

class OrderTest extends TestCase with MockFactory {

  def testInStock() {
    withExpectations {
      val mockWarehouse = mock[Warehouse]
      inSequence {
        mockWarehouse expects 'hasInventory withArguments ("Talisker", 50) returning true once;
        mockWarehouse expects 'remove withArguments ("Talisker", 50) once
      }

      val order = new Order("Talisker", 50)
      order.fill(mockWarehouse)

      assert(order.isFilled)
    }
  }

  def testOutOfStock() {
    withExpectations {
      val mockWarehouse = mock[Warehouse]
      mockWarehouse expects 'hasInventory returns false once

      val order = new Order("Talisker", 50)
      order.fill(mockWarehouse)

      assert(!order.isFilled)
    }
  }
}</pre>
</li>
<li>Run the tests with:
<pre>ant run-tests</pre>
</li>
</ol>
<p>In <a href="http://www.swiftkey.net/blog/?p=439">part 2</a>, we&#8217;ll look at some of the challenges of mocking Android components.</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-1/">Mock objects on Android with Borachio: Part 1</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/mock-objects-on-android-with-borachio-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android library project with tests, step by step</title>
		<link>http://www.swiftkey.net/en/blog/android-library-project-with-tests-step-by-step/</link>
		<comments>http://www.swiftkey.net/en/blog/android-library-project-with-tests-step-by-step/#comments</comments>
		<pubDate>Wed, 04 May 2011 14:45:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=423</guid>
		<description><![CDATA[<p>Welcome to the new &#8220;Technical Wizardry&#8221; section of the TouchType blog. Here&#8217;s where we&#8217;ll be sharing a few of the tips and tricks we&#8217;ve learned while developing SwiftKey and the Fluency prediction engine that underpins it. We&#8217;re going to start off with a series of articles on Android development (originally published here). In Testing a...</p><p>The post <a href="http://www.swiftkey.net/en/blog/android-library-project-with-tests-step-by-step/">Android library project with tests, step by step</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Welcome to the new &#8220;Technical Wizardry&#8221; section of the TouchType blog. Here&#8217;s where we&#8217;ll be sharing a few of the tips and tricks we&#8217;ve learned while developing SwiftKey and the <a href="http://touchtype-online.com/products/fluency-prediction">Fluency prediction engine</a> that underpins it.</p>
<p>We&#8217;re going to start off with a series of articles on Android development (originally published <a href="http://www.paulbutcher.com/">here</a>).</p>
<p><span id="more-423"></span></p>
<p>In <a href="http://developer.android.com/guide/developing/other-ide.html#considerations">Testing a library project</a> the Android documentation says:</p>
<blockquote><p>There are two recommended ways of setting up testing on code and resources in a library project:</p>
<ul>
<li>You can set up a test project that instruments an application project that depends on the library project. You can then add tests to the project for library-specific features.</li>
<li>You can set up a set up a standard application project that depends on the library and put the instrumentation in that project. This lets you create a self-contained project that contains both the tests/instrumentations and the code to test.</li>
</ul>
</blockquote>
<p>How to achieve the first of these is pretty obvious, but the second (to me, at least) rather less so. I wasn&#8217;t able to find an example, so I thought that I&#8217;d post how I managed to get it working.</p>
<p>Although it does work, I&#8217;m not 100% happy with it, and there may well be a nicer way to achieve this (see the end of this post for a discussion about my concerns). I would be very grateful for any suggestions for improvements.</p>
<p>Note, we don&#8217;t build with Eclipse (partly because we&#8217;ve found its reliability leaves a lot to be desired, but mainly because we need a command line build in order to be able to integrate with the rest of our build system and continuous integration server). So all of the following uses the Android command line tools.</p>
<h3>The steps</h3>
<ol>
<li>Create a new library project as follows:
<pre>android create lib-project -n ExampleLib -t android-8
-p examplelib -k com.example.lib</pre>
</li>
<li>In that project, create <code>src/com/example/lib/Widget.java</code>containing:
<pre>package com.example.lib;

public class Widget {
    public String getColour() {
        return "blue";
    }

    public String getDisposition() {
        return "awesome";
    }
}</pre>
</li>
<li>In the <code>examplelib</code>directory, create a test project with:
<pre>android create test-project -m .. -p test -n ExampleTest</pre>
</li>
<li>Edit the <code>AndroidManifest.xml</code>in the test project and change the line:
<pre>android:targetPackage="com.example.lib"</pre>
<p>to:</p>
<pre>android:targetPackage="com.example.lib.tests"</pre>
</li>
<li>Delete the following line from the <code>build.properties</code>in the test project:
<pre>tested.project.dir=..</pre>
<p>and add the following:</p>
<pre>android.library.reference.1=..</pre>
</li>
<li>Delete the <code>src/com/example/lib/ACTIVITY_ENTRY_NAMETest.java</code> file.</li>
<li>Create <code>src/com/example/lib/WidgetTest.java</code>containing:
<pre>package com.example.lib;

import junit.framework.TestCase;

public class WidgetTest extends TestCase {

    private Widget widget;

    @Override
    protected void setUp() {
        widget = new Widget();
    }

    public void testColour() {
        assertEquals("blue", widget.getColour());
    }

    public void testDisposition() {
        assertEquals("awesome", widget.getDisposition());
    }
}</pre>
</li>
<li>Start an emulator and install with <code>ant install</code>.</li>
<li>Run the tests with:
<pre>adb shell am instrument
-w com.example.lib.tests/android.test.InstrumentationTestRunner</pre>
</li>
</ol>
<h3>Reservations</h3>
<p>It&#8217;s clear from the above that the Android tools (the command line tools, at least—perhaps the Eclipse plugin is better?) don&#8217;t really fully support this way of working. Not least the fact that they assume that we&#8217;re always testing an activity in another application (hence the strangely named <code>ACTIVITY_ENTRY_NAMETest.java</code> file).</p>
<ol>
<li>In step 4, we changed the <code>targetPackage</code>. This is necessary because if we leave it as <code>com.example.lib</code>, Android will try to launch an application with that package name, which doesn&#8217;t exist. However, it&#8217;s something of a lie to suggest that the targetPackage is <code>com.example.lib.tests</code></li>
<li>In a normal Android test project, we can run the tests by typing:
<pre>ant run-tests</pre>
<p>We have to run the tests explicitly with <code>adb</code>, however, because in step 5, we deleted the <code>tested.project.dir</code> line. If we don&#8217;t, the ant build system will try to rebuild the library project (and library projects can&#8217;t be build independently).</p>
<p>An alternative to the solution presented above is to set <code>tested.project.dir</code> to the current directory (<code>.</code>). This enables <code>ant run-tests</code>, but at the expense of building the project twice.</li>
</ol>
<p>So, it all works, but it&#8217;s a bit messy. Suggestions for improvements very welcome!</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/android-library-project-with-tests-step-by-step/">Android library project with tests, step by step</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/android-library-project-with-tests-step-by-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The clever stuff behind SwiftKey&#8217;s success</title>
		<link>http://www.swiftkey.net/en/blog/the-clever-stuff-behind-swiftkeys-success/</link>
		<comments>http://www.swiftkey.net/en/blog/the-clever-stuff-behind-swiftkeys-success/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 18:04:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tech Wizardry]]></category>

		<guid isPermaLink="false">http://www.swiftkey.net/blog/?p=161</guid>
		<description><![CDATA[<p>The dust has now settled on our paid launch in September and SwiftKey is already establishing itself as a leading solution to the problem of typing quickly and accurately on the go. At last month&#8217;s DroidCon Android conference in London, I pitched our app at the AppCircus competition and we won. This officially marks the...</p><p>The post <a href="http://www.swiftkey.net/en/blog/the-clever-stuff-behind-swiftkeys-success/">The clever stuff behind SwiftKey&#8217;s success</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>The dust has now settled on our paid launch in September and SwiftKey is already establishing itself as a leading solution to the problem of typing quickly and accurately on the go.</p>
<p>At last month&#8217;s <a href="http://www.droidcon.co.uk/">DroidCon</a> Android conference in London, I pitched our app at the <a href="http://www.appcircus.com/blog/london-droid-community-choose-swiftkey-winner">AppCircus</a> competition and we won. This officially marks the first &#8216;best app&#8217; award won by SwiftKey and is great news! In my pitch for the app, I explained a bit about our big plans for SwiftKey, and why we&#8217;re so excited about the technology behind it. I thought I&#8217;d share my thoughts with you.</p>
<p>But first, let me introduce myself. I&#8217;m Ben Medlock, TouchType&#8217;s Chief Technical Officer. I co-founded the company just over two years ago with Jon Reynolds, our CEO. Together, we set out with the simple goal of making text entry on handheld devices easier and more intuitive.</p>
<p>By using intelligent technology, we were confident we could find a better way to get the thoughts out of your head and on to your phone. Since then, we have gathered a team of exceptional people to help us make that happen, and my job is to ensure our products remain at the cutting edge of innovation in handheld communication.</p>
<p>Getting electronic devices to do intelligent things with human languages is no simple task. In the past, it took teams of programmers and linguists years to build rudimentary systems for performing basic language tasks and these systems were usually frail and unreliable. Recently, people started to wonder if rather than telling a computer exactly what to do, they could build programs that would learn for themselves when shown the right sort of data. We call this “machine learning.”</p>
<p style="text-align: center"><a href="http://www.swiftkey.net/wp-content/uploads/2010/11/Tech-diagram3.png"><img class="aligncenter size-full wp-image-173" src="http://www.swiftkey.net/wp-content/uploads/2010/11/Tech-diagram3.png" alt="" width="600" height="395" /></a></p>
<p>It turns out that machine learning is a pretty good way to deal with the complexities of human language&#8230; the only problem is you need fast computers and LOTS of data. SwiftKey sometimes feels like it&#8217;s reading your mind because it&#8217;s already read words written by millions of other people, gleaned from a variety of sources including the World Wide Web. Of course, it also learns from your own writing as you use it.</p>
<p>In the next few months, we&#8217;ll be making it easier to tailor SwiftKey to the type of look and feel that you want. We also have some great ideas for making the suggestion buttons easier to use, and we&#8217;ll be introducing even more advanced correction mechanisms that don&#8217;t just work out when you hit the wrong keys, but also recognize when you miss a letter or spell a word the wrong way.</p>
<p>We are really proud of what we&#8217;ve achieved so far, but this is just the beginning of our plans to enhance communication on handhelds. We&#8217;re working on new techniques that put our machine learning and artificial intelligence expertise to powerful effect, and will make even the technology in SwiftKey feel like yesterday&#8217;s news. Our vision is to design software that really feels like it&#8217;s working with you to make writing fun, creative and as fast as you can think.</p>
<p>Happy typing!</p>
<p>Ben</p>
<p>Chief Technical Officer, TouchType</p>
<p>The post <a href="http://www.swiftkey.net/en/blog/the-clever-stuff-behind-swiftkeys-success/">The clever stuff behind SwiftKey&#8217;s success</a> appeared first on <a href="http://www.swiftkey.net/en">SwiftKey</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.swiftkey.net/en/blog/the-clever-stuff-behind-swiftkeys-success/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching using memcached
Object Caching 1647/1799 objects using memcached
Content Delivery Network via Amazon Web Services: CloudFront: cdn.swiftkey.net

Served from: www.swiftkey.net @ 2013-05-23 21:44:12 -->