<?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>Platformability</title>
	<atom:link href="http://blog.caplin.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.caplin.com</link>
	<description>Single Dealer Platforms, Industry Expertise</description>
	<lastBuildDate>Thu, 16 May 2013 15:10:53 +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>2 minutes: Matthew Baxter</title>
		<link>http://blog.caplin.com/2013/05/16/2-minutes-matthew-baxter/</link>
		<comments>http://blog.caplin.com/2013/05/16/2-minutes-matthew-baxter/#comments</comments>
		<pubDate>Thu, 16 May 2013 15:10:53 +0000</pubDate>
		<dc:creator>Jennifer Reid</dc:creator>
				<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10541</guid>
		<description><![CDATA[Matthew Baxter joined Caplin as Head of UX Design in December 2012 Leading Caplin’s UX Design team from research through to visual design, Matthew is focused on ensuring Caplin products are appropriate, intuitive, fit for purpose and a pleasure to use and look at. Matthew takes two minutes to tell...]]></description>
				<content:encoded><![CDATA[<p><em>Matthew Baxter joined Caplin as Head of UX Design in December 2012</em></p>
<p>Leading <a  0="title="Caplin" 1="Systems"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jYXBsaW4uY29t">Caplin’s</a> UX Design team from research through to visual design, Matthew is focused on ensuring Caplin products are appropriate, intuitive, fit for purpose and a pleasure to use and look at.</p>
<p>Matthew takes two minutes to tell Jennifer Reid a little bit more about leading UX design forward in real-time trading.</p>
<p><strong>Q: You’ve had a really interesting career as a creative thinker. Tell us what attracted you to UX.</strong></p>
<p><strong>A:</strong> For a quiet life?  No, it’s the opposite.  Throughout my career I’ve taken complex information and put it in front of people who need to make use of it in the best way for them, and for the client.  Whether it’s television news, staff development or FX trading, the challenges are the same:  Innovating and improving user experience is a broad discipline, not a webby nicety, it’s the core of all good design.  At Caplin the need for clarity, speed of comprehension and action, and the projection of brand values are all amplified by the nature of the domain.</p>
<p><strong>Q: Everyone’s got their own definition of UX. Tell us yours.</strong></p>
<p><strong>A:</strong> Well, I’m not a fan of UX being unhitched from design and engineering, because I think what we do is virtual product design.  When you design a car it has to work right, look right and feel right, what we do is no different.</p>
<p><strong>Q: In 5 sentences, tell us what you do in a typical day at Caplin.<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvVGVjaEdhZGdldFBob3RvLmpwZw=="><img class="alignright" style="margin: 10px;" alt="TechGadgetPhoto" src="http://blog.caplin.com/wp-content/uploads/TechGadgetPhoto-300x225.jpg" width="210" height="158" hspace="10" vspace="10" /></a></strong></p>
<p><strong>A:</strong> I think I can do it in 5 words; look, listen, think, decide, do.  Although I could replace ‘do’ with ‘delegate’, and there is also a fair bit of talking involved.  So it could be; absorb, consider, conclude, convince &amp; act.  Either way it’s fun.  This is five sentences I notice.</p>
<p><strong>Q: Last tech gadget you bought?</strong></p>
<p><strong>A:</strong> Depends what you call a gadget I suppose.  I don’t think I buy ‘gadgets’, but the last technical things that I got because I liked them more than I needed them were apps for my iPhone; ‘Solar’, a weather app, because it’s so beautiful and ‘Linxy’ a dictionary which gives you definitions of words, live, as you point the camera at them, because it made me say “Wow” out loud like a child.</p>
<p><strong>Q: What are you favourite UX books or resources?</strong></p>
<p><strong>A:</strong> As I think we are actually in the product design business, Raymond Loewy’s book ‘Industrial Design’ does it for me.  Loewy invented what America looks and feels like – twice.  Once with the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvaW5kdXN0cmlhbF9kZXNpZ24uanBn"><img class="alignleft" alt="industrial_design" src="http://blog.caplin.com/wp-content/uploads/industrial_design.jpg" width="210" height="210" hspace="10" vspace="10" /></a>opulent, excessive, overtly futuristic streamlined 40’s, and then in the clean-cut, slick, spare, modernist late 50’s and early 60’s.  Always functional and – yes I’m going to say it – a bit sexy, and always projecting joy and optimism.  Loewy had a framed letter on his desk from the astronauts who used Space Lab thanking him for making their environment more functional and a pleasure to live in – if that’s not a UX success I don’t know what is.</p>
<p>As for my favourite resource, it’s my team here at Caplin Systems and people like Paul Blank and Scott McLeod who are so good at communicating user and business needs, and demand more and better, from us every day.</p>
<p><strong>Q: Creative thinkers often get inspiration from everyday objects or experiences. What inspires your thinking?</strong></p>
<p><strong><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvbXVzaWMuanBn"><img class=" wp-image-10544 alignright" style="margin: 5px;" alt="music" src="http://blog.caplin.com/wp-content/uploads/music-300x199.jpg" width="210" height="139" hspace="5" vspace="5" /></a>A:</strong> Music inspires me:  I once attended a lecture on the nature of genius by Dave Stewart.  He broke the Aretha Franklin song ‘Until you come back to me’ down to the component tracks, and was unable to find a single flaw. Every isolated ‘doo-wah’, drum break and guitar flourish was perfect – but meaningless.  On bringing it all back together he found it was still flawless, but now it had soul.  Now it was genius.  So it was context and concerted effort that made it a work of genius.  That’s inspiring.</p>
<p><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvTG9uZG9uLmpwZw=="><img class="alignleft  wp-image-10545" alt="London" src="http://blog.caplin.com/wp-content/uploads/London-300x197.jpg" width="210" height="138" hspace="5" vspace="5" /></a>Also, there has been a renaissance in ‘statement’ architecture in London, and I find something inspiring to look at every day as I walk from Waterloo into the city, you don’t have to like it all but you have to admire the ambition and guts it demonstrates.</p>
<p><strong>Q: Where is UX going? What are you excited about?</strong><br />
<strong>A:</strong> Some physical tools and machines have had thousands of years to become ‘natural’ in use, whereas no widely used virtual interaction has had it’s fortieth birthday yet.  It’s no wonder we sometimes resort back to imitating familiar physical activity.  But a generation is coming that, through gaming and social media, is comfortable interacting virtually with the real world and ‘really’ with the virtual world:  All the lines are blurred.  Forever.  For me that’s weird, but for my children it’s everyday.  Once people who interact with technology ‘naturally’; unthinkingly are calling the shots we may be cut loose from reiterative and legacy-based thinking forever.</p>
<p>Uh-oh.</p>
<p><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvYmFieVRlY2guanBn"><img class="size-medium wp-image-10546 alignleft" alt="babyTech" src="http://blog.caplin.com/wp-content/uploads/babyTech-300x225.jpg" width="300" height="225" /></a></p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10541" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/05/16/2-minutes-matthew-baxter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code Coverage &#8211; What is it good for?</title>
		<link>http://blog.caplin.com/2013/05/14/code-coverage-what-is-it-good-for/</link>
		<comments>http://blog.caplin.com/2013/05/14/code-coverage-what-is-it-good-for/#comments</comments>
		<pubDate>Tue, 14 May 2013 14:09:09 +0000</pubDate>
		<dc:creator>Mike Salsbury</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[QA]]></category>
		<category><![CDATA[Software Development Process]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10263</guid>
		<description><![CDATA[Absolutely nothing! Say it again! That is certainly the response I got when I asked an architect about code coverage. And it also seemed to be the conclusion from a long email thread/discussion we had here last year. And it was the response I expected. The referral to Martin Fowler&#8217;s...]]></description>
				<content:encoded><![CDATA[<p><em>Absolutely nothing!</em></p>
<p><em>Say it again!</em></p>
<p>That is certainly the response I got when I asked an architect about code coverage.  And it also seemed to be the conclusion from a long email thread/discussion we had here last year.  And it was the response I expected.  </p>
<p>The referral to Martin Fowler&#8217;s blog post on <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21hcnRpbmZvd2xlci5jb20vYmxpa2kvVGVzdENvdmVyYWdlLmh0bWw=" 0="title="Test" 1="Coverage"">Test Coverage</a> was the most useful.  To some extent this blog confirmed what I thought Code Coverage <em>was</em> good for, which is that it indicates where the untested code lives.  What code coverage <em>is not</em> good for is setting a target that can then be happily ‘gamed’ to produce the number everyone first thought of (N.B.  a handy skill if you are an accountant).</p>
<h3>Why is code coverage a good for nothing?</h3>
<p>The reason it is seen as a good for nothing that adds no value to a team is because historically it has represented a number that will be compared to one arbitrarily chosen by management.  The expectation being that all anyone is interested in is making sure that the actual code coverage is higher than the limit number.  Management will impose sanctions if this is not the case, and developers will be encouraged to write reams of meaningless tests in order to ‘game’ the code coverage number produced by their code to be the right side of the limit.  See <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS8yMDEyLzA1LzA4L3doeS0xMDAtY29kZS1jb3ZlcmFnZS1pcy1ub3QtZW5vdWdoLw==" 0="title="Why" 1="100%" 2="code" 3="coverage" 4="is" 5="not" 6="enough"">Why 100% code coverage is not enough</a> for an example of this in action.</p>
<h3>TDD Discipline results in <em>good</em> Code Coverage</h3>
<p>I had also recently been on a TDD course, and the most important thing about TDD that I learned from that course is that it is a discipline.  Discipline is the most important thing because without it TDD will not work.  Writing tests for your code is not TDD, having 100% code coverage is not TDD.  Writing your tests before you write your code, and only writing the code you need to to pass your tests is TDD.  If you do that (and no more) every time.  </p>
<p>It is very difficult to maintain this discipline as a developer, because as soon as you start writing some code then you start adding extra functions or variables that you ‘know’ you will need later.  As soon as you start doing that then you have broken the discipline of TDD.  A side effect of this is that your code coverage will be less than 100%, but that is not a problem.  The problem is that you have untested code that you don’t know isn’t tested, and that you don’t need.  </p>
<p>The <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGVtYW5zaGlwLmNvLnVrL3BhcmxlenVtbC9ibG9nLz9wb3N0aWQ9MTA2Ng==" 0="title="Test-driven" 1="Development" 2="Maturity" 3="Model"">Test-driven Development Maturity Model</a> can help you to understand what level of TDD you are working at, and also highlights at the end what type of developers don&#8217;t need to do TDD.</p>
<p>Code coverage lets you know where the untested code is, and thus where the untested risk in your system is located.  If the risk in those locations is low value, then this may be acceptable, however, if the risk in those locations is high value, then this is unacceptable.  TDD is an extreme form of this risk detection strategy, in that code is only written if it will be used, and tested.  You only write code that has a failing test, and you only write tests for required business features.</p>
<h3>Discipline vs. focus on critical areas</h3>
<p>TDD is a discipline.  Our trainer said he could get test coverage on any code within a couple of hours.  He also said he&#8217;d expect it to be around 80% if the TDD was being done right.  Not at least 78.457%, but <em>around</em> 80%.  I.e. not chasing a particular number, but knowing it&#8217;s likely to be around 80% if the TDD is being done right.  That is because TDD is premised on writing tests first as a discipline, so there should be a high coverage as a by product of the process.</p>
<p>In comparison BDD will not have the same by product, as it is premised on describing behaviours, not implementing tests first.  Dan North at QCon (<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Fjb25sb25kb24uY29tL2xvbmRvbi0yMDEzL3ByZXNlbnRhdGlvbi9BY2NlbGVyYXRpbmclMjBBZ2lsZTolMjBoeXBlci1wZXJmb3JtaW5nJTIwd2l0aG91dCUyMHRoZSUyMGh5cGU=">Accelerating Agile: hyper-performing without the hype</a>) said that his teams test coverage was more like 6-7%, but in the critical areas it was 150%.  I.e. sufficient, but not unnecessary.  There needs to be sufficient testing in all areas, but to add the most value, no more than that, and in particular areas that may be very little indeed. At the same time, where there is critical functionality then this needs much higher coverage.</p>
<p>One example in our case might be that the core APIs are always critical, so will always need good coverage.  Whereas when building an application this is built on top of the core APIs, so the coverage needs to be sufficient to cover the new features to an appropriate level, but not unnecessarily repeating coverage that already exists in the core libraries.</p>
<p>It is not really discipline vs. critical focus.  They are two different processes that can each achieve good results.  The point is to know which one you are doing and do it properly.  Or whichever process your shop uses.  In either case they know their code coverage and what it means to their process.  The same should be true in any other process too.</p>
<h3>So what is it good for?</h3>
<p>Code coverage can inform you of the quality of your code.  Interpreting and understanding that code coverage, and why it is as it is across your codebase will evolve over time, and will also involve an understanding of your domain and it&#8217;s requirements.</p>
<p>Code coverage at it&#8217;s most basic allows you to know whether you have tests or not!  It can highlight where the testing effort has been targeted.  Examining these results allows a team to take a measure of the healthiness of their code and their development practices.</p>
<h3>Code Coverage enables safe Refactoring</h3>
<p><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3JlZmFjdG9yaW5nLmNvbS8=" 0="title="Refactoring"">Refactoring</a> (Martin Fowler again), is a common and much used practice in BDD and TDD.  The reason agile teams using these methodologies can refactor safely is because of the safety net that their extensive regression test packs give them.  They know that if they break some previously working functionality then the automated regression tests running on CI will catch those failures.  They know this because they wrote lots of unit tests and acceptance tests which give good code coverage.  They know they give good coverage because they code reviewed and QAs checked those tests when they were first written. </p>
<p>Unfortunately even agile teams suffer from technical debt, and deadline pressure, which means maybe not all of those tests did get written.  So, in fact, they may not have a safety net, and they don’t know where they need to focus their efforts to mend the holes in that net if they don’t run code coverage because they all agreed there was no need as it was just a management tool to produce a meaningless metric.</p>
<h2>Code Coverage what is it good for?</h2>
<p>Giving you the confidence to refactor safely.</p>
<p>Telling you when your <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuOHRoY29sb3IuY29tLzIwMTMvMDQvZGVhZC1jb2RlLWlzLXJvdHRpbmcteW91ci1jb2RlYmFzZS8=" 0="title="dead" 1="code"">code has started to rot</a>, and where to look first to fix it.</p>
<p>Without it you have no idea!</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10263" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/05/14/code-coverage-what-is-it-good-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do You Test in Agile Environment?</title>
		<link>http://blog.caplin.com/2013/05/01/how-do-you-test-in-agile-environment/</link>
		<comments>http://blog.caplin.com/2013/05/01/how-do-you-test-in-agile-environment/#comments</comments>
		<pubDate>Wed, 01 May 2013 13:00:40 +0000</pubDate>
		<dc:creator>Onay</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[QA]]></category>
		<category><![CDATA[Software Development Process]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10443</guid>
		<description><![CDATA[Testing in any industry means a product is built and tested. Take for example, a car tested against wet road surfaces or for maximum speed etc. This is known as “Quality Control”. The term “Quality Assurance” however is a much better fit for software development. We make sure that quality...]]></description>
				<content:encoded><![CDATA[<p>Testing in any industry means a product is built and tested. Take for example, a car tested against wet road surfaces or for maximum speed etc. This is known as “Quality Control”.</p>
<p>The term “Quality Assurance” however is a much better fit for software development. We make sure that quality is defined and built from beginning of software development process, not just to check at the end of production.</p>
<p>In major Agile techniques, the workflow (shown as columns in Kanban and Scrum boards) is divided up the into following stages:</p>
<p>• <strong>Defining the requirements (Backlog)</strong><br />
<strong> • In development</strong><br />
<strong> • In test</strong><br />
<strong> • Done</strong></p>
<p>There might be more columns on the board but the ones above are common to all variations. Each of the two week sprint turns into a mini waterfall when the team members do not collaborate and there is a clear handover from BA to developers and from developer to testers. As you can see, testing contributes to the project as ‘Quality Control’ instead of ‘Quality Assurance’.</p>
<p><strong>So how can we quality assure from the beginning?</strong> This article aims to address this challenge. In part I of this article we will concentrate on only defining requirements part. Part II will deal with development and testing stages.</p>
<h3>Defining the requirements</h3>
<p>At the beginning of the sprint developers and testers are given a list of stories. If requirements for these stories are determined without any collaboration between developers, QA Engineers and BA’s or PO’s then several problems will rise from this:<br />
1. <strong>The requirements can get lost in translation when multiple stakeholders are involved.</strong><br />
<strong> 2. When the requirements are defined in abstract terms, they can be ambiguous and overlooked until developer(s) start working.</strong><br />
<strong> 3. The requirements do not tend to include negative or edge case or unlikely scenarios.</strong><br />
<strong> 4. A particular requirement may conflict with existing functionality, or the requirements may be inconsistent with each other.</strong><br />
<strong> 5. The requirements may force a certain type of implementation or technology without defining what business problem it is trying to solve.</strong><br />
<strong> 6. Business Analysts and Product Owners may be the domain experts and what seems obvious to them may not be obvious to developers or testers (or worse the words might mean something else to them).</strong></p>
<p>Team members with different expertise may not have the same understanding from the same subject. Like one comedian pointed out, when he hears “disabling cookies” he thinks of biting the legs off a ginger man biscuit.</p>
<h2>So how do we prevent ambiguity during the requirements definition phase?</h2>
<p>The solution is to acknowledge there is a communication gap and resolve it. The best way of achieving this according to Gojko Adzic author of ‘<a  0="title="Bridging" 1="the" 2="Communication" 3="Gap"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5hbWF6b24uY28udWsvQnJpZGdpbmctQ29tbXVuaWNhdGlvbi1HYXAtU3BlY2lmaWNhdGlvbi1BY2NlcHRhbmNlL2RwLzA5NTU2ODM2MTA=">Bridging the Communication Gap</a>’ book is to run a <span style="text-decoration: underline;">specifications workshop</span> before each sprint. The workshop should be attended by BA’s, developer(s), QA Engineers and if possible stakeholder(s).</p>
<h2>Preventing the workshop from turning into another boring meeting</h2>
<p>1. Every participant should focus on what the requirements are and not how to develop or test them.<br />
2. The workshop should take no longer than 2-3 hours.<br />
3. Only stories which will be implemented in the next sprint should be discussed nothing else.<br />
4. <span style="text-decoration: underline;">To cover as many important cases as possible, each requirement should be explained by specific examples.</span><br />
5. The specific examples should be documented and signed off by the BA.<br />
6. If the BA needs to obtain more details about the specific examples from stakeholders, then this should be noted down and one of the participants should be assigned to chase for the answers.<br />
The list item 4 deserves more explanation. One of the best ways of understanding a new concept is to give examples. So I am going to give you an example about how to write examples:</p>
<h2>Example of “Specification by Example”</h2>
<p>Requirement: “User has to enter a valid amount into the textbox to execute a spot trade on a tile. See the UX design below”:</p>
<p><img title="Trade Tile" src="http://blog.caplin.com/wp-content/uploads/tile3.png" alt="Trade Tile" width="244" height="149" /></p>
<p>The questions a developer or QA Engineer might ask to the BA:</p>
<p><img title="Q&amp;A" src="http://blog.caplin.com/wp-content/uploads/QandA8.png" alt="Q&amp;A" width="536" height="601" /></p>
<p>Now that we have all the questions we can think of answered, we can organise it into tables for neat presentation:</p>
<p><img title="Example Table" src="http://blog.caplin.com/wp-content/uploads/ExampleTable2.png" alt="Example Table" width="488" height="422" /></p>
<p>We now have a clear requirement which is ready to develop and write acceptance tests. In this approach ‘Business Requirement’ becomes equal to ‘Acceptance Testing Criteria’.</p>
<h2>The benefits of specifications workshop are:</h2>
<ul>
<li>Everyone in the team think harder about needs of business and users,</li>
<li>Identify gaps in the initial set of requirements,</li>
<li>Potential bugs are eliminated,</li>
<li>Acceptance criteria for testing are already determined (QA starts now).</li>
</ul>
<p>A specification workshop is not a:</p>
<ul>
<li>Sprint planning meeting,</li>
<li>Software design meeting,</li>
<li>Sizing meeting,</li>
<li>Test design meeting.</li>
</ul>
<p><strong>In the next part of this article, I will take you through how to validate this requirement which happens in development and testing phases.</strong></p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10443" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/05/01/how-do-you-test-in-agile-environment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JQueryUK 2013: The Other Talks</title>
		<link>http://blog.caplin.com/2013/04/23/jqueryuk-2013-the-other-talks/</link>
		<comments>http://blog.caplin.com/2013/04/23/jqueryuk-2013-the-other-talks/#comments</comments>
		<pubDate>Tue, 23 Apr 2013 14:51:25 +0000</pubDate>
		<dc:creator>Adam Iley</dc:creator>
				<category><![CDATA[Stuff we like]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10435</guid>
		<description><![CDATA[I recently wrote a post about getting to JQuery UK and the keynote speech with Brendan Eich.  Now I wanted to add the rest of my notes from the conference: JQuery 1.9 and 2.0 &#8211; Richard Worth Richard Worth was up next, and spoke mainly about the coming divergence between...]]></description>
				<content:encoded><![CDATA[<p>I recently wrote a post about getting to JQuery UK and the keynote speech with Brendan Eich.  Now I wanted to add the rest of my notes from the conference:</p>
<p><strong>JQuery 1.9 and 2.0</strong> &#8211; <strong>Richard Worth</strong></p>
<p>Richard Worth was up next, and spoke mainly about the coming divergence between the 1.x line which will continue to support IE6-8 and the 2.x line which will not.  Apparently, this allowed them to remove 12% of their codebase and has better compatibility with environments that aren&#8217;t desktop browsers.</p>
<p>He talked about the intentionally limited scope of core jQuery, covering only Dom manipulation, events, animations and ajax, but also highlighted how plugins can let you add functionality seamlessly.</p>
<p>A topic that came up a few times was that you need more than JQuery to build a well architected large application, but Richard talked about how ubiquitous jQuery is (9/10 javascript using websites) and mentioned that many MV* frameworks build on top of JQuery.</p>
<p>JQuery 2.0 lets you opt out of different pieces, ultimately getting as small as 10k when minified and gzipped for just the dom manipulation and selection.</p>
<p>He also promised that JQuery 1.x would be supported &#8220;until IE6, 7 and 8 is no longer relevant&#8221; and that 1.10 upwards will have the same API as 2.0 upwards (1.10 -&gt; 2.0, 1.11 -&gt; 2.1, etc.)</p>
<p><strong>I know JQuery.  Now What? &#8211; Remy Sharp<br />
</strong></p>
<p>Remy Sharp was aptly represented by the joker card, and he gave a talk about the importance of carefully considering whether you really need jQuery at all.  He&#8217;s put the talk up as a blog post <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3JlbXlzaGFycC5jb20vMjAxMy8wNC8xOS9pLWtub3ctanF1ZXJ5LW5vdy13aGF0Lw==" 0="target="_blank"">here</a>.</p>
<p>He started provocatively by saying that for many people &#8220;JQuery is the gateway drug to Javascript programming.  This talk is about how to get clean and kick your dirty habit.&#8221;</p>
<p>One of the key things is that much of the functionality of jQuery has begun to be folded in to browsers and for basic functionality they&#8217;ve converged on standards too.  This means that if you&#8217;re working in more recent browsers, you may not need JQuery at all.</p>
<p>He suggested some common possible replacements:</p>
<ul>
<li>querySelectorAll instead of $</li>
<li>putting javascript at the end so you don&#8217;t have to worry about onready.</li>
<li>Use the standard dom methods for setting classes and getting attributes.</li>
<li>Dataset allows you to store values on dom nodes.</li>
<li>XHR2 has a bunch of nice features that give you more control than jquery for Ajax.</li>
<li>HTML5 form support now has a lot of features, e.g. pattern, required and type that reduce your need to write jquery code.</li>
<li>Lots of stuff can be done in CSS now that people previously used JQuery for.</li>
<li>Injecting a stylesheet and using classnames is likely to be more performant than using JQuery .css.</li>
<li>RequestAnimationframe is important for smooth animations and vanilla jquery only uses setInterval.</li>
<li>Use translate to move stuff and the transitionend event to fire javascript.</li>
</ul>
<p>&#8220;If it&#8217;s native to the browser let the browser get on with its job.&#8221;</p>
<p>As an example of the kind of thing that Remy hates, he provided FitText,<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9naXRodWIuY29tL2RhdmF0cm9uNTAwMC9GaXRUZXh0LmpzL2Jsb2IvbWFzdGVyL2pxdWVyeS5maXR0ZXh0Lmpz"> a jquery plugin</a> that really didn&#8217;t need to be.  He rewrote it in <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3ZhbmlsbGEtanMuY29tLw==" 0="target="_blank"">vanilla javascript</a> which you can see <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2pzYmluLmNvbS9lYmVyYW4vOS9lZGl0" 0="target="_blank"">here</a>.</p>
<p>It&#8217;s fun that the jQuery community is confident enough to have these kinds of talks at their conference.</p>
<p><strong>JQuery is a Swiss Army Knife (and that&#8217;s OK!) &#8211; Adam Sontag</strong></p>
<p>While Adam Sontag was ostensibly the counter point to Remys slightly anti-jQuery talk, apart from professing a deep affection for jquery, he said many of the same things, even to calling JQuery a &#8216;gateway drug&#8217;.</p>
<p>He adopted a swiss army knife metaphor to describe jQuery: In a pinch, you could build an entire house with it.  As long as you don&#8217;t want to live in it for very long. But you might use it to open a can of paint, etc, etc.  It&#8217;s a swiss army knife. You need bigger building blocks than just what jquery gives you, such as MV* frameworks.</p>
<p>The elitism of many developers and the way that jQuery is sometimes maligned clearly irritates Adam, he compared people complaining about JQuery users to people saying &#8220;We&#8217;re not going to teach you English because one day you might say something dumb&#8221;.</p>
<p>He also talked about how jQuery is engaging with the community and what that is like &#8211; learning the mechanics of open source can be intimidating, like programming itself, but jQuery have open sourced everything, including documentation and site design. There&#8217;s an exciting new contribution hub, <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvbnRyaWJ1dGUuanF1ZXJ5Lm9yZy8=" 0="target="_blank"">contribute.jquery.org</a>.  Supporting the community is an investment that keeps it growing.  Everyone who contributes regularly is invited to join.</p>
<p>JQuery happens every day online and regularly in person on IRC. Relationships that go beyond code improve code.</p>
<p>On top of all that, jQuery became a foundation and is now a member of ECMA and W3C.</p>
<p><strong>Taking control with Machina.js &#8211; Doug Neiner</strong></p>
<p>Doug talked about the open source state machine for JavaScript <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21hY2hpbmEtanMub3JnLw==" 0="target="_blank"">Machina.js</a>.  It&#8217;s an interesting project, with some similarities to a state machine library we have created at Caplin.  Our library has implementations in both Java and Javascript and the client and server can have their statemachines kept synchronised.</p>
<p><strong>Use events to glue full-stack frameworks together &#8211; Garann Means</strong></p>
<p>Cramming everything into MVC sucks. Model = state management, View = rendering, controller = everything else?</p>
<p>Solving some of these problems tends to lead to a mixture of promises, custom events, pub/sub, event emitters and callbacks.  You can use events to augment MVC, which let you hook all your pieces together, going from the client side right back to the server side.</p>
<p>Garann also talked about some of the full stack frameworks out there that she likes, hoodie.js and meteor.js.</p>
<p><strong>What, Chrome DevTools can do that? &#8211; Ilya Grigorik</strong></p>
<p>Ilya recommended discover-devtools, a<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jb2Rlc2Nob29sLmNvbS9jb3Vyc2VzL2Rpc2NvdmVyLWRldnRvb2xz" 0="target="_blank""> new course on codeschool</a>.  You can also get his presentation <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2JpdC5seS9kZXZ0b29scy10cmlja3M=" 0="target="_parent"">here</a>.</p>
<p>He talked about some sneaky ways to speed pages up. For example google start sending the search results page before they&#8217;ve even worked out what the search is, so that browsers can start rendering and requesting resources immediately.</p>
<p>A good place to investigate the speed of pages is the &#8216;waterfall&#8217; display in Chrome Dev Tools.  You can save the data behind the display as a HAR file, and there are tools that can parse the format and let you inspect it offline or integrate the process into your build.  This can be good if a client complains that your site is slow &#8211; they can send you the HAR file and you can investigate.</p>
<p>Some other good tips:</p>
<ul>
<li>chrome.loadTimes()   Snippets: chrome.loadTimes().firstPaintTime &#8211; chrome.loadTimes().startLoadTime;</li>
<li>local modifications</li>
<li>chrome://tracing</li>
<li>console.time(&#8220;name&#8221;) / console.timeEnd(&#8220;name&#8221;)</li>
</ul>
<p>Dev Tools has a number of options to help you debug where your rendering time is spent, and rendering time is important.  User interaction with timeline dropped when facebook went from 60fps to 30fps, which means that you need to be spending less than 16ms per frame.</p>
<p><strong>Faster Dom Manipulation with Category theory and wield &#8211; John Bender</strong></p>
<p>John enjoys investigating and talking about the link between theory and practice.  In this case, he showed how observing the link between JQuery and category theory led him to start using &#8216;loop fusion&#8217; optimisations to make his jQuery faster.</p>
<p>It&#8217;s difficult to summarise the theory as well as he did (so check out his presentation <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2pvaG5iZW5kZXIudXMvcHJlc2VudGF0aW9uLWZhc3Rlci1qcw==" 0="target="_blank"">here</a>), but:</p>
<p>A category consists of objects and morphisms which map from one object to another.  You can think of the DOM objects and functions as one category and the world of JQuery objects and the functions that work on those as another.</p>
<p>A functor maps from one category to another.  You need to be able to map both the functions and the objects.  In JQuery, the $ function is part of a functor that maps from Dom objects to JQuery objects and the jQuery function &#8216;map&#8217; converts functions that work on dom objects to functions that work on JQuery objects.</p>
<p>There is a composition functor law; the mapped composition of two morphisms in one category has to be the same as the composition of two mapped morphisms.  This essentially means that mapping a function that makes two dom changes is the same as mapping two functions that make one dom change, which means that you can just go ahead and combine the behaviours and just loop over your jquery collections once (&#8216;loop&#8217; fusion).</p>
<p>John has created a library based on these ideas. <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=Z2l0LmlvL2w5S1lFZw==" 0="target="_blank"">wield</a>.</p>
<p><strong>Complex client-side apps and legacy browsers (A story of Frustration) &#8211; Joe Petterson</strong></p>
<p>Joe spent much of his talk describing ways of testing against multiple different browsers.  He suggested using Selenium with a group of VMs.  You can manage your VMs with a script like the one <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=JTIwaHR0cHM6Ly9naXRodWIuY29tL3hkaXNzZW50L2lldm1z" 0="target="_blank"">here</a> although it will take an enormous amount of RAM.</p>
<p>While his talk was interesting, we&#8217;ve moved away from testing via user interaction in the browser as much as we can.  We found Selenium tests to be brittle and slow, so we turned a nights worth of Selenium tests into 10 minutes worth of view model tests and are really happy with that decision.  There are still things that you need Selenium for, but we try to keep that to a minimum.</p>
<p><strong>Build an Experience&#8230; Not another Framework &#8211; Jason Scott</strong></p>
<p>Jason&#8217;s talk focussed on his work using jQuery Mobile on Blackberry 10.  He talked about using Ripple to emulate the mobile web, and boasted that the Blackberry browser has a higher HTML5 rank than desktop Chrome.</p>
<p>He talked a lot about things to consider when serving data to mobile, but also made the point that sometimes it&#8217;s better to admit defeat in terms of mimicing native behaviour in favour of something more appropriate: &#8220;better to have a decent experience than copy a great experience and end up with a bad one&#8221;.</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10435" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/04/23/jqueryuk-2013-the-other-talks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The History and Evolution of Executing Futures</title>
		<link>http://blog.caplin.com/2013/04/23/the-history-and-evolution-of-executing-futures/</link>
		<comments>http://blog.caplin.com/2013/04/23/the-history-and-evolution-of-executing-futures/#comments</comments>
		<pubDate>Tue, 23 Apr 2013 10:27:08 +0000</pubDate>
		<dc:creator>Jennifer Reid</dc:creator>
				<category><![CDATA[Trading Technology]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10429</guid>
		<description><![CDATA[Plaformability is a rare glimpse into the inner workings of a highly skilled, tightly aligned London based software development team dedicated to creating frameworks for single-dealer platforms (SDPs). We dedicate this blog to writing about the technology that fuels SDP&#8217;s, but did you know that we also write about trading in...]]></description>
				<content:encoded><![CDATA[<p>Plaformability is a rare glimpse into the inner workings of a highly skilled, tightly aligned London based software development team dedicated to creating frameworks for <a  0="title="Single-dealer" 1="platforms"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jYXBsaW4uY29tL3NpbmdsZS1kZWFsZXItcGxhdGZvcm1z">single-dealer platforms</a> (SDPs). We dedicate this blog to writing about the technology that fuels SDP&#8217;s, but did you know that we also write about trading in the capital markets on <a  0="title="www.singledealerplatforms.org"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5zaW5nbGVkZWFsZXJwbGF0Zm9ybXMub3Jn">www.singledealerplatforms.org</a>?</p>
<p>Daniel Owen&#8217;s (former futures trader and current member of Caplin&#8217;s dev team) <a  0="title="The" 1="Evolution" 2="of" 3="Executing" 4="Futures" 5="-" 6="Part" 7="I"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3NpbmdsZWRlYWxlcnBsYXRmb3Jtcy5vcmcvMjAxMy8wMy8xNC90aGUtZXZvbHV0aW9uLW9mLWV4ZWN1dGluZy1mdXR1cmVzLXBhcnQtaS8=">latest two part series</a> on the history and evolution of executing futures will appeal to techies looking for background in trading platforms and execution and how systems have developed over time.</p>
<div id="attachment_10430" class="wp-caption aligncenter" style="width: 310px"><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvU2VsbE9yZGVyc09uYUNoYXJ0VHJhZGVyLnBuZw=="><img class="size-medium wp-image-10430" title="SellOrdersOnaChartTrader" src="http://blog.caplin.com/wp-content/uploads/SellOrdersOnaChartTrader-300x231.png" alt="Sell Orders on a Chart Trader" width="300" height="231" /></a><p class="wp-caption-text">Sell Orders on a Chart Trader</p></div>
<p>An excellent read for anyone involved in trading systems development.</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10429" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/04/23/the-history-and-evolution-of-executing-futures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQueryUK and the Future of Javascript</title>
		<link>http://blog.caplin.com/2013/04/20/jqueryuk-and-the-future-of-javascript/</link>
		<comments>http://blog.caplin.com/2013/04/20/jqueryuk-and-the-future-of-javascript/#comments</comments>
		<pubDate>Sat, 20 Apr 2013 08:39:07 +0000</pubDate>
		<dc:creator>Adam Iley</dc:creator>
				<category><![CDATA[Stuff we like]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10421</guid>
		<description><![CDATA[My initial plan to spot someone who looked jqueryey and follow them turned out to be completely unnecessary.  The White October guys doing the organising had strategically placed friendly people with large pointers and painted white rabbits feet on the ground leading all the way from the train station, past...]]></description>
				<content:encoded><![CDATA[<p>My initial plan to spot someone who looked jqueryey and follow them turned out to be completely unnecessary.  The White October guys doing the organising had strategically placed friendly people with large pointers and painted white rabbits feet on the ground leading all the way from the train station, past several gawping ducks and geese along the river side to the conference centre.</p>
<p>The style of the conference continued with a Lewis Caroll theme running through everything.  The 3m tall dragon that greeted you as you entered the building turned out to be a jabberwocky and was also featured on some rather cool jquery uk t-shirts that all attendees received.</p>
<p>After chatting to the guys from Infragistics and getting a tea and coffee in the sponsors hall, we were all ushered into a large hall to begin the conference proper.</p>
<p>The conference guide took the form of a deck of laminated cards with the speakers details on the obverse.  The Ace of Spaces took the stage: Brendan Eich.</p>
<p><strong>Javascript : The Future</strong></p>
<p>Brendan covered two main areas in his talk; the exciting things coming up in ecmascript 6 and the amazing performace gains that have been made through the use of emscripten and asm.js.</p>
<p>Although &#8220;Harmony is like a family that has gone through some hard times&#8221;, it&#8217;s been exciting to see people finally getting on board.  Brendan characterised Microsoft&#8217;s attitude to the process as &#8220;No, Never! No, No, Yes.&#8221;  And while it will be some time before the whole standard is finalised and widely implemented, he encouraged us to start using it soon, since parts have already been implemented in all the major browsers.</p>
<p>Then we got a whistle stop tour of all the features that are coming up.</p>
<p>arrow functions  / classes / Object.mixin (super will work with mixin) / modules / symbols / private syntax (@ not dot) / default parameters / rest parameters / spread operator / iterators, generators, for of (based on an iterator symbol) / Comprehensions / Maps with arbitrary keys / Sets / weakmaps / proxy (allows no such method)</p>
<p>It sounds like there&#8217;s been a lot of inspiration from Python, but that&#8217;s a good thing. We&#8217;re certainly excited about a these and a lot of the audience seem pretty stunned by the rapid fire revelation of feature after feature.</p>
<p>Brendan also addressed some common complaints, like &#8216;callback hell&#8217;. At the same time as talking about some of the things that could be done (maybe promises in es7?), he did say that he thought a lot of the complaining was overdone: &#8220;there&#8217;s too much whining about nesting&#8221;. He&#8217;s thinks the right answer is a combination of generators and a library called spawn.js which allows you to write &#8216;straight line code&#8217; that looks synchronous but is actually asychronous.</p>
<p>One of the challenges of ecmascript 6 is to improve the experience both for developers writing javascript and also make it a better language target for other languages to be compiled to. Brendan talked about why javascript is better than bytecode (it&#8217;s similarly dense, it&#8217;s higher level, it&#8217;s not future hostile,<br />
it&#8217;s safer) but said &#8220;For now, we&#8217;re serving two masters, humans and computers.  May the best animal win.&#8221;</p>
<p>We got a brief plug for firefoxOS phones, e.g. from <a  0="title="geeksphone"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5nZWVrc3Bob25lLmNvbS8=">geeksphone</a> but apparently a number of manufacturers are on board, including Sony.</p>
<p>Then we jumped into the next part of the talk &#8211; the things that have been done to make the web ready for triple-A games. According to Brendan, triple A games are the wrench dodging of the software world. If you can run a triple-A game, you&#8217;ll be able to run nearly anything.  And then he showed us firefox doing<br />
just that, loading up the Unreal Engine Citadel demo live, and finally playing a few rounds against some bots in first person shooter Sanctuary.  The bot &#8216;Torque&#8217; drew first blood, but Brendan managed to get some applause for shooting &#8216;Matrix&#8217;.  The graphics were beautiful and the performance was in excess of what most people<br />
would have ever expected from a browser scripting language.  They&#8217;d managed to achieve this by transpiling from C++ to a subset of heavily optimisable javascript.  That was enough to elicit a &#8216;Bloody Hell&#8217; from someone behind me.</p>
<p>In the Q&amp;A section, an interesting question was raised about how to &#8216;protect&#8217; your javascript code. Brendan said that the Mozilla Foundation is strongly opposed to most forms of DRM.  He spoke passionately against having &#8216;policemen&#8217; in your computer controlling what you could do with it.  He said that actually, very<br />
few of the organisations they were collaborating with were too worried about their source code being extractable but he also spoke about considering pragmatic solutions to help provide rental models which customers seem to want. He mentioned a watermarking approach, which apparently many of the online video providers are moving towards, and seems to be a better approach.</p>
<p>Write ups for the other talks coming up soon &#8211; I just have  a hack day to go to first!</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10421" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/04/20/jqueryuk-and-the-future-of-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leaking Memory in Single Page Javascript Applications</title>
		<link>http://blog.caplin.com/2013/04/12/leaking-memory-in-single-page-javascript-applications/</link>
		<comments>http://blog.caplin.com/2013/04/12/leaking-memory-in-single-page-javascript-applications/#comments</comments>
		<pubDate>Fri, 12 Apr 2013 15:37:46 +0000</pubDate>
		<dc:creator>Adam Iley</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10385</guid>
		<description><![CDATA[Back in the bad old days, not so very long ago, lots of development teams had to support IE6. One of the major problems of writing large javascript applications in antediluvian versions of Internet Explorer was that memory would leak very easily, and you’d suddenly find that your initially snappy...]]></description>
				<content:encoded><![CDATA[<p>Back in the bad old days, not so very long ago, lots of development teams had to support IE6. One of the major problems of writing large javascript applications in antediluvian versions of Internet Explorer was that memory would leak very easily, and you’d suddenly find that your initially snappy application was slowing your whole machine to a crawl if left running for any significant period of time. What made it worse is that IE6 wouldn’t even reclaim some leaked memory when you reloaded the page.</p>
<p>That particular leak gained a great deal of infamy and you can find a lot of information online about the DOM/JS circular reference memory leak (e.g. <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2phdmFzY3JpcHQuY3JvY2tmb3JkLmNvbS9tZW1vcnkvbGVhay5odG1s" 0="rel="nofollow"">here</a> or <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jb2RlcHJvamVjdC5jb20vQXJ0aWNsZXMvMTIyMzEvTWVtb3J5LUxlYWthZ2UtaW4tSW50ZXJuZXQtRXhwbG9yZXItcmV2aXNpdGVk" 0="rel="nofollow"">here</a>). This leak was so serious because most of the natural patterns for event handlers would end up creating circular references between javascript and dom elements that IE didn’t know how to garbage collect. This was finally fixed in IE8.</p>
<p>Fortunately, we (at Caplin) don’t have to support versions of IE lower than 8 any more, so does that mean we can stop worrying about memory leaks? Sadly not. The applications we work on are single page applications with a requirement that they can run for days without needing to be reloaded. In that time the user might make multiple trades, hunderds of thousands of updates might come in over the network and need to be rendered to screen, elements might be removed and added from the screen, and grids with many thousands of live updating rows might be scrolled, sorted, reordered or filtered.</p>
<p>In situations like that, there are plenty of opportunities to leak memory in your own code, let alone (for the moment) from browser bugs.</p>
<h2><a name="ClientsideMemoryLeaks-MemoryLeaksThatAreYourFault"></a>Memory Leaks That Are Your Fault</h2>
<p>By far the most likely way you are going to leak memory is by adding listeners and failing to remove them. You need to develop discipline to remember that every time you add a listener you should be writing the mirror image code to remove the listener.</p>
<p><a name="ClientsideMemoryLeaks-HierarchyofPossiblyListeningObjects"></a><em>Hierarchy of Possibly Listening Objects</em><br />
<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvaGllcmFyY2h5bGlzdGVuZXJzMS5wbmc="><img class="alignright  wp-image-10404" style="border: 1px solid black;" title="hierarchylisteners" src="http://blog.caplin.com/wp-content/uploads/hierarchylisteners1.png" alt="" width="249" height="181" /></a><br />
Something that can make it more difficult to remember to remove listeners is when you have a tree of objects, and you need to remove an object and its children from the tree. You might remember to clear all the listeners from the object you’re removing, but did you remember to clear the listeners from the children?</p>
<p>This is the kind of situation where it’s useful to have a dispose method that calls the dispose methods of its children so that each child can worry about cleaning its own references up and then instructing its children to do the same.</p>
<p><a name="ClientsideMemoryLeaks-RunningInitialisationCodeTwice"></a><em>Running Initialisation Code Twice</em></p>
<p>Something else that can catch you out is if you have a bug that causes your initialisation code to run twice.  It’s very common that initialisation code registers listeners and then keeps hold of a reference that is later used to deregister the listener.  If you run a naïve version of this code twice, it will register the listener twice, then throw away one of the references meaning that when you do eventually clean up your object, you’ll only remove the most recently added listeners.</p>
<p>For this reason, if it’s possible for initialisation code to run twice, I like it to check to see if it has already been initialised and throw an exception if so. That means that your code <em>fails fast</em> and you can’t just have a double-initialisation bug lurking there without you realising. If your code needs to be able to initialise twice (e.g. perhaps a setModel method) then it should check to see if it needs to deregister a listener before it starts adding any listeners.</p>
<p><a name="ClientsideMemoryLeaks-ThirdPartyLibraries"></a><em>Third Party Libraries</em></p>
<p>There are sometimes leaks in third party libraries, particularly since many thirdparty libraries haven’t been written with week long run times in mind, but more often, those libraries provide a mechanism for you to clean up that people forget or don’t know to use. If you’re using jquery controls, you should be calling destroy. If you’re using knockout you should remember to call ko.cleanNode (despite the fact that there doesn’t seem to be any documentation for it).</p>
<p><a name="ClientsideMemoryLeaks-ObviousStuff"></a><em>Obvious Stuff</em></p>
<p>The simplest kind of memory leak is adding things to a data structure and never removing them. One easy way to do this is when logging. If you’re adding a log line to a DOM element or an array and never removing it, that’s a memory leak. One solution is to ensure your logs never grow beyond a particular maximum size by removing the oldest line every time you add a new one once you get over a particular size.</p>
<h2><a name="ClientsideMemoryLeaks-MemoryLeaksThatAreNotYourFault(Butyouneedtoworkaroundanyway)"></a>Memory Leaks That Are Not Your Fault (But you need to work around anyway)</h2>
<p>Despite the fact that things have improved a great deal, there are still browser bugs that are likely to bite you when it comes to memory management.</p>
<p><em>XHR</em></p>
<p>It’s common when making a request to a server to create a local XMLHttpRequest object and add a listener to it, and then allow that XMLHttpRequest to go out of scope.  Now there is no code reachable from your own code that has a reference to that XHR, but of course it would be nonsense for the javascript engine to clean it up as if it were garbage, you’re actually expecting the request to happen and ultimately for the callbacks to get called.</p>
<p>Browsers like Chrome keep the xhr from being garbage collected only while the request is outstanding, although even that is longer than you might expect.  Once the request is completed, if there are no further references to the xhr, then it will be collected.  In IE8, any reference to the xhr from within the onreadystatechange callback function would stop the whole xhr (including any data it might have loaded) from being collected.  There is more information <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BocHRvdWNoLmNvbS8yMDExLzA4LzAyL3htbGh0dHByZXF1ZXN0LWxlYWstaW4taWUtNzgv" 0="rel="nofollow"">here</a>.  My testing seems to suggest that it&#8217;s been fixed in IE9.</p>
<p><em>IE Map</em></p>
<p>Even basic object access can cause a leak in Internet Explorer.  In most browsers, if you add a key/value pair to an object, then delete that mapping, the memory of that mapping is reclaimed.  In IE, even IE9, while the mapping itself is reclaimed, the key is not.  You can see this by writing code that stores something under an enormous key and then deletes that key.</p>
<pre class="brush: jscript; gutter: true; title: ; toolbar: false; notranslate">
var globalObject = {};

function start() {
    var randomKey = new Array(5000000).join(String(Math.random()));
    globalObject[randomKey] = true;
    delete globalObject[randomKey];
}
</pre>
<p>If you run start a few times in Chrome, it will use a lot of memory and then reclaim it all, while if you run it in IE9, it will grab the memory and never let go. You can easily push it up to its maximum at which point it will start throwing Out Of Memory errors.</p>
<p><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvbWFwa2V5LWllOS5wbmc="><img class="alignleft" style="margin-top: 0px; margin-bottom: 0px;" title="mapkey-ie9" src="http://blog.caplin.com/wp-content/uploads/mapkey-ie9.png" alt="" width="313" height="379" /></a><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvbWFwa2V5LWNocm9tZTI2LnBuZw=="><img class="alignnone" title="mapkey-chrome26" src="http://blog.caplin.com/wp-content/uploads/mapkey-chrome26.png" alt="" width="313" height="379" /></a>This is usually not a serious problem, as in most maps you use a small number of short keys, however if you are creating something like a cache or anything that will have a large number of unique keys added and removed over a long period of time it can become significant.</p>
<p>Interestingly, this leak manifests itself in another way. If you iterate over the keys of an object, they are returned in the order that they are added. In most browsers, if you add a key, then remove it, then add it later, iteration over the keys will show that key in the second place it was added.  In IE, the key is returned in the order of when it was first added, indicating that IE has &#8216;remembered&#8217; that it had been previously added.  Here&#8217;s some example code:</p>
<pre class="brush: jscript; gutter: true; title: ; toolbar: false; notranslate">
var x = {};
x.first = 1;
x.second = 2;
x.third = 3;

// Logs &quot;first&quot;, &quot;second&quot;, &quot;third&quot; in all browsers.
for(var i in x){console.log(i)};

delete x.second;

// Logs &quot;first&quot;, &quot;third&quot; in all browsers.
for(var i in x){console.log(i)};

x.second = 2;

// Logs &quot;first&quot;, &quot;third&quot;, &quot;second&quot; in Firefox and Chrome
// but &quot;first&quot;, &quot;second&quot;, &quot;third&quot; in IE.
for(var i in x){console.log(i)};
</pre>
<p><strong>Things that Make Leaks Worse</strong></p>
<p>Functions have access to variables from the scope in which they are defined, a feature called ‘lexical scoping’.  When a function accesses a variable from its defining scope, it is said to ‘close over’ the variable, and such functions are often called closures.  This means that if you have a reference to a closure, then it may hold references to variables from where it was defined that cannot be garbage collected.</p>
<p>IE will keep all the elements within the lexical environment alive while a closure is referenced, but many browsers will work out exactly which ones are accessed and only keep those from being garbage collected.</p>
<p>You’ll sometimes find lots of nulling of references in clean up code.  That usually indicates that the developer knows that this object is leaking, but isn’t sure why.  Nulling references in clean up code doesn’t stop the leak, but reduces how much is leaked.  Far better to find out why and fix that.</p>
<p><strong>Finding Leaks</strong></p>
<p>Finding leaks can be pretty dispiriting since if the same objects are leaked in multiple places, you can fix a leak and see no improvement in memory usage.  It’s only when you remove the final leak pointing to that object that you start to see an improvement.</p>
<p>Years ago, tracking down leaks for us would be a tedious process of observing a leak, commenting out swathes of functionality and then trying the code again to see how much it leaks, rinsing and repeating.  We used to also insert special code around large datastructures to make it easy to find out if they were growing more than expected.</p>
<p>There are tools now that allow you to inspect heaps and compare them with each other.  In IE, we often use dynatrace, although these days we tend to start by debugging with Chrome heap snapshots. A typical session might involve taking a snapshot, doing something that might leak 7 times, then taking another snapshot and examining the difference, starting by looking for objects with counts of multiples of 7.  There&#8217;s a good article talking about how to go about finding leaks <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2dlbnQuaWxjb3JlLmNvbS8yMDExLzA4L2ZpbmRpbmctbWVtb3J5LWxlYWtzLmh0bWw=" 0="rel="nofollow"">here</a>.</p>
<p>While fixing things in Chrome first doesn’t mean you’ve definitely fixed everything in IE, it’s an easy way to get started, as things that leak in Chrome almost certainly leak everywhere, and often leak worse in IE.</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10385" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/04/12/leaking-memory-in-single-page-javascript-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FinTech New York Hackathon Round-Up</title>
		<link>http://blog.caplin.com/2013/04/08/fintech-new-york-hackathon-round-up/</link>
		<comments>http://blog.caplin.com/2013/04/08/fintech-new-york-hackathon-round-up/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 18:52:28 +0000</pubDate>
		<dc:creator>Priyank Vyas</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Trading Technology]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=10373</guid>
		<description><![CDATA[FinTech Round-Up After some much needed sleep we&#8217;re able to reflect on the inspired (and at times manic) hacking that took place this weekend in New York. Over 30 teams presented their demos competing for the grand prize of $10,000 from Novus. Hack Projects The various hacking projects can be...]]></description>
				<content:encoded><![CDATA[<h3>FinTech Round-Up</h3>
<p>After some much needed sleep we&#8217;re able to reflect on the inspired (and at times manic) hacking that took place this weekend in New York. Over 30 teams presented their demos competing for the grand prize of $10,000 from <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cubm92dXMuY29tLw==">Novus</a>.</p>
<p><strong>Hack Projects<br />
</strong>The various hacking projects can be found <a  0="title="FinTech" 1="Hacker" 2="League"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuaGFja2VybGVhZ3VlLm9yZy9oYWNrYXRob25zL2ZpbnRlY2gtaGFja2F0aG9uL2hhY2tzLw==">here on Hacker League</a></p>
<p>There were some great demos put forward by all participants and I think everyone was impressed with the creativity of the attendees and also their caffeine consumption capabilities.</p>
<p><strong>Best use of Caplin Technology Prize</strong><br />
Congratulations to <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Rhcy1maW5ncmFwaG55Yy5yaGNsb3VkLmNvbS8=">FinGraph</a> for winning our $500 Apple Voucher prize with their &#8220;amazing Graph RESTful API for discovery and visualization of financial relationships&#8221;!</p>
<p><strong>Networking<br />
</strong><span style="font-size: 1em;">These type of events present a great opportunity to not only work on some really cool stuff, but also to network with fellow developers and companies and build up good relationships. I think we can safely say we had the coolest t-shirts at the event!</span></p>
<p><img title="Caplin T Shirt" src="http://pbs.twimg.com/media/BHLJC5UCEAEnh-7.jpg:large" alt="Caplin T Shirt" width="500" height="374" /></p>
<p>The event schedule was well structured and the organisation by Nick and Francesca was excellent. All attendees were more than catered for in terms of snacks and good food throughout the night, generously donated by the sponsors. The look on some faces when it was announced Ice Cream Sandwiches were going to be available just past midnight was quite a joyous moment.</p>
<h3>Caplin and OpenFin hack project</h3>
<p>As well as assisting teams using our APIs, tools, data and services, we also formed our own hack team. We worked with OpenFin to create a desktop-integrated HTML5 alerts notification application. The app integrated <a  0="title="BladeRunner"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jYXBsaW4uY29tL2RldmVsb3Blci9jb21wb25lbnQvYmxhZGVydW5uZXI=">BladeRunner</a>, <a  0="title="Caplin" 1="Trader"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jYXBsaW4uY29tL2NhcGxpbi10cmFkZXI=">Caplin Trader</a> Blades, <a  0="title="Caplin" 1="Platform"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jYXBsaW4uY29tL2NhcGxpbi1wbGF0Zm9ybQ==">Caplin Platform&#8217;s</a> Alerting Service and <a  0="title="OpenFin"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cub3BlbmYuaW4v">OpenFin&#8217;s</a> Desktop. This meant we could deliver a slick, multi-window application, with the UI elements built entirely in HTML5, but with the feel of a native app.</p>
<p>The idea was to provide traders with a mailbox-like view of alerts that may happen during their trading day. We wanted it to be minimally obtrusive, but to allow traders to focus on specific alerts for action now or later, or ignore those that were less interesting. The alerts might be to do with instrument price thresholds being reached, trades or orders being filled, or anything else. For the purposes of the hackathon, we focused on FX price thresholds.</p>
<p><strong>How did it work?</strong></p>
<p>We used a Caplin Trader blade to set up alerts that were managed by the alerts service, hosted at platform.caplin.com. OpenFin used the Caplin Alerts API to receive notifications when alert triggers occurred, and then displayed a small, borderless notification window containing the alert summary.</p>
<p>The user then makes a decision &#8211; ignore the alert, in which case it will fade out in time, or use a gesture to action it. Swipe right to snooze or dismiss the alert (inspired by <a  0="title="MailboxApp"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5tYWlsYm94YXBwLmNvbS8=">mailbox</a>), swipe left to add to a watchlist, or double-click on the instrument to open a one-click trade tile.</p>
<p>We also used some cool animations and transparency capabilities in OpenFin to make the UX really slick. After the swipe you would see the alert animate across to the watchlist and dock itself with any other instruments already present.</p>
<p>When you want to trade, either from the watchlist or double-clicking, a new borderless window popped up containing a Caplin Trader FX trade tile blade. This had streaming one-click tradable prices coming from platform.caplin.com, and the ability to execute a trade immediately.</p>
<p>Overall we were really pleased with the outcome &#8211; we&#8217;d built a well integrated app, using features from OpenFin and Caplin,  that would significantly reduce the workflow steps needed by a trader to react to an alert and take action. And it was animated, with rounded corners and transparency, so it must be cool! <img src='http://blog.caplin.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><img title="Caplin and OpenFin demo" src="http://blog.caplin.com/wp-content/uploads/caplinOpenFin.jpg" alt="Caplin and OpenFin demo" width="500" height="378" /></p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=10373" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2013/04/08/fintech-new-york-hackathon-round-up/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
