<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jim Newbery on Medium]]></title>
        <description><![CDATA[Stories by Jim Newbery on Medium]]></description>
        <link>https://medium.com/@froots101?source=rss-620e52cfeef9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mWGZ3u1LFf-qGG7zt3D1Cg.jpeg</url>
            <title>Stories by Jim Newbery on Medium</title>
            <link>https://medium.com/@froots101?source=rss-620e52cfeef9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 06:12:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@froots101/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Create your own dysfunctional single-page app in five easy steps]]></title>
            <link>https://medium.com/hackernoon/create-your-own-dysfunctional-single-page-app-in-five-easy-steps-7bfcba9df6df?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bfcba9df6df</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Tue, 30 Oct 2018 13:29:44 GMT</pubDate>
            <atom:updated>2019-04-29T10:15:14.996Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GN_Uo3x0k2qe8Yx0teqCdg.jpeg" /><figcaption>(Some) Single-page web applications (can) damage (certain) businesses.</figcaption></figure><p>OK, now that we have the attention-grabbing, controversial introductory premise out of the way, I want it to be known that I love a well-executed single-page app (SPA) as much as the next <a href="https://hackernoon.com/tagged/javascript">JavaScript</a> developer — in the right circumstances.</p><p>But I do believe my opening statement is true for many organisations that have gone head first into developing an all-JavaScript browser-based app without asking themselves whether it’s necessary, whether they are set up to succeed or what the alternatives could be.</p><h3>The Vision</h3><p>It’s all too easy to look at prime examples of single-page apps like Google Maps and think <em>“we could build something like that!”</em></p><p>After all, it’s just a website, right? There are open source JavaScript frameworks like React and Angular that can help us build it. Other teams have built amazing things with these technologies. We know because we use them ourselves all the time.</p><p>But it’s far easier to create a single-page app that doesn’t fulfil this vision. We can easily end up with a sluggish app that resists improvement and repels new features. There is a very long tail of quality in JavaScript apps, especially in enterprise settings.</p><p>I’ve seen this often in my consulting work with product teams. They can struggle with single-page apps because they underestimated the investment of time, expertise and energy required to make them anywhere near as good as the Google Maps of this world.</p><p>Let’s look at how this can happen. Spoiler alert: it’s got very little to do with the technology and a lot to do with teams and people.</p><h3>Assumed user benefits</h3><p>Product teams are drawn to single-page apps in the first place because there are some implied or assumed universal benefits to users (and therefore to the bottom line of the business).</p><p>Curiously, we don’t often talk about the user benefits of SPAs, preferring to talk about features and characteristics instead.</p><p>I think are three broadly assumed user benefits of single-page apps:</p><ol><li><strong>Improved user experience</strong>. We are providing application-like patterns of interaction comparable to native desktop or mobile apps, focusing on data and tasks rather than an arbitrary page and document model.</li><li><strong>Improved perceived performance</strong>. Instead of interrupting task flow with full page refreshes we can provide visual feedback, and allow users to continue other tasks in parallel.</li><li><strong>It’s still the web</strong>. We can take advantage of all the benefits of the web platform: universal access and device compatibility, no installation, deep linking, sharing, indexing, etc.</li></ol><p>These benefits depend on execution, building on the approach we’ve taken. They do not come free with the JavaScript frameworks and libraries we have adopted, despite any messages propagated by marketing or hype.</p><p>Single-page apps represent a shift of complexity to browser-based code. Not just away from the server, but in some cases away from browser-native features too. We’ve seen this before. They used to be called <em>thick clients</em>. In the latter days of Flash, they were <em>Rich Internet Applications</em>. Now, many people just refer to them as <em>web apps</em>.</p><p>Unfortunately, plenty of teams end up creating a mess, because they fail to adapt their approach for developing thick clients applications, where the complexity is concentrated in JavaScript code that runs on the uncertain and varied computing environment that is a user’s device.</p><h3>5 mistakes to create a dysfunctional single-page app</h3><p>Below are five common mistakes I’ve seen teams make when building a SPA-based product. Each of these are people or practice problems that we often interpret as pure technology problems.</p><p>Unfortunately, each mistake can lead to the next, compounding the overall situation.</p><h4>Mistake 1: Under-estimate long-term development and maintenance costs</h4><p>Many teams underestimate the time and cost necessary to make a high-quality single-page app.</p><p>There are a lot of conspiring reasons for this.</p><p><strong>Framework marketing focuses on the early developer experience</strong></p><p>Framework marketing and discussion tends to focus on the ease of early development work, rather than on long-term maintenance. How much of the framework marketing makes claims of helping you to write code that’s easy to refactor? Not much. Likewise, educational resources around refactoring are rare compared to the army of introductory tutorials.</p><p><strong>Low visibility of the true maintenance costs</strong></p><p>This is true of all software of course, but many technical managers have limited experience of running the development of JavaScript-heavy apps, so the maintenance and continual improvement tax of single-page apps can come unexpected if you haven’t been there.</p><p><strong>Incremental improvement work is de-prioritised</strong></p><p>In small product companies, UI product work is often expected to go at a break-neck pace. Continual improvement, refactoring and gradual long-term migration work can be seen as an unnecessary tax on feature velocity. The long-term result can easily be utter seizure due to technical and product debt.</p><h4>Mistake 2: Use the single-page app approach unilaterally</h4><p>This mistake reflects the most common argument against using the single-page app approach. It’s not the right approach to take in many circumstances.</p><p>When we start a project, many development teams make a single default choice of technical approach to cover all anticipated functionality. This usually means that your framework of choice absorbs everything, irrespective of user needs. “At BobsWidgets we use React!” screams the developer job advert.</p><p>This pre-emptive decision-making can be risky. Using the SPA pattern for everything can be overkill. After all, your typical business app is a Create-Read-Update-Destroy (CRUD) affair — possibly with one or two key features that demand a genuinely dynamic, data-driven UI. Mapping and real-time data visualisation are obvious examples.</p><p>But that doesn’t mean the other parts should suffer as a result. We are assuming that the user benefits of creating all functionality with JavaScript apply evenly across a product. I’m not convinced from what I’ve seen.</p><p>We ask “What framework should we use for this whole app?” for new products up front, when we don’t even understand what we’re building yet. It’s far less wasteful to ask “What technical approach best supports this user need?” on a case-by-case basis as we learn more about those user needs during incremental product design and development.</p><p>This up front decision making often means that progressive enhancement (PE) goes out of the window immediately, sacrificed for the benefit of developer convenience and consistency of tooling and approach. Instead we assume universal JavaScript operability and hope the framework we have chosen will provide adequate performance and accessibility capabilities out of the box.</p><p>This is just one example of a collective bias towards focusing on work inputs (the tools we use and the code we write) over their outcomes (the value our product brings to users and customers).</p><h4>Mistake 3: Under-invest in front end capability</h4><p>Complexity in web apps has shifted from back end to front end in the last ten years. Or, more accurately, we’re attempting to offer more capability, which results in more complexity overall. The front end is taking on most of this new complexity.</p><p>Front end JavaScript application development patterns are still in a developing phase, in the face of a rapidly evolving language, web platform and uncertain execution environments. This means more work has to go into providing equivalent complexity than in the back end.</p><p>The balance in product team capabilities has not always shifted in line with this. Perhaps attitudes and habits are slower to change than technology adoption.</p><p>We’ve also seen the rise of the <em>full-stack developer</em> role in recent years. This is the industry’s collective attempt to deal with this shift in complexity as cheaply as possible, by forcing these skills to become a commodity. While individuals with genuinely incredible full-stack expertise do exist, they are rare, and not easily accessible to most companies.</p><p>The industry hypothesis that the full-stack developer represents is that <a href="https://hackernoon.com/tagged/software-development">software development</a> expertise is portable from back end to front end without the need for a lot of expensive re-training. The same set of principles apply. This is true to some extent, but does not magically apply to knowledge of the web as a medium and platform. The transferability of skills is partial at best.</p><p>Here is one of the many jokes about full-stack developers:</p><h3>Brian Holt on Twitter</h3><p>Fullstack&quot; developer.</p><p>These jokes are a little unfair on individuals, who are just trying to create a rewarding career for themselves. (There’s also a lot of bad and inconsistent advice out there on how to do this, by the way.)</p><p>For me, the full-stack developer mythos distracts from the need to think about the <em>team</em> as the unit of expertise.</p><p>In reality, everyone has qualitatively different capabilities and potential. Reducing capability to <em>front end</em> vs <em>back end</em> is over-simplistic, as is lumping a very broad set of skills into the <em>full-stack developer</em> role. It’s symptomatic of treating individuals as commoditised resources.</p><p>Shifting an existing product team’s capabilities more toward the front end to match the shift in system complexity requires a considered combination of training, coaching and recruitment. In other words: investment.</p><p>Unfortunately, this investment rarely happens intentionally, by the organisation that needs it, at the team level. Instead, teams are typically expected to learn on the hoof, sometimes at their own expense and in their own time.</p><p>Even worse, front end work is often given as an isolated piece of work to an inexperienced developer or intern to figure out by themselves without much in the way of mentoring or training. Learning on the job, in the W. Edward Deming sense, is fine. But leaving someone inexperienced to do it without guidance doesn’t count.</p><p>Underlying much of this is the persistent belief that front end development is relatively easy. As an opinion, it is stated overtly less often now, but its impact can still be seen in the way that teams behave and are managed.</p><h4>Mistake 4: Use naïve dev practices</h4><p>Under-investing in front end skills has knock-on effects.</p><p>The relative ease with which we can create working software with JavaScript frameworks is alluring. But naïve development practices can threaten the long-term maintainability and quality of products.</p><p>Poor development practices reinforce each other:</p><ul><li>Poor or no test coverage, results in…</li><li>Highly-coupled code, that encourages…</li><li>Over-engineered solutions, that leads to…</li><li>Big monolithic balls of mud, that forces us to deliver…</li><li>Giant monolithic asset bundles</li></ul><p>All of this makes it unlikely that we’ll deliver on those assumed user benefits we talked about earlier.</p><p><a href="https://www.youtube.com/watch?v=4bZvq3nodf4">Performance in particular is a big problem with JavaScript-heavy apps</a>, and particularly on mobile devices. While framework maintainers are working hard to improve the situation, we still have our existing apps to deal with.</p><p>If you want to improve the situation, you first need a code base that is amenable to improvement. For example, <a href="https://medium.com/@addyosmani/the-cost-of-javascript-in-2018-7d8950fbb5d4">Addy Osmani’s excellent advice in his post about modern JavaScript application performance</a> is hard to implement for existing apps if you don’t have well-structured foundations.</p><p>Skills in the gradual rescuing, rejuvenation, profiling and speeding up of existing JavaScript applications are hard to learn. So they are hard to come by in the employment market. Which leads us to the alternative approach…</p><h4>Mistake 5: Surf the waves of framework hype</h4><p>Once we find ourselves with a poorly-executed single-page app (using our simple four-step plan!), we naturally want to do something about it. This is a very dangerous situation. It’s here where we can do serious compounding damage to the business.</p><p>It’s all too easy to blame a failing app on the technology and tools that were used to create it. In this case, the most common target for our rancour is the JavaScript application tooling we chose. After all, all that shiny marketing and positivity at the outset promised us a Google Maps or at least something we’d enjoy working on.</p><p>Our team’s inability to move the product forward at speed; the redesign of that core piece of functionality that took six months instead of six weeks; those two developers that left the company out of frustration; the poor UX and performance. These are easily blamed on the technology we chose a couple of years ago. (Or that <em>someone else</em> chose a couple of years ago.)</p><p>So, we look at the alternatives.</p><p>And the quickly changing attitudes of the wider JavaScript community provide plenty of alternatives to tempt us.</p><p>The regularity with which new JavaScript frameworks, libraries and their associated ecosystems have risen to popularity in the last five years seems to match the cadence at which product teams get frustrated with their technology choices. Is this a coincidence?</p><p>I’m going to make a questionable argument in favour of this using The Gartner Hype Cycle. This infamous chart plots the visibility of a technology over time.</p><p>Could it be that product teams complain about their web app about here…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3m2pXOMa1onGOfJW.jpg" /></figure><p>… just as an alternative tool is rising in popularity?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zTTEmAUvK-_yF4f2.jpg" /></figure><p>In extreme cases we can end up in a situation like the one below, as various attempts to rewrite a whole app or significant parts of it are undertaken, leaving a trail of frameworks and libraries throughout the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OVW_E7g9rN-Wkmng.jpg" /></figure><p>This is another way of illustrating the <a href="https://infrequently.org/2018/09/the-developer-experience-bait-and-switch/">developer experience bait-and-switch</a>, as described robustly by Alex Russell.</p><p>I <em>may</em> have been responsible for allowing something like this to happen in a rapidly growing product myself. I apologise unreservedly to anyone I’ve ever worked with who has had to deal with this. But I wouldn’t be the only one, by a long shot.</p><p>The fickleness in the JavaScript community has died down a little in the last few years. We may actually be seeing some consolidation around component-based approaches as offered by <em>ecosystems</em> (don’t say <em>framework</em>) like React, Angular or VueJS.</p><p>But there is still plenty of churn around other application capabilities like state management, handling of CSS and the use of platform native capabilities. Change is constant, but inconsistent.</p><p>Even if you’re a committed vanilla JS (no framework) advocate, there is still change around the JavaScript language itself, build and developer tooling, dependency management, utility libraries, browser support and the web platform itself to contend with. Not using a framework at all doesn’t sidestep the problem.</p><h3>So, what’s the solution, Mr. Grumpy?</h3><p>This article is far too negative and long enough thank you, so I’ll be looking at approaches to getting some way out of this mire in a future post.</p><p>Few teams will have encountered all five of the problems above. They can surface at different times in a product’s lifecycle.</p><p>As pointed out at the start, the common thread of the problems I’ve identified above is not technology in itself, but people. We focus far too much on technology as the solution to problems that are not based in technology.</p><p>We don’t talk enough about team structure, dynamics, skills and capabilities, about the cost of writing and maintaining multi-platform asynchronous browser-based software, and about healthy and sustainable long-term software development practices.</p><p>That should give you some clues as to how product teams can start to address the situation.</p><p>This article is based on my talk <a href="https://www.youtube.com/watch?v=1SRO-1HBE6E"><em>How to Survive the Single-Page App-ocalypse</em></a>, first presented at <em>The Lead Dev London</em> conference in June 2018. <a href="https://noti.st/froots/ICNNZT/how-to-survive-the-single-page-app-ocalypse">Slides for this talk are available on Noti.st</a>.</p><p><em>Originally published at </em><a href="https://tinnedfruit.com/articles/create-your-own-dysfunctional-single-page-app.html"><em>tinnedfruit.com</em></a><em>.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bfcba9df6df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/create-your-own-dysfunctional-single-page-app-in-five-easy-steps-7bfcba9df6df">Create your own dysfunctional single-page app in five easy steps</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How ethnography can help you understand code]]></title>
            <link>https://medium.com/hackernoon/how-ethnography-can-help-you-understand-code-ed8880d4a521?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed8880d4a521</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Wed, 29 Aug 2018 14:09:43 GMT</pubDate>
            <atom:updated>2019-04-29T10:15:56.473Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RM33qmH812RU_pmQZv8CvA.jpeg" /><figcaption>Photo <a href="https://unsplash.com/photos/UCZF1sXcejo">Štefan Štefančík</a></figcaption></figure><p>Last month, Harry Roberts described how he goes about <a href="https://csswizardry.com/2018/07/getting-to-know-a-legacy-codebase/">getting to know a legacy CSS codebase</a>. It’s a really useful post full of great technical advice and tool suggestions for tackling CSS code archaeology.</p><p>But one thing about Harry’s post stuck out. For me, <strong>he underplays the importance of talking to people about how the codebase got into its current state</strong>.</p><p>Harry’s post describes an individual journey of discovery, by poking around in the code using analysis tools and techniques. Only towards the end does he mention talking to team members as a valuable source of insight.</p><p>This reflects our instincts as developers to get to grips with code. As a new team member, getting your head down into code is the obvious first thing to do. After all, the code itself is the focus and end point of all our work as software developers, isn’t it?</p><h3>Code archaeology</h3><p>There’s plenty of guidance and tooling for undertaking <em>code archaeology</em> on the web. Most of it focuses on procedural languages and enterprise systems. Harry’s post is useful because there is relatively little out there that focuses on CSS. You’ll come across systematic techniques such as static analysis, reverse engineering and code walk-throughs.</p><p>But for me, by far the most valuable way of gathering information about an existing software product is to <strong>talk to the people that have worked on it</strong>.</p><p>After all, real-life archaeologists usually don’t have the benefit of talking to the people that lived the lives they are trying to find out about. But we usually do.</p><p>Current and previous team members can take you through the history of the work, the key decisions that were made, the background behind apparently odd choices, and the impact that company culture and priorities have had over time. Why dig around in code when you have this rich vein of data to draw on?</p><p>Awareness of the the team’s social dynamics and the history of their decision-making are far more valuable insights than those given up by looking at git history or current file structures.</p><p>This is not code archaeology. It’s <strong>team anthropology</strong>.</p><h3>We’re all instinctive anthropologists</h3><p>It’s possible that we take these team insights for granted because much of it happens naturally. When we join a new team, we are rarely told just to get on with it in isolation. That’s not really an onboarding strategy.</p><p>Instead, the existing team share their war stories with us over lunch, during pair-programming sessions, in sprint planning, in the corridor and at the company social event.</p><p>Like that time that Josh brought down the production system by running an untested SQL query on the production database; or when the Denise, Paolo and Maria had to work long hours because of an unrealistic partnership deal deadline, and so ended up writing some of the worst code in the system. If we were to stumble on that same knot of code with only the context provided by curse-laden commit messages, we wouldn’t get the same insight.</p><p>Because we come across these stories in the natural course of socialising into the team, we can easily miss the impact they have on our understanding of the project, and over-estimate the impact of code inspections.</p><h3>Taking inspiration from ethnography</h3><p>If we embrace the importance of informal team anthropology, why not embrace some more formal research techniques from the discipline?</p><p><em>Ethnography</em> has origins in 18th Century western imperialist expeditionary research, but it has shaken off those connotations and is now a widely used research approach, not least in <a href="https://hackernoon.com/tagged/software-development">software development</a>.</p><p>Ethnographers take part in various research methods, including <em>participant observation</em>, which involves embedded observation, interaction and participation with a group over a long period of time. They gather large amounts of descriptive, qualitative data, which they write up as an account of the group’s culture, itself called an <em>ethnography</em>. Yes, you <em>do</em> ethnography in order to create <em>an</em> ethnography.</p><p>These techniques have been used increasingly in software development in the last twenty years, particularly by global technology companies with a vested interest in understanding how technology can fit within existing cultural and social systems. Some groundbreaking uses of ethnographic research methods for software design were developed by Genevieve Bell and Tony Salvador at Intel in the late 1990s, for example.</p><p>But we can also take inspiration from ethnographic research methods when we join a team. Taking part in team rituals, interviewing team members, observing group behaviours, taking note of stories, shared beliefs, cultural constraints and recording important artifacts. These are some of the things that ethnographers focus on.</p><h3>The ethnographer mindset</h3><p>Approaching team socialisation with an ethnographer’s mindset really helps to make this process more explicit. Kelly Moran <a href="http://www.methodsandtools.com/archive/softwareethnography.php">describes three key factors for ethnographic research in software design</a>:</p><h4>1. Description</h4><p>The aim is to <em>describe</em>, not quantify. We are interested in <em>thick descriptions</em>. For example, a description of someone winking as ‘closing and opening of one eye’ has no cultural content and explains nothing of what happened before and after. We need more information to understand the intent and meaning.</p><h4>2. Context</h4><p>Research must take place in the participants’ environment. In other words, conduct field work, not laboratory work. We should also resist studying artifacts (like codebases) in isolation from their social and cultural context. The importance of this is clear to anyone who has joined a new team. You can be the world’s most knowledgeable programmer, but still be flummoxed by unfamiliar team language and jargon.</p><h4>3. Shared perspective</h4><p>We must recognise that we bring our own biases to observations of another group. An objective appraisal is impossible. For example, if a team collectively disdains test-driven development, a new member who is a big believer in it will struggle to describe the team’s beliefs impartially. Recognising this fact is important. We shouldn’t pretend we are objective, but we should also make an effort to learn more about others’ perspectives and language.</p><h3>Explore the social context first</h3><p>The artifact that is a project’s codebase is just one product of the social and cultural system to which we belong as software developers. By our relentless focus on the technical, we’ve been taught to think of code as being free of social, cultural and political meaning.</p><p>But team-based software development is a social endeavour first. If we fail to treat it as such and act as if joining a team is just a matter of getting our head round a collection of technical artifacts, we’ll quickly run into problems that no amount of code will warn us about.</p><p>Instead, if we can develop a sensitivity to the language, shared beliefs and social systems of the team, we’re far more likely to help that team create positive and meaningful change, both to the code, and the way they work together.</p><p>—</p><p>If you want to find out more about ethnography in design and software, check out these resources:</p><ul><li><a href="http://www.methodsandtools.com/archive/softwareethnography.php">An Ethnographic Approach to Software</a> — Kelly Moran</li><li><a href="https://www.ida.liu.se/~TDDD32/docs/DesignEthnography.pdf">[PDF] Design Ethnography</a> — Tony Salvador, Genevieve Bell and Ken Anderson</li><li><a href="https://www.youtube.com/watch?v=OudPLC-N7fc&amp;index=28">[Video] Engineers, Go Wild!</a></li><li><a href="https://www.youtube.com/watch?v=b0VsRmr0v9E">[Video] Genevieve Bell interview</a></li><li><a href="https://www.youtube.com/watch?v=Guy-COUbDqI">[Video] Learning from your users: Ethnography in Software</a> — Kelly Moran</li></ul><p>There’s also a wonderful niche of research focusing on ethnographies of <a href="https://hackernoon.com/tagged/agile">agile</a> software development teams, for example this PhD thesis: <a href="https://opus.lib.uts.edu.au/bitstream/10453/20388/5/02Whole.pdf">[PDF] Everyday Practices of Agile Software Developers</a></p><p><em>Originally published at </em><a href="https://tinnedfruit.com/articles/how-ethnography-can-help-you-understand-code.html"><em>tinnedfruit.com</em></a><em>.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed8880d4a521" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-ethnography-can-help-you-understand-code-ed8880d4a521">How ethnography can help you understand code</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to prevent big front-end rewrites with lean technology choices]]></title>
            <link>https://medium.com/cto-craft/how-to-prevent-big-front-end-rewrites-with-lean-technology-choices-103841b5f024?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/103841b5f024</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[product-design]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Fri, 08 Sep 2017 16:34:38 GMT</pubDate>
            <atom:updated>2017-10-26T18:15:00.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QcDLy9NvN7Z2EzkZFTF1zA.jpeg" /></figure><p>You have probably read articles on front-end technology choices and big rewrites such as <em>Why SnackWoot switched from Angular to React </em>et al, which might make for interesting reading, but they should come with a health warning that goes beyond ‘your mileage might vary’.</p><p>Articles of this type usually present explicit criteria that were used to make the decision, such as performance or documentation quality. Some also present the rational decision-making process by which the criteria were evaluated and the final choice made. In reality however, technology choices are made in wildly varying circumstances. They are influenced at least as much by implicit personal biases and interpersonal effects that play out over time.</p><p>To make good choices, you need an approach that allows you to focus on the needs and constraints of your own users, product, team and organisation. The goal is not necessarily to make rational, correct decisions, but <strong>appropriate and sustainable ones.</strong></p><h4>Front-end change is a fact of life</h4><p>In the user-facing parts of a modern product, evolution is the norm. Even in a mature product, user-facing changes happen at a much faster rate than in back-end systems. A REST API transforms more slowly than the client applications that are built around it; by comparison, the database schema is glacial. What’s more, rapid development of the web platform creates even more pressure for continuous change. In the past, paradigm shifts like Ajax, Websocket and responsive design fundamentally changed web product design — we’re now seeing the same with offline support, progressive web apps (PWAs) and CSS grid.</p><p>Change is a constant, so resisting it in your development practices is futile and does no-one any favours.</p><p>The ‘big problem’ that usually triggers a front-end rewrite is the difficulty of making changes to the product. This is generally caused by software entropy and mounting tech debt, but the framework can often get a big portion of the blame. And in many cases a shiny new framework is posited as the solution to ‘the big problem’, at least in part. But, this is short-term thinking. How will you prevent the slow creep of software entropy and tech debt with the new framework? Does your choice of technology help prevent it? Or, are you just scratching the itch of the development team?</p><p>You should instead be looking to continuously fix small problems using small solutions.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Feb395a%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2Feb395a%2F%3Fas_embed&amp;image=https%3A%2F%2Fe.enpose.co%2F%3Fkey%3DdRXnS9Gplk%26w%3D700%26h%3D425%26url%3Dhttps%253A%252F%252Fupscri.be%252Feb395a%252F%253Fenpose&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/352624a7010fd0f1a4dbce613c121d77/href">https://medium.com/media/352624a7010fd0f1a4dbce613c121d77/href</a></iframe><h4>A lean approach to front-end systems</h4><p>Since change is a given, you can apply lean principles to front-end technology choices that support continuous improvement instead of trying to fix everything, all at once, with the latest framework. Mary and Tom Poppendieck’s <a href="https://www.amazon.co.uk/Lean-Software-Development-Agile-Toolkit/dp/0321150783"><em>Lean Software Development: An Agile Toolkit</em></a> presents a collection of ‘lean principles and thinking tools’ for software development — I’ve found three to be especially useful for guiding changes in UI design, architecture and tooling.</p><p><strong><em>Lean principle 1: Amplify learning</em></strong></p><p>You’ll know from experience that software development is an exercise in discovery; agile and lean practices embrace this. But, often people behave as if they’re just delivering something that is already well known. In the early stages of a product, <strong>you may know little about your customers,</strong> the problems <strong>you are trying to help them with</strong>, and <strong>how your product will do that</strong>. Yet it is common — even at this early stage — to settle on a set of technologies and stick with them throughout the process, long beyond their usefulness.</p><p>Choosing a framework early based on popularity and sticking with it implies that you know what problems it will help solve, or that you think it will be applicable to most of the problems you’ll face in the future. If however, you’re learning about customers, the product and business domain as you go, a different approach makes more sense: <strong>why not learn about technology in parallel with these efforts?</strong></p><p>Instead of focusing on selection criteria and rational decision-making early on, aim to achieve a shared understanding of the constraints your team is working within and let the solution emerge from multiple experiments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ur3j_zIeNWCCD969iQIKzg.jpeg" /></figure><p><strong><em>Lean principle 2: Decide as late as possible</em></strong></p><p>Product development is a ongoing learning process, so it helps to delay big, hard-to-change decisions as long as possible. You’re more likely to make the right decisions when you’re informed by the specific facts of your product, rather than those based on speculation, past experiences and personal preference.</p><p>During the search for product-market fit, you won’t want to lock yourself into a single approach. Instead, seek disposability and flexibility so that you learn quickly. Look for good-enough, temporary, off-the-shelf solutions. For more mature products, spend time assessing the suitability of different options against the constraints you’re aware of. Product development takes place over months and years; you should be able to justify short parallel development experiments in the name of ‘technology fit’. Crucially, this doesn’t mean you should over-analyse every single choice along the way. Where constraints are well understood, intuitive decisions based on expertise and experience are often better than rational, analytical approaches.</p><p><strong><em>Lean principle 3: Empower the team</em></strong></p><p>If you emphasise expertise over process, then develop and empower your team so they can make informed decisions that affect them. Prescribing a supposedly rational collaborative decision-making process with checklists and weighted criteria has the veneer of autonomy, but limits the impact of your teams’ expertise over time.</p><p>It’s not enough just to tell your team they have autonomy, either. Poppendieck and Poppendieck also emphasise the importance of enabling ‘local signalling’: making learning visible, holding daily meetings, integrating code frequently and testing comprehensively. The best scrum master I ever worked with spent most of his time creating an environment strong in local signalling.</p><p>High team autonomy means you have a chance of responding rapidly to change and building it into your working practices. It’s the foundation for avoiding big rewrites.</p><h4>Don’t just default to the most popular choice</h4><p>Once upon-a-time, front-end choices were limited. A default position existed: just use jQuery and get cracking. Most of the work of complex web applications was in the back-end anyway. Now, however, there is more choice in the JavaScript ecosystem than for any other programming language or platform. With more of the product ending up as browser-based code, making these choices is no longer a trivial matter of little importance.</p><p>You need to give the front-end as much care and attention as your back-end systems, and ensure that your team is doing the same. So, before you agree to ‘just use React’, resist the urge to make the decision prematurely and encourage your team to take a more incremental, learning-based approach.</p><p><strong>*******************************************************************</strong></p><p><a href="http://www.linkedin.com/in/jamesnewbery"><strong>James (Jim) Newbery</strong></a><strong> is the Director and Principal Consultant at </strong><a href="https://tinnedfruit.com/"><strong>Tinned Fruit</strong></a><strong> and writing as a contributor for </strong><a href="http://www.ctocraft.com/"><strong>CTO Craft</strong></a><strong>.</strong></p><p><strong>If you, or your CTO / technology lead would benefit from any of the services offered by the CTO Craft community, visit: </strong><a href="http://www.ctocraft.com/"><strong>www.ctocraft.com</strong></a><strong> or contact us via email at: </strong><a href="/service/mailto:info@ctocraft.com"><strong>info@ctocraft.com</strong></a></p><p><strong>Subscribe </strong><a href="http://tech-manager-weekly.ongoodbits.com/"><strong>here</strong></a><strong> to Tech Manager Weekly for a free weekly dose of tech culture, hiring, development, process and more…</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=103841b5f024" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cto-craft/how-to-prevent-big-front-end-rewrites-with-lean-technology-choices-103841b5f024">How to prevent big front-end rewrites with lean technology choices</a> was originally published in <a href="https://medium.com/cto-craft">CTO Craft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Technical Debt Often Isn’t]]></title>
            <link>https://medium.com/tinned-fruit/technical-debt-often-isnt-7fd575297117?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fd575297117</guid>
            <category><![CDATA[technical-debt]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 16:29:31 GMT</pubDate>
            <atom:updated>2017-07-20T16:29:31.776Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m not convinced technical debt is always what we think it is. Let me try to explain why.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0yJHvhi3zppJzvQ6R88fQ.jpeg" /><figcaption><em>Photo </em><a href="https://unsplash.com/@downtherabbithole"><em>Alice Pasqual</em></a></figcaption></figure><p>It’s becoming increasingly common to develop products in cross-functional teams using lean, experimental approaches.</p><p>A product manager, designers, developers, testers, scrum masters, domain experts and UX researchers take shared responsibility for developing a product. Success is defined by the degree to which they can affect conversion and engagement metrics.</p><p>This cross-functional approach is great for rapid customer feedback, ‘small batch’ iterations, hypothesis-driven experimentation and ultimately can help to make products that customers actually want.</p><h3>Product development is messy</h3><p>In reality, though, products get messy over time. Without diligent housework they will accrue hacks, customer-specific features, vestiges of past experiments and grinding inconsistencies. This in itself is not necessarily bad if users can still do what they need and want to do. But eventually, these things add up and make it increasingly difficult to deliver further improvements.</p><p>We tend to call these problems <em>technical debt</em>, one of the most exercised terms in software development. I won’t write about technical debt here when <a href="https://www.martinfowler.com/bliki/TechnicalDebt.html">Martin Fowler explains it efficiently</a>.</p><p>Taking on technical debt intentionally can be both a useful lever for gaining rapid feedback, but also a potential ball-and-chain by which product teams can limit their ability to move quickly. Again, Martin Fowler <a href="https://www.martinfowler.com/bliki/TechnicalDebtQuadrant.html">presents a nice way to think about the pros and cons of technical debt</a>.</p><h3>It’s not just technical…</h3><p>Because debt is almost always associated with ‘technical’ aspects of the product, the onus is usually on the developers in the team to manage it and pay it off. This results in pleas to take time out from feature development to pay it down, maintenance sprints, rewrites, team turnover, and other unfortunate problems.</p><p>The experimental approach can also take a heavy toll on the front-end of your product. ‘Can’t we just hack it in to the front-end for now?’ is a phrase you might have heard before…</p><p>More recently, there has been some recognition that debt is not exclusive to code and systems. The concepts of <a href="http://andrewchen.co/product-design-debt-versus-technical-debt/"><em>product debt</em></a> and <a href="https://blog.polkadotlabs.com/user-experience-debt-c9bd265d521b"><em>UX debt</em></a> have been used to describe the experiments, custom functionality, and dusty bits of a product that go unloved and untouched, on the assumption that they cost nothing to keep around.</p><p>This is emphatically not true. It’s called ‘debt’ for a reason. Leaving it alone incurs interest costs that can only be reduced by paying down the debt. It’s just that it’s hard to measure the intangible costs incurred by slightly fluffier product concerns (not that measuring technical debt is easy).</p><h3>Product debt becomes enshrined</h3><p>Product teams often choose to forego an elegant approach to a feature because it’s too expensive or would take too long. Instead, a quicker but hacky approach is taken to get some quick feedback and deliver value sooner. The intention being to iterate towards a better approach. That’s fine, and completely embraces the lean approach.</p><p>But then the team moves on to focus on other things. Members of the team leave; new team members arrive. It doesn’t take long for the team to collectively forget that that quick UX hack wasn’t the favoured long-term approach. It becomes enshrined as a successful part of the product.</p><p>It is usually more obvious when technical debt starts becoming a bigger problem. System performance suffers, code is harder to change, big parts of the business logic only exist in UI code.</p><p>What’s needed is a clear documented history of intentionally incurred debt. There should be no shame in being honest about these decisions, but if they aren’t documented and shared, people make all sorts of assumptions about why things are as they are.</p><h3>Debt comes as a package</h3><p>Tech debt, product debt and UX debt are all linked. When a product team adds an experimental feature, they are potentially incurring:</p><ul><li>product debt — e.g. by distracting users from other features or approaches that might be more useful to them</li><li>UX debt — e.g. confusing users by interrupting them</li><li>UI design debt — e.g. by creating special-case design patterns</li><li>tech debt — e.g. by hacking business logic into the UI layer</li></ul><p>As long as the whole team is aware of the tactical nature of the work, taking on debt can work well. But the team should also consider what actions will be necessary once the experiment is done — whether it’s deleting all aspects of a failed experiment, to embodying a successful experiment in data structures and platform services.</p><p>I consider technical debt, product debt and UX debt to be much the same thing.</p><p>They are facets of the same organisational behaviour. They are all forms of organisational debt. Just as <a href="https://en.wikipedia.org/wiki/Conway%27s_law">Conway’s Law</a> holds that your systems will reflect your organisational structure, so does a product’s incurred debt over time reveal much about company and team culture and attitudes.</p><h3>It’s a people problem</h3><p>I have worked at companies that are so focused on market share and user numbers as a key metric that working on paying off bad technical debt was seen as counter-productive to this effort.</p><p>Half the problem was the engineers’ tendency to focus on technical aspects of organisational debt. In reality, the separation of engineering and product functions was the source of the problem, from which high levels of closely associated technical and product debt emanated.</p><p>Bad debt is often incurred along the seams where regular communication should be happening, but isn’t. This is why the UI layer can often be rife with debt, as it’s a boundary between product, design and engineering practices.</p><p>When talking about ‘technical debt’, consider its origins and associations with other forms of debt, and encourage your cross-functional team to consider technical, product, design and even organisational change along with code changes.</p><p>This makes managing debt a shared concern and responsibility, and not just a by-product of writing code under uncertain circumstances.</p><p><em>Originally published at </em><a href="https://tinnedfruit.com/articles/technical-debt-often-isnt.html"><em>tinnedfruit.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fd575297117" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tinned-fruit/technical-debt-often-isnt-7fd575297117">Technical Debt Often Isn’t</a> was originally published in <a href="https://medium.com/tinned-fruit">Tinned Fruit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shoot Down Front-End Fatigue With Tracer Bullets]]></title>
            <link>https://medium.com/tinned-fruit/shoot-down-front-end-fatigue-with-tracer-bullets-657394846278?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/657394846278</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 16:22:22 GMT</pubDate>
            <atom:updated>2017-07-20T16:22:22.318Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sN2rM5Mji019Po9aJZzR9g.jpeg" /><figcaption><em>Photo </em><a href="https://unsplash.com/@jmust13"><em>Jimmy Musto</em></a></figcaption></figure><p>The experience of overwhelming choice and complexity that we refer to as <em>front-end fatigue</em> is not unique to front-enders or even developers generally. It’s just that barriers to entry for creating front-end tools, approaches and libraries are so low.</p><p>A lot of choice could be good for the field as a whole, but individually we can experience choice paralysis and stress when deciding what to focus our learning on, or when choosing an approach for the projects we work on.</p><p>American psychologist Barry Schwartz refers to this as the <a href="https://www.amazon.com/Paradox-Choice-Why-More-Less/dp/0060005696"><em>Paradox of Choice</em></a>. Essentially, unbounded choice is often paraded as an objectively good thing, but the experimental evidence suggests that too much choice can impact decision making behaviour. Think of those giant menus at your local restaurant, or the store with 50 kinds of jean. <a href="https://www.ted.com/talks/barry_schwartz_on_the_paradox_of_choice">Barry talks about his preference for crappy ill-fitting jeans</a> in this TED talk. He is not a sartorial man.</p><p>Choosing a technology or framework to learn or to use for a project is particularly daunting, because the choice can have long-term implications. So we also experience the opportunity cost of <em>not</em> using the alternatives. As soon as any little thing goes wrong with our framework of choice, we start questioning are decision, and can become susceptible to alternative arguments. This is why <em>[Previously Uncontroversial Technology] Considered Harmful</em> posts drive so much traffic.</p><p>All-in-all, this leaves us in a constant state of dissatisfaction with our own set of knowledge and the choices we’ve made on projects.</p><h3>Collective Contextual Learning</h3><p>It bothers me a little that <a href="https://www.smashingmagazine.com/2016/11/not-an-imposter-fighting-front-end-fatigue/">advice</a> for <a href="https://medium.freecodecamp.com/a-study-plan-to-cure-javascript-fatigue-8ad3a54f2eb1#.one6kd167">dealing with front-end fatigue</a> focuses on individual actions. Although the authors are being helpful, some of the advice is dogmatic and too general. Individual study plans and attitude adjustments are fine, but they have to take account of individual needs.</p><p>We can also benefit from a collective approach with some goal-driven learning, accountability and support. That’s what I’m going to bang on about here.</p><p>If you work in a project team, constant learning should be built in to the fabric of what you do. I’ve learned something from every project I ever worked on, whether I was aware of it at the time or not. It makes sense to embrace it as part of the work.</p><p>You’ll see this at the core of lean approaches. <em>Lean UX</em>, <em>lean customer development</em>, <em>lean agile</em>. All of these things emphasise collective learning driven by experimentation as the engine for product development.</p><p>Anchoring learning to the specific goals of a project provides it with direction and meaning. That’s a big contrast to the generic marketing approach taken by library maintainers, developer evangelists and so on. They can only present generic capabilities. It’s up to you to learn whether these capabilities will address your project needs.</p><p>Instead of asking ‘Do we all need to learn React and Redux because that’s where the industry is headed?’ we should ask ‘What benefits will using React and Redux for this project give us?’</p><p>And if you work individually on projects, you need to be wary of using projects as a guinea pig for your general learning goals. This is why we have text-heavy blogs written in Angular with over-engineered client-side routing.</p><h3>Exposing assumptions and hypotheses</h3><p>Imagine you work in a team of 6 people, and you’ve been tasked to create a new web-based custom CRM tool to be used by MegaSalesCorp’s field sales staff. It’s natural for developers on the team to start mentally exploring technology choices and architecture almost immediately. Even before the audience and scope of the project have been defined. We can too easily jump to solutions based on general assumptions and accepted dogma.</p><p>What follows might be a loose game of negotiation to get to some consensus. Or someone in a leadership role might just unilaterally impose a direction for the team to follow. Neither approach is great.</p><p>Instead, I suggest starting the project by gathering your team’s assumptions about technology choices, approach and architecture, and make them explicit. Turn them into specific hypotheses of the form:</p><blockquote>“We believe that adopting Redux will provide a predictable and robust way to manage data flow through the MegaSales RealTimeCRM dashboard”</blockquote><p>You might have a whole bunch of these. Start with a small number of the most important ones. What are the really gnarly, controversial problems?</p><h3>Testing hypotheses</h3><p>The next question is: How do you properly test these hypotheses?</p><p>You could:</p><ul><li><em>Create a prototype</em>: Prototypes are really for testing user interfaces with real users. They get thrown away once you’ve learned what you needed to. This is about testing development approach and technology choice.</li><li><em>Spike a solution</em>: A ‘spike’ is where you rapidly develop a scrappy solution using candidate technology. It can help at very early stages, but because you haven’t written production-quality code or tests or got your code into production, your’e not really testing what it’s like to live with the choice in the long term</li><li><em>Create a proof of concept</em>: This sounds like a weird combination of a prototype and a spike. I don’t really know what people mean when they say this.</li><li><em>Do some research</em>: This will help, but you’re in danger of analysis paralysis.</li></ul><p>So, how can we test or hypothesis under realistic conditions? Enter the <em>tracer bullet</em>.</p><h3>Tracer Bullet Development</h3><p>Andy Hunt and Dave Thomas first wrote about tracer bullets in <a href="https://www.amazon.com/Pragmatic-Programmer-Andrew-Hunt/dp/020161622X"><em>The Pragmatic Programmer</em></a> back in 1999. I think it’s an approach that a lot of front-end developers could benefit from.</p><p>The idea is to pick a tiny user-facing feature and get it running in a production environment. Along the way, you do all the things that you would do to get something into production. You write tests, write production-quality code, set up automated continuous integration and continuous delivery pipelines, commission production hardware, set up monitoring and solve all the tiny annoyances that crop up randomly when shoving code onto production servers.</p><p>Instead of missing a deadline because you waited too long, you front-load the hard-to-estimate job of shipping to the start of the project.</p><p>(Note that the idea is not about getting stuff in front of users, though you can do that too. ‘Shipping’ here just means getting software on final production systems).</p><p>You might be integrating with systems that don’t exist yet. Don’t wait. Those can be stubbed out with canned responses using an agreed-upon contract at the joins.</p><p>By front-loading all of this work, your team will probably learn an enormous amount about what the system will be like running in production.</p><p>If you ship later, you’re only learning what it’s like to work with a development environment. And this is the big point: modern front-end engineering has embraced the build step. It used to be that the code you ran during development was the same code that ran in users’ browsers. That’s not the case any longer.</p><p>What’s more, browsers present “the most hostile software engineering environment imaginable”. Getting production code to browsers early gives you more time to address performance issues, cross-browser bugs and other fun stuff that front-end engineers <em>really</em> enjoy.</p><h3>A tracer bullet example</h3><p>I first came across tracer bullet development when working on Sky TV’s web-based programme guide. We were considering using Backbone.js, which has only recently been released. We decided to test out whether Backbone would help us write an app that could lazy-load a lot of scheduling data from a yet-to-be released API as the user scrolled both vertically down a channel list, and horizontally across a full day schedule.</p><p>To do this, we performed two tracer bullet experiments. The first just involved requesting a canned list of channels to the page, and the second involved scrolling across a full day’s worth of programme data, to test assumptions about rendering, scrolling and lazy loading performance challenges. We had identified these as being key to the success of the app.</p><p>Along the way, we also worked on small spikes, usually before a tracer bullet. These are quick-and-dirty hands-on research exercises to poke at a possible solution. They differ from tracer bullets because they are designed to be thrown away. No production code and no tests.</p><p>In this example, our initial choices worked out well enough. But there were changes of tack along the way. jQuery plugins had to be dropped for performance reasons. We refactored the whole Backbone view component tree because of design changes. Those are still not easy, but if you have a full pipeline to production in place, it makes these challenges less likely to put your whole project at risk.</p><p>By committing to shipping early, you’re not necessarily committing to a specific approach early. Instead, you should focus on <a href="http://programmingisterrible.com/post/139222674273/write-code-that-is-easy-to-delete-not-easy-to">optimising for deleting code</a>. You’re aim is to learn as much about your solution in a realistic setting.</p><h3>Experiments</h3><p>So, you should be able to see how you can use tracer bullets like these to test the specific hypotheses you’ve gathered right at the beginning of the project. You might even write a feature with two or three different frameworks or libraries to allow your team to make an informed decision about how to proceed for the rest of the project.</p><p>It’s important that these experiments are written using production-quality code and released to a production environment. A quick-and-dirty proof of concept or spike tells you little about the qualities of software running in the wild, or what it will be like to maintain over a long period of time.</p><p>You might find that that lauded framework just doesn’t cut it for your use case. It’s better to find that out at the start of project when correcting it is cheaper.</p><h3>Applied learning</h3><p>There are other big benefits to tracer bullet development.</p><p>By setting a clear path to production early on, and making explicit choices, you are providing a framework and set of constraints for how development work is done. This is important. Junior developers in particular may need more explicit guidance on how to contribute. It’s why some people love opinionated frameworks like Rails and Ember.</p><p>You’re also embracing and embodying learning in the development process. You’re collectively admitting to not knowing what you’re doing until you try it. And even then, decisions can be reversed later if new discoveries come to light. You’ve accidentally set up a shared learning environment.</p><p>In that Sky project, none of us had used Backbone before, so there was a good spirit of working it out as we went along. It was also on this project that I really focused on improving my JavaScript unit testing skills. It was on-the-job learning, but it wasn’t just tolerated with separate study time, <em>it was how the team worked</em>.</p><p>Of course, I’m embarrassed to look at the code now, and I wonder what it would have been like to write it in React, or Elm, or with ES6, or with RxJS.</p><p>But I’m not embarrassed about the approach we took and how much we learned in the course of that project.</p><p>And we shipped on time too.</p><p><em>Originally published at </em><a href="https://tinnedfruit.com/articles/shoot-down-front-end-fatigue-with-tracer-bullets.html"><em>tinnedfruit.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=657394846278" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tinned-fruit/shoot-down-front-end-fatigue-with-tracer-bullets-657394846278">Shoot Down Front-End Fatigue With Tracer Bullets</a> was originally published in <a href="https://medium.com/tinned-fruit">Tinned Fruit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[31 Ways to Spend Less Time on Manual Cross–Browser Testing]]></title>
            <link>https://medium.com/tinned-fruit/31-ways-to-spend-less-time-on-manual-cross-browser-testing-5904b6e5306f?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5904b6e5306f</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 16:11:38 GMT</pubDate>
            <atom:updated>2017-07-20T16:11:38.322Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9V9z9ioZi816OXQXTLubVw.jpeg" /></figure><p>Manual cross–browser testing can be a <strong>big drag on time and energy</strong>. It’s tedious to check every page of your site or app across breakpoints, and on a growing list of desktop browsers and mobile devices.</p><p>How often do issues show up in your live site that the testing process should have spotted?</p><p>It’s easy to see why many teams and individuals don’t do as much testing as they feel they should. Manual testing is often done in an <strong>informal, unplanned and scattergun</strong> fashion. It depends on team members to motivate themselves to do it, and on the availability of the right browsers and devices.</p><p>And when bugs do get missed, everybody feels bad. Or worse, <strong>a blame game ensues</strong>. You might say to yourself that you need to do <em>more</em> testing, if only you could work out how with the time you have available.</p><p>Like all good humans, though, we would prefer to spend <em>less</em> time on repetitive tasks. They key is to make testing more efficient.</p><p>Below is a list of some ways that you can <strong>improve your cross–browser testing</strong> to make it more efficient. Whether you are part of a big team responsible for a portfolio of large sites, or an individual working on a pet project, I hope you find something you can use.</p><h3>Make testing less important</h3><p>A great way to do less manual testing is to make it less important. The complexity of your project can determine the complexity of testing it. So, <strong>a simple approach can pay dividends</strong> in the long run.</p><p>These tips can be difficult to introduce for established projects, so if you’re starting on something new, get them in early.</p><h4>1. Use established techniques</h4><p>On a new project, you might be tempted to use a slew of emerging browser capabilities. You will often need to use <a href="http://www.html5rocks.com/en/tutorials/detection/">feature detection </a>so that visitors with older browsers <a href="https://modernizr.com/">get a usable fallback</a>. This means that you need to test the same feature across browsers with different expectations of what is correct.</p><p>It can be easy to get <strong>carried away using the latest tech</strong>, but a significant part of your <a href="http://gs.statcounter.com/">audience</a> may be using older, less capable browsers. Sometimes it is better to use a well-established approach for everybody.</p><p>By using newer browser features with inconsistent support, you are deliberately introducing cross–browser variation. We know from the Browser Wars of the 1990s that this comes at a cost.</p><p>Pick the technologies you use with care. Restrict your choice of newer features to those that will have the <strong>biggest net benefit to the user</strong>.</p><p>Links:</p><p><a href="http://www.html5rocks.com/en/tutorials/detection/">Feature, Browser, and Form Factor Detection: It’s Good for the Environment</a> — HTML5 Rocks</p><ul><li><a href="https://modernizr.com/">Modernizr</a> — Feature detection library</li><li><a href="http://gs.statcounter.com/">StatCounter GlobalStats</a> — Browser usage share data, with geographic filters</li></ul><h4>2. Use a framework (maybe)</h4><p>There is plenty of debate about the benefits or drawbacks of using a CSS framework like <a href="http://getbootstrap.com/">Bootstrap</a> or <a href="http://foundation.zurb.com/">Foundation</a>. But using a framework as a basis for layout can reduce the amount of cross–browser testing you need to do.</p><p>Any framework worth its salt should be well tested on a wide range of browsers and devices. You should <strong>always be aware of framework’s browser support</strong> and testing policies. Make sure that it corresponds with your own.</p><p>The key here is to consider the <a href="https://hacks.mozilla.org/2016/04/you-might-not-need-a-css-framework/">long term impact</a> on your project of adopting a framework.</p><p>Links:</p><ul><li><a href="http://getbootstrap.com/">Bootstrap</a> — CSS framework</li><li><a href="http://foundation.zurb.com/">Foundation</a> — CSS framework</li><li><a href="https://hacks.mozilla.org/2016/04/you-might-not-need-a-css-framework/">You might not need a CSS framework</a> — Belén Albeza</li></ul><h4>3. Use fewer breakpoints</h4><p>Fewer responsive breakpoints in your code result in <strong>fewer layout variations</strong>. It’s common sense that this should mean less testing.</p><p>Likewise, sticking to horizontal media queries and avoiding vertical ones means you only need to test variations in screen width.</p><p>In practice, <strong>bugs can appear at any viewport size</strong>. You will always need some level of exploratory testing, particularly for fluid responsive designs. Be sure to test your design with <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#use-consistent-sample-content">content outliers</a>.</p><p>Links:</p><ul><li><a href="http://bradfrost.com/blog/post/7-habits-of-highly-effective-media-queries/">7 Habits of Highly Effective Media Queries</a> — Brad Frost</li></ul><h4>4. Keep the design simple</h4><p>A focus on <strong>good content</strong> presentation and conservative use of ‘clever’ design tricks will make testing easier. But less testing is not the only benefit.</p><p>I hope that we have collectively recovered from the gratuitous use of <strong>parallax scrolling</strong> as a design crutch. Even if we have, there will always some other shiny temptation that emphasises form over function.</p><p>The recent surge of interest in design systems highlights the advantages of a consistent and simple approach. Content providers must be able to communicate their message, and users are able to do what they need to do.</p><p>Links:</p><ul><li><a href="http://alistapart.com/column/do-as-little-as-possible">Do as Little as Possible</a> — Lyza Danger Gardner</li></ul><h4>5. Limit complex interactions</h4><p>As using clever decorative features adds testing complexity, so do complex user interactions. Simplifying your user interactions will benefit users through <strong>improved usability</strong>. But doing so can also simplify functional testing. Early usability testing has a knack of benefitting a project in unexpected ways.</p><p>Some user interactions are harder to test than others. For example, drag and drop interactions can be tricky to get right, and need thorough exploratory testing to identify issues.</p><p>A simple form might not be as nifty, but it will be simpler to test. I’m not saying that you should not use these techniques, but that you should be aware of the cost of doing so.</p><p>Another challenge for testing is the <strong>asynchronous interactions</strong> between the user, browser and server common in modern web applications. It is all too easy to create <a href="https://davidwalsh.name/write-javascript-promises">race conditions</a> when many Ajax requests are in flight, any of which could fail or be slow to complete.</p><p>Test that your application can handle individual <strong>request failures</strong> and does not depend on the order that they return. Even better, use an <a href="http://caolan.github.io/async/">established library</a> to coordinate your asynchronous requests in your application to reduce the need for testing.</p><p>Links:</p><ul><li><a href="https://davidwalsh.name/write-javascript-promises">Write Better JavaScript with Promises</a> — Landon Schropp</li><li><a href="https://medium.com/coding-design/writing-better-ajax-8ee4a7fb95f">Writing Better Ajax</a> — Terry Mun</li><li><a href="http://caolan.github.io/async/">Async</a> — Asynchronous JavaScript utility library</li></ul><h3>Limit the scope of tests</h3><p>If you have a big site with hundreds or thousands of pages, you won’t be able to test each page by hand. Nor would you want to. We need some way to reduce the scope of testing to <strong>examples of each template or component</strong>.</p><p>The goal of these tips is to do as little testing as possible but with the <strong>best coverage possible</strong>. There are more deliberate and structured ways to focus testing efforts than picking a selection of typical pages.</p><h4>6. Re-use and reduce components</h4><p>You may be responsible for a site that has a huge range of components and variations. It is common for a site that has grown over time to grow a lot of similar-but-different components, each with their own implementation.</p><p>Modifying sites like these can be painful, and changes can have unexpected knock-on effects. This only increases the demands on testing time, making it less likely that you will make changes.</p><p>It can be <strong>cathartic and rewarding</strong> to <a href="http://bradfrost.com/blog/post/interface-inventory/">audit your site</a> and <a href="http://alistapart.com/article/css-audits-taking-stock-of-your-code">consolidate the components and styles</a> that it uses. You can then use a <a href="http://styleguides.io/tools.html">tool</a> to generate a shared repository of these elements.</p><p>If you know what you have, then you can spend some time to <strong>reduce duplication</strong> so that there is less to test.</p><p>Links:</p><ul><li><a href="http://bradfrost.com/blog/post/interface-inventory/">Interface Inventory</a> — Brad Frost</li><li><a href="http://alistapart.com/article/css-audits-taking-stock-of-your-code">CSS Audits: Taking Stock of Your Code</a> — Susan Robertson</li><li><a href="http://styleguides.io/tools.html">Styleguides.io: Tools</a> — Things to help you make your own style guide</li></ul><h4>7. Use a test harness</h4><p>Once you have a <strong>central repository of elements and components</strong>, you can use it as your focus for testing. This is essential for large sites, but can be beneficial even for smaller sites.</p><p>This works best if:</p><ol><li>The test harness and live site use the <strong>same template sources</strong>.</li><li>The components can be displayed in a <strong>relevant context</strong>. For example, if you design a component to be flexible, can you test it at different widths?</li><li>Component variations can be <strong>created and tested easily</strong></li><li>Everyone on your team <strong>shares and re-uses</strong> the same component examples for testing each time</li></ol><h4>8. Test your style guide</h4><p>Our ‘central repository of elements and components’ is better described as a <strong>style guide</strong>. Or you might have heard of its fancier cousin, the <strong>design system</strong>. Style guides and design systems serve many purposes. They can act as design guidance. They can document consistent and common design patterns and principles. And they can act as implementation guides.</p><p>If you manage a style guide or want to as part of your next project, make sure that you think about how you will <a href="https://tinnedfruit.com/articles/test-your-design-system-not-your-website.html">use it as a test harness</a> from the start.</p><p>For existing style guides, consider how you can <strong>improve support of cross-browser testing</strong>.</p><p>If your style guide allows component variations and content manipulation, it can be a powerful tool for testing.</p><p>Links:</p><ul><li><a href="https://tinnedfruit.com/articles/test-your-design-system-not-your-website.html">Test Your Design System Not Your Website</a></li></ul><h4>9. Use consistent sample content</h4><p><strong>Content variation</strong> is a big source of unexpected cross–browser bugs. I have often come across bugs that are due to an extra-long name or paragraph of CMS or user-generated content.</p><p>When testing components, it’s important to test both <strong>typical content</strong> and <strong>extreme content</strong> values. If your app dictates a username can be up to 255 characters long, how does your app display that? Likewise, what happens when values are missing?</p><p>It’s important that you test the <strong>same content values over time</strong>, particularly if you want to automate your tests. For manual tests, use a <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#create-test-scripts">test script</a> to specify values to use.</p><p>Having a system that will create test components with content filled for you, based on a <strong>shared data source</strong>, is ideal. That way you can replicate test content without effort.</p><p>Links:</p><ul><li><a href="https://github.com/marak/Faker.js/">faker.js</a> — JavaScript library to fake data</li></ul><h3>Make testing targeted</h3><p>Aimlessly testing the few browsers and devices that you have to hand is a sure-fire way to <strong>miss bugs</strong> and <strong>drive yourself potty</strong> with tedium.</p><p>The devices you test on should <strong>reflect what your audience use</strong>. But most websites are accessed by hundreds or even thousands of unique device and browser combinations. You can’t test them all, so how do you target devices that will be most representative?</p><h4>10. Create a browser support policy</h4><p>There’s little point testing with browsers and devices that your users don’t use.</p><p>Being aware of the devices and browsers your audience use is also <strong>key to the design and development process</strong>. When you add features that use a new browser technology, what <a href="http://caniuse.com/">proportion of your user base</a> will be able to experience that feature?</p><p>A <em>browser support policy</em> should drive decisions like these, and <strong>determine priorities for testing</strong>. It provides an agreed means by which a team makes decisions about product features, customer support issues and ongoing maintenance.</p><p>So, how do you choose your support policy? For existing projects, examine your <strong>analytics package</strong> for browser, OS and device usage metrics.</p><p>For new projects, you can use public resources like <a href="http://gs.statcounter.com/">GlobalStats</a> to find current metrics for a <strong>targeted geographical audience</strong> as a starting point.</p><p>This is a big and complicated topic because <strong>the browser and device landscape got big and complicated</strong>. But it’s worth spending some time on getting it right.</p><p>Links:</p><ul><li><a href="https://www.gov.uk/service-manual/technology/designing-for-different-browsers-and-devices">Designing for different browsers and devices</a> — Gov.uk service manual</li><li><a href="http://gs.statcounter.com/">StatCounter GlobalStats</a> — Browser usage share data, with geographic filters</li><li><a href="http://caniuse.com/">Can I use?</a> — Browser support tables</li></ul><h4>11. Create a testing policy</h4><p>Once you know your browser support policy, you can use that to determine your device testing policy. Deciding in advance <strong>exactly what you are going to test on</strong> an ongoing basis is a great way to be more efficient.</p><p>A testing policy should provide this for you by describing:</p><ol><li>Which <strong>specific browsers and devices</strong> you will be testing on. This should name physical test devices and specific browsers, not just vague descriptions like ‘Android 4 device’.</li><li>The <strong>priority group</strong> of each device. This determines how often and how thorough your testing will be. The priority should depend on usage metrics.</li><li>The broad <strong>testing approach</strong> for each priority group. For example, what kind of changes demand a retest for that group, and the test activities that will take place.</li></ol><p>A good cross–browser testing policy takes advantage of the law of <strong>diminishing returns</strong>. You want to start with activities that will <strong>expose the most bugs</strong> so that you get the most out of your work.</p><ul><li><a href="https://www.smashingmagazine.com/2014/07/testing-and-responsive-web-design/">Prioritizing Devices: Testing and Responsive Web Design</a></li></ul><h4>12. Focus on difficult browsers</h4><p>If we dread testing our work on <strong>older versions of Internet Explorer</strong>, why is that we tend to leave it until later on in a project?</p><p>It should be obvious, but older browsers are likely to produce more bugs to fix than newer ones.</p><p>So to <strong>front-load our bug discovery</strong>, it makes sense to test the difficult and older browsers on our support list first.</p><p>I say this with confidence, but it’s amazing how hard this one is to adopt.</p><h4>13. Don’t repeat yourself</h4><p>Browser testing has changed a lot. Browsers like Chrome, Firefox and Microsoft Edge <strong>update themselves</strong> automatically. It’s not necessary to support more than the one or two latest versions of these browsers.</p><p>Unfortunately, this does not apply to other browsers. Internet Explorer, the Android built-in browser, and Safari either <strong>do not auto-update</strong> or are tied to specific operating system versions. These are still popular browsers, and so most projects will need to support them.</p><p>There’s no need to test the same browser version across different operating systems. Generally speaking, the differences are trivial. For most projects, it is not necessary to test the same browser in more than one OS.</p><p>The key here is to <strong>get value out of all your testing time</strong> and not waste it on repeating tasks that will not surface new bugs.</p><h4>14. Adopt a targeted testing plan</h4><p>Once you have browser support and testing policies, you can <strong>perform specific types of testing</strong> on different browsers. The idea is to take advantage of what we know about browsers to identify issues earlier.</p><p>For example, the bugs you are likely to find on an Android 2.3 device will be different to those you would see on the latest version of Chrome.</p><p>Instead of clicking about and resizing your browser window for each browser, <strong>make a list of test activities</strong> for each device group. And then only do those activities.</p><p>Chris Ashton has written some great advice about <a href="https://www.smashingmagazine.com/2016/02/high-impact-minimal-effort-cross-browser-testing/">how you might develop a plan like this</a>.</p><p>Links:</p><ul><li><a href="https://www.smashingmagazine.com/2016/02/high-impact-minimal-effort-cross-browser-testing/">High-Impact, Minimal-Effort Cross-Browser Testing</a> — Chris Ashton</li></ul><h3>Test more efficiently</h3><p>Just as you want to choose the smallest possible set of representative browsers and devices, you also want to focus your actual testing activities.</p><p>There is no point aimlessly clicking, scrolling and resizing with each browser. It’s far better to <strong>decide in advance the test activities</strong> you’re going to pursue. Then make the process of repeating those activities across browsers as painless as possible.</p><h4>15. Create test scripts</h4><p>Professional testers love test scripts because they provide a <strong>repeatable list of activities</strong> for each test run. By repeating the same activities each time, you can increase the chances that you catch <strong>regressions</strong> (bugs that reappear). These are all too common.</p><p>There’s no need to go formal here. At the least, manual test scripts should include clear <strong>steps for performing the test</strong>, and a statement of the <strong>expected outcome</strong>. For cross–browser layout testing, this can include visual references. For functional testing, include clear descriptions of expected behaviour.</p><p>If you have grouped your browsers by priority, you’ll want to have different scripts for each priority group.</p><h4>16. Test many browsers at once</h4><p>As a human, you have at most two hands, and like most other humans, the chances are that you’re only adept at using one of them for fine motor control. You can probably forget about your feet altogether.</p><p>Unfortunately, this means that manual testing is often <strong>performed serially</strong>. Each browser or device is tested one after the other. This is a classic case of inefficiency that we can use computers to help with.</p><p>Certain types of manual testing lend themselves well to <strong>parallel testing</strong>. For example, you can view a component at multiple viewport dimensions on multiple browsers and devices at the same time to check for inconsistency and layout bugs.</p><p>Tools like <a href="https://www.vanamco.com/ghostlab/">Ghostlab</a> allow you to control multiple browsers with one set of human hands by <strong>synchronising interactions</strong> across devices. It’s great for the parallel layout testing use case and is a handy tool for rapid feedback during development.</p><p>As an alternative, you could use <a href="http://browsershots.org/">Browsershots</a> to make <strong>screen grabs</strong> of a page in a variety of browsers. You can then compare statically rendered components in one place.</p><p>Links:</p><ul><li><a href="https://www.vanamco.com/ghostlab/">Ghostlab</a> — App for synchronised development, testing and inspection</li><li><a href="http://browsershots.org/">Browsershots</a> — Free cross-browser screen shot service</li></ul><h4>17. Use hosted browsers and devices</h4><p>Maintaining your own set of browsers and devices to test on can be a big drain on time and money. Even if you do have real mobile devices at hand, you have to keep them charged and ready to use. Don’t underestimate how much work goes into maintaining even a small device lab.</p><p>One alternative is to use <strong>cloud testing services</strong> like <a href="https://www.browserstack.com/">BrowserStack</a>, <a href="https://saucelabs.com/">Sauce Labs</a> or <a href="https://crossbrowsertesting.com/">CrossBrowserTesting</a>. These services provide on-demand access to browser instances, simulators and real devices.</p><p>These services have improved a lot in recent years and are well worth the money if you need to do a lot of testing. They maintain a far wider range of target devices, browsers and operating systems than you’re likely to need.</p><p>These services also provide <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#automate">automated testing</a> support using Selenium. You can test private URLs over a secure tunnel, and generate screen grabs of pages and components as you test.</p><p>Links:</p><ul><li><a href="https://www.browserstack.com/">BrowserStack</a> — Browser testing service</li><li><a href="https://saucelabs.com/">Sauce Labs</a> — Browser testing service</li><li><a href="https://crossbrowsertesting.com/">CrossBrowserTesting</a> — Browser testing service</li></ul><h4>18. Use a device lab</h4><p>Given what I have said above about the cost of maintaining a device lab, you might think I am against them. I’m not. In fact, if you work in a team that has the time and money to maintain a lab, you should do it. The <strong>benefits of testing on real devices</strong> are especially relevant for sites and applications with a larger user base.</p><p>If you don’t have your own device lab, you can always visit a <a href="https://opendevicelab.com/">community lab</a> instead. This can be a much cheaper way of getting <strong>good test coverage</strong> for one-off or smaller projects than building up your own lab.</p><p>But how a device lab result in less time spent testing? Big company labs or community labs are usually well-run. They keep devices charged and <strong>ready for testing</strong>. And they often provide tools for synchronised browsing or semi-automated testing.</p><p>If you follow the advice above about targeted and focused testing, you’ll make the <strong>most of your time</strong> in the lab, and catch bugs before users do. It’s hard to debug a live user issue when you don’t have immediate access to the category of device they are using.</p><p>Links:</p><ul><li><a href="https://opendevicelab.com/">Open Device Lab</a> — Find an open device lab near you</li></ul><h3>Catch problems before you test</h3><p>A lot of bugs are due to <strong>common mistakes</strong> or problems in HTML, CSS or JavaScript code. These mistakes are easy to detect. Instead of waiting for manual testing to find them, or picking over your code by eye, we can use tools to spot them for us.</p><p>If we’re confident that <strong>certain classes of bugs can’t happen</strong> because our tools prevent them, we don’t need to test for them.</p><h4>19. Use code linters</h4><p>Linters are a class of <a href="https://en.wikipedia.org/wiki/Static_program_analysis"><em>static analysis</em></a><em> tool</em> that <strong>identify common problems</strong> with code and <strong>suggest modifications</strong>. Linters are available for HTML, CSS and JavaScript.</p><p>The <a href="https://validator.w3.org/">W3C Markup Validation Service</a> and <a href="http://www.html-tidy.org/">HTML Tidy</a> are examples of HTML linters that have been around for a long time. As an alternative, you could opt for something more recent like <a href="https://www.npmjs.com/package/htmllint">htmllint</a>. It’s not always easy to spot if you’ve got some <strong>invalid markup</strong> that could break your work in some browsers but not others.</p><p>CSS linting is gaining popularity, with tools like <a href="http://csslint.net/">CSS Lint</a> and <a href="http://stylelint.io/">Stylelint</a>. They will both <strong>check your CSS</strong> for common problems with syntax, cross–browser compatibility, performance and accessibility. You can even use them to enforce your own coding style. Both provide the ability to configure your own rule sets.</p><p>For JavaScript, check out <a href="http://jshint.com/about/">JSHint</a> and <a href="http://eslint.org/">ESLint</a> (for ES2015 and beyond). Again, both these tools can spot <strong>potential JavaScript problems</strong> and enforce style rules. Users can configure which rules to include in checks.</p><p>The key with linters is to run them as early as possible so that you can catch potential problems and fix them <strong>before you run other types of test</strong>. You can run them as part of a build job, pre-commit hook, or right in your code editor.</p><p>Links:</p><ul><li><a href="https://en.wikipedia.org/wiki/Static_program_analysis">Static program analysis</a> — Wikipedia</li><li><a href="https://validator.w3.org/">W3C Markup Validation Service</a> — Check HTML by URL or file upload</li><li><a href="http://www.html-tidy.org/">HTML Tidy</a> — Correct and clean up HTML documents</li><li><a href="https://www.npmjs.com/package/htmllint">htmllint</a> — Unofficial HTML5 linter and validator</li><li><a href="http://csslint.net/">CSS Lint</a> — CSS code quality tool</li><li><a href="http://stylelint.io/">stylelint</a> — CSS linter</li><li><a href="http://jshint.com/about/">JSHint</a> — JavaScript code quality tool</li><li><a href="http://eslint.org/">ESLint</a> — Pluggable JavaScript linter</li></ul><h4>20. Use a CSS prefix tool</h4><p>A few years ago, browser vendors started using <strong>vendor-specific prefixes</strong> on CSS rules and DOM API methods. The intention was to isolate technologies that are in progress until the spec and implementation became stable.</p><p>Unfortunately, if you want to <strong>support current and future browsers</strong>, you need to provide both prefixed and unprefixed rules or code. In some cases, you will also need to provide alternative syntax, as candidate specifications have changed over time.</p><p>The most common example of this at the moment is <strong>CSS flexbox</strong>. It gives us lovely new layout powers, but we have to provide prefixes and older syntax. Internet Explorer 10 and 11 used different syntaxes, for example.</p><p>If you are writing vendor prefixes out by hand, it can be easy to miss important rules or to make a mistake. You will only catch the problem by testing in the browser affected.</p><p>For this reason, it is best to <strong>prefix your CSS rules automatically</strong>. You could use popular preprocessor mixin libraries for <a href="http://bourbon.io/">Sass</a> or <a href="http://lesselements.com/">LESS</a>, or maintain your own set of mixins. If you use <a href="http://postcss.org/">PostCSS</a>, <a href="https://github.com/postcss/autoprefixer">Autoprefixer</a> will generate vendor-prefixes based on your own browser support preferences.</p><p>If you don’t use a CSS pre-processor or post-processor at all, you could <strong>let your editor generate vendor prefixes</strong> for you. The HTML and CSS editor tool belt <a href="http://emmet.io/">Emmet</a> provides <a href="http://docs.emmet.io/css-abbreviations/vendor-prefixes/">vendor CSS rule expansion</a> for popular editors.</p><p>Links:</p><ul><li><a href="http://bourbon.io/">Bourbon</a> — A lightweight Sass toolset</li><li><a href="http://lesselements.com/">LESS Elements</a> — A set of mixins for LESS</li><li><a href="http://postcss.org/">PostCSS</a> — A tool for transforming CSS</li><li><a href="https://github.com/postcss/autoprefixer">Autoprefixer</a> — Add vendor prefixes to CSS rules</li><li><a href="http://emmet.io/">Emmet</a> — HTML and CSS editor tool belt</li></ul><h4>21. Profile your CSS</h4><p>Even if you use linting and prefixing tools, it is still possible to write CSS code that causes bugs and is <a href="https://tinnedfruit.com/articles/are-you-writing-legacy-css-code.html">hard to debug and maintain</a>.</p><p>The most common problem with a long-lived CSS code base is <strong>specificity creep</strong>. When developers add new CSS rules they want to avoid making knock-on effects elsewhere in the site. Adding an !important declaration or using selectors with high specificity are the most common ways that this happens.</p><p>To see how much of a problem with specificity you have, you can <strong>profile your CSS</strong>.</p><p><a href="https://github.com/katiefenn/parker/">Parker</a> is a CSS profiling tool that generates lots of useful <strong>statistics about your CSS</strong>. In particular, Parker will tell you what your most specific rule is, so you can hunt it down and refactor it. Check out Harry Roberts <a href="http://csswizardry.com/2016/06/improving-your-css-with-parker/">article on how Parker can be used</a>.</p><p>Another option for specificity is to generate a <a href="http://csswizardry.com/2014/10/the-specificity-graph/">specificity graph</a> for your CSS. The idea here is to organise CSS files so that the least specific rules are at the beginning, and the most specific are towards the end. <strong>Specificity should trend upwards</strong> through the file, and you should avoid big fluctuations. You can generate graphs for your own CSS using an <a href="https://jonassebastianohlsson.com/specificity-graph/">online tool</a> or a <a href="https://github.com/pocketjoso/specificity-graph">command line utility</a>.</p><p>Links:</p><ul><li><a href="https://tinnedfruit.com/articles/are-you-writing-legacy-css-code.html">Are You Writing Legacy CSS Code?</a> — Jim Newbery</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity">Specificity</a> — About CSS specificity on the Mozilla Developer Network</li><li><a href="https://github.com/katiefenn/parker/">Parker</a> — Stylesheet analysis tool</li><li><a href="http://csswizardry.com/2016/06/improving-your-css-with-parker/">Improving Your CSS With Parker</a> — Harry Roberts</li><li><a href="http://csswizardry.com/2014/10/the-specificity-graph/">The Specificity Graph</a> — Harry Roberts</li><li><a href="https://jonassebastianohlsson.com/specificity-graph/">CSS Specificity Graph Generator</a></li><li><a href="https://github.com/pocketjoso/specificity-graph">CSS Specificity Graph NPM script</a></li></ul><h3>Test as you go</h3><p>It may seem better to wait until you have completed development work before moving on to testing. Focusing on one thing at a time is generally a good idea. This approach is also common in teams with dedicated testers.</p><p>But whether you work alone or not, it is more efficient to <strong>identify problems and bugs as early in the process as possible</strong>. It will be cheaper to fix them, and retesting is less arduous.</p><p>Here are some tips to get you testing more as you work, without it disrupting your flow.</p><h4>22. Get into the early testing habit</h4><p>It can be hard to maintain good habits. Testing while you’re in the full flow of design or development work can feel counterproductive. But it can have long-term benefits.</p><p>Many of the other tips in this article are designed to help you include testing more seamlessly into your workflow. For example, using a <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#use-code-linters">linting</a> tool that runs in the background as you work is less intrusive than checking your code by hand.</p><p>You’ll still need to <strong>develop testing habits as you work</strong>, though. After years of experience, I am aware of what browsers are likely to be problematic for the work that I’m doing. So I will try to test in those first, as soon as I have something testable.</p><p>If you’re new to a technique, or if you are working on a challenging implementation, early testing is important for the feedback it provides. You might have to make a <strong>fundamental change of approach</strong> once you try it in a few browsers.</p><p>If you’re not sure about an approach, boil it down to a <strong>simplified test case</strong>, put it on <a href="http://codepen.io/">Codepen</a> or another prototyping tool and test it across some browsers.</p><p>Start with the browsers that are <strong>likely to be problematic</strong>. It’s better to change your approach early with a rough prototype than later when you have spent time polishing your work.</p><p>You’ll only get into these kinds of habits if <strong>browsers and devices are at hand</strong> and ready to use. See the sections on using <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#use-hosted-browsers-and-devices">browser testing services</a> and <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#use-a-device-lab">device labs</a> to get them close to hand.</p><p>Even better, <a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html#automate">automate</a> as much as possible to free up your and your team’s creative thinking time.</p><p>Links:</p><ul><li><a href="http://codepen.io/">Codepen</a> — Playground for the front end web</li></ul><h4>23. Little and often, not everything all at once</h4><p>I used to wait until I had ‘finished’ to test my work in more than one browser. It was always a mistake. In truth, the ‘finished’ bit of work is just a <strong>candidate implementation</strong> that works in one browser.</p><p>In practice, you have to fix a lot of bugs identified from cross–browser testing, and then <strong>re-test the new implementation</strong>. You may even need to change your approach completely.</p><p>In the long run, the Big Test approach <strong>creates more work</strong> than it saves. You may work on a product with a rapid release cycle. Or you may be creating a set of templates for one-off delivery to a client. In both cases, getting cross–browser testing into your process as early as possible will pay dividends over time. It may feel intrusive at the beginning, but the early testing will pay off.</p><h3>Automate!</h3><p>One sure-fire way of doing less testing yourself is to <strong>get a computer to do it instead</strong>.</p><p>As web development matures as a profession, tools have emerged to improve efficiency and cut out repetitive tasks. This phenomenon is consistent across all industries. Because <strong>testing is right up there on the list of tedious and repetitive tasks</strong>, there are now a lot of automated testing tools available.</p><h4>24. Write unit tests</h4><p>Unit testing isolates small pieces of imperative code and tests that a certain <strong>input produces an expected output</strong>.</p><p>In JavaScript, unit test frameworks like <a href="https://mochajs.org/">Mocha</a> and <a href="http://jasmine.github.io/">Jasmine</a> have become popular. There is an enormous array of supporting libraries and tools for unit testing. It’s a big topic, so I won’t cover it here, but there are <a href="http://tddjs.com/">good</a> <a href="https://jstesting.jcoglan.com/">books</a> to get you started.</p><p>If you are writing any non-trivial JavaScript code, unit testing skills will pay you back dividends in <strong>robust and maintainable code</strong>.</p><p>Test-driven development (TDD) is an approach that aims to encourage good code design. Developers <strong>write tests before they write the implementation</strong> that will satisfy those tests. Unit tests are a key part of this approach, and most of the benefit of unit tests is in the way they enforce good code design.</p><p>Unit testing and TDD is common in JavaScript development. For CSS and HTML, the approach is less common, because neither is an imperative programming language. But the idea of testing <strong>small pieces of functionality</strong> in isolation and writing tests before implementation can still be relevant.</p><p>Links:</p><ul><li><a href="https://mochajs.org/">Mocha</a> — JavaScript test framework</li><li><a href="http://jasmine.github.io/">Jasmine</a> — Behaviour-driven development framework</li><li><a href="http://tddjs.com/">Test-Driven JavaScript Development</a> — Book by Christian Johansen</li><li><a href="https://jstesting.jcoglan.com/">JavaScript Testing Recipes</a> — Book by James Coglan</li></ul><h4>25. Test your website as a human would</h4><p><em>End-to-end</em> or <em>functional</em> tests are the test professional’s terms for testing a system from the <strong>user’s point of view</strong>. Instead of repeating the same manual steps for each test session, you can run automated end-to-end tests to perform the same user interactions.</p><p>Techniques and tools for web application end-to-end tests are improving all the time. <a href="http://webdriver.io/">Webdriver.io</a> and <a href="http://nightwatchjs.org/">Nightwatch.js</a> are both JavaScript wrappers around <a href="http://www.seleniumhq.org/projects/webdriver/">Selenium WebDriver</a>, a browser automation and inspection tool that works with most popular browsers. You can run Selenium-based tests on your own PC. Or you can run them on browser testing services like Sauce Labs and BrowserStack.</p><p>End-to-end tests can also serve as a great way to <strong>collaborate with others</strong> in the team and document the intended behaviour of the system. This is very much the goal of behavioural-driven development (BDD). <a href="https://cucumber.io/">Cucumber</a> aims to provide this ability using <strong>human- and machine-readable specifications</strong> that can be run as automated tests.</p><p>Be warned, though. There is some overhead associated with end-to-end tests. It can be frustrating trying to debug <strong>intermittent test failures</strong>. Automated functional tests are best suited to long-running projects with lots of user interactions to test. They can be a great way to ensure that your app is behaving whenever anyone commits code changes.</p><p>Links:</p><ul><li><a href="http://webdriver.io/">WebdriverIO</a> — Selenium bindings for NodeJS</li><li><a href="http://nightwatchjs.org/">Nightwatch.js</a> — Browser automated testing done easy</li><li><a href="http://www.seleniumhq.org/projects/webdriver/">Selenium WebDriver</a> — Browser automation tools</li><li><a href="https://cucumber.io/">Cucumber</a> — Behaviour-Driven Development framework</li></ul><h4>26. Automatically compare screen grabs</h4><p>End-to-end tests focus on validating system behaviour and functionality. But it is also possible to <strong>test for changes in rendered output</strong> using image regression testing.</p><p>Image regression tests work by taking screen grabs of a page or element and comparing them with a known ‘good’ image. An <strong>image diff algorithm</strong> runs and differences between the two images are highlighted. You can set <strong>thresholds for allowable differences</strong> to cover small changes that don’t affect users.</p><p>There is now a big range of image diff testing tools available. The most popular seem to be <a href="http://bbc-news.github.io/wraith/">Wraith</a>, <a href="https://garris.github.io/BackstopJS/">BackstopJS</a> and <a href="https://github.com/Huddle/PhantomCSS">PhantomCSS</a>. There are also paid services that will do the configuration, testing and setup work for you, such as <a href="https://percy.io/">Percy</a>. Check out this <a href="https://visualregressiontesting.com/VRT-Tools.pdf">useful comparison</a> of tools.</p><p>Links:</p><ul><li><a href="http://bbc-news.github.io/wraith/">Wraith</a> — Responsive screenshot comparison tool</li><li><a href="https://garris.github.io/BackstopJS/">BackstopJS</a> — Catch CSS curve balls</li><li><a href="https://github.com/Huddle/PhantomCSS">PhantomCSS</a> — Visual regression testing with PhantomJS</li><li><a href="https://percy.io/">Percy</a> — Continous visual integration for web apps</li><li><a href="https://visualregressiontesting.com/VRT-Tools.pdf">Top Visual Regression Testing Tools</a> (PDF) — Kevin Lamping</li></ul><h4>27. Automate testing against a spec</h4><p>There are also tools that allow you to write <strong>design and layout specs</strong> and run those specs as <strong>automated layout tests across different browsers</strong>. This can be a great way to test whether a website or application layout conforms to a designer’s intent.</p><p><a href="http://galenframework.com/">Galen Framework</a> is the most capable tool that incorporates this approach. It provides the ability to compare the relative positions and dimensions of elements in a layout. Galen can perform different checks at different viewport dimensions or different browsers. This is vital where a site makes use of <strong>responsive design</strong> and feature detection.</p><p>I think Galen Framework deserves more attention. It’s a powerful tool, and not hard to set up. But again, it’s geared more towards long-lived projects that are subject to frequent change. It’s also ideal for <a href="https://tinnedfruit.com/articles/test-your-design-system-not-your-website.html">testing a design system</a>.</p><p>If you’re interested in layout testing, check out my upcoming <a href="https://tinnedfruit.com/automated-responsive-design-testing/">step-by-step guide to testing responsive designs with Galen</a>.</p><p>Links:</p><ul><li><a href="http://galenframework.com/">Galen Framework</a> — Automated responsive design testing framework</li><li><a href="https://tinnedfruit.com/automated-responsive-design-testing/">Automated Responsive Design Testing</a> — My step-by-step guide to using Galen</li></ul><h4>28. Test automatically when anything changes</h4><p><a href="https://www.thoughtworks.com/continuous-integration">Continuous integration</a> (CI) is a development process in which team members commit code to a central repository. Each time the code base changes, a build process tests and validates the code. Only builds that pass these tests are suitable for release. If a build fails, the team should fix it quickly. The aim is to have <strong>code in a releasable state</strong> at all times.</p><p>In the past, CI required a <strong>dedicated server</strong> that someone in the team or organisation had to maintain, usually running <a href="https://jenkins.io/">Jenkins</a>. Teams are increasingly using <strong>cloud CI services</strong> like <a href="https://travis-ci.org/">TravisCI</a> and <a href="https://circleci.com/">CircleCI</a> to fulfil this function.</p><p>Almost all the automated linting and testing tools mentioned in this article can be integrated into a CI job. Including the ability to run <strong>automated tests on browser testing services</strong>.</p><p>With some investment of time and some ongoing costs, teams can reduce the amount of time they spend on manual testing and <strong>speed up their release cycle</strong>.</p><p>Links:</p><ul><li><a href="https://www.thoughtworks.com/continuous-integration">Continous Integration</a> — Thoughtworks</li><li><a href="https://jenkins.io/">Jenkins</a> — Open source automation server</li><li><a href="https://travis-ci.org/">Travis CI</a> — Continous integration service</li><li><a href="https://circleci.com/">CircleCI</a> — Continous integration and delivery platform</li></ul><h3>Delegate testing work</h3><p>This might seem obvious: if you want to do less manual cross–browser testing yourself, <strong>ask someone else to do it</strong>. OK, I realise that means you might have to pay them.</p><h4>29. Hire a professional</h4><p>Test professionals generally go through a <strong>certification process</strong>, whether they specialise in manual testing or automation. I’m no expert on this process, but it should ensure that you’re hiring someone with a good grounding of professional testing expertise.</p><p>In practice, like all professionals, there is a big variation in skill and experience. When you have a good test professional on your team, the difference is noticeable. Everyone will be more committed to producing high–quality work. The best testers will help <strong>transform the working practices of the whole team</strong> for the better.</p><p>Even if you aren’t able to hire a dedicated test professional, it can be useful to train someone in testing skills for the benefit of the team.</p><h4>30. Include your testers in the development process</h4><p>To get the best out of your testers, you should <strong>avoid keeping them siloed</strong> in a separate team, or treating them like a black box just for testing your work. Test professionals can contribute at all stages of the development process, from planning and design through to deployment and maintenance.</p><p>Planning <strong>how the team is going to test</strong> a new feature is of key importance before development starts. But it’s a consideration that often gets missed because testers are not included in planning conversations. The team is usually focused on how well the feature will work, not how well it will fail.</p><p>Likewise, <strong>pairing with testers</strong> during development itself can be a great way to learn from one another.</p><p>Get your testers involved in everything that the team does. You won’t regret it.</p><h4>31. In-source testing</h4><p>You may have experience of working in a team that has an outsourced testing team, whose job it is to do a Big Test and then <strong>report back all the bugs</strong> for you to fix. This might happen for each release, each week, or even nightly.</p><p>This approach developed when software release cycles were long, and the software itself distributed on disk. But it’s <strong>monstrously inefficient</strong> for web development, where release cycles are quicker and changes can be made at any time.</p><p>Where I have seen an outsourced test team, it’s inevitable that the development team end up doing a lot of <strong>tactical testing</strong> themselves. They do this to identify issues as soon as possible so they can press on with getting the work delivered.</p><p>Not all outsourced testing is bad, but if you end up waiting on the results of testing before moving on with your own work, you’ll need to find ways to speed things up.</p><h3>Continuous improvement</h3><p>That’s a lot of things you could do to improve your cross–browser testing. Which should you address first? The answer to this question will be <strong>different for each project and team</strong>.</p><p>You can start by gathering information. Get a good understanding of <strong>what you and your team are currently doing</strong>. How good is the current approach is at identifying issues and getting them resolved? What’s getting in the way of that happening?</p><p>If you have a <strong>customer support team</strong>, working with them to understand the trends in user feedback and support tickets can be revealing.</p><p>Gather as much information as possible so that you can <strong>make changes with the biggest impact</strong>. Do one thing at a time, see what improved and repeat.</p><p>If you enjoyed this article, you might be interested in my book <a href="https://tinnedfruit.com/automated-responsive-design-testing/">Automated Responsive Design Testing</a>.</p><p><em>Originally published at </em><a href="https://tinnedfruit.com/articles/31-ways-to-spend-less-time-on-manual-cross-browser-testing.html"><em>tinnedfruit.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5904b6e5306f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tinned-fruit/31-ways-to-spend-less-time-on-manual-cross-browser-testing-5904b6e5306f">31 Ways to Spend Less Time on Manual Cross–Browser Testing</a> was originally published in <a href="https://medium.com/tinned-fruit">Tinned Fruit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are you writing legacy CSS code?]]></title>
            <link>https://medium.com/tinned-fruit/are-you-writing-legacy-css-code-3d864dc702b8?source=rss-620e52cfeef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d864dc702b8</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Jim Newbery]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 15:50:11 GMT</pubDate>
            <atom:updated>2017-07-20T15:50:11.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vofp70hUczixwsnZK71zRg.jpeg" /></figure><p><strong>I’ve created many terrible CSS code bases.</strong></p><p>As long-lived projects progressed, it became harder and harder to keep the code well organized. Decisions I made in the past came back to bite me later in the project when I didn’t have time to fix them. Selector specificity crept up as I opted for quick fixes to avoid addressing the real problem.</p><p>For many projects, the problem ended there, because I moved on.</p><p>But for the big, important projects with a maintenance cycle of forever and a larger team, this can get really frustrating. All the time we were introducing technical debt through incremental additions. CSS practices were changing, and new and shiny tools would appear, promising a shangri-la of CSS developer happiness. Fear of Missing Out took hold, and we would start to daydream about a better world.</p><p>When I first started out as a developer, I just wanted to create stuff. Then, when I began working on bigger projects with an existing team, I started to get frustrated that the ‘legacy code’ was holding me back from this aim. If only the team leader would let me refactor it all!</p><p>Eventually, I became a team leader myself, and realised that <em>I</em> had been the one creating legacy code all along.</p><h3>The cycle of rewrites</h3><p>When faced with a giant dissatisfying mess of CSS, our instincts are to rewrite the whole thing. More so if we didn’t create the mess ourself.</p><p>This is the cycle I’ve fallen foul of:</p><ol><li>Become dissatisfied with the CSS code that we have. We need to simplify it, remove duplication and improve performance.</li><li>Start with small changes, but end up re-doing the whole lot. It’s good, though!</li><li>Start adding new features, change others, hire new team members, find out about new CSS frameworks and techniques.</li><li>Time passes…</li><li>Become dissatisfied with the CSS code that we have…</li></ol><p>You get the picture. It took me a few cycles of this to realize what the real problem is.</p><p>We focus too much on getting the rewrite/refactor right, and not enough on how the whole team is going to maintain quality in the future.</p><p>Anyone not involved in the refactoring work has a right to look at what we done with scepticism and trepidation if they have to maintain it.</p><p>What we’ve done is to create more legacy code.</p><h3>What do we mean by ‘legacy’ code?</h3><p>In common use, we talk about ‘legacy’ code as if we mean anything that someone else wrote in the past that is a pain to work with. ‘Legacy systems’ are those that we know we need to replace, or have already been superseded, but are difficult to eradicate.</p><p>They are tottering under the weight of tech debt accrued over time. Or they are based on an approach that is now considered old hat. CSS flexbox is busy making all your float-based layouts legacy right now.</p><p>But real people created those legacy systems, often with care and love. Sometimes, those people are still part of the team that is responsible for maintaining them.</p><p>I like to remind myself of the <a href="http://retrospectivewiki.org/index.php?title=The_Prime_Directive">prime directive of agile retrospectives</a> when getting familiar with existing code bases. It helps me to avoid petty snarkiness. It also helps me feel better about returning to my own code after a few months.</p><blockquote><em>Regardless of what we discover, we understand and truly believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand.</em></blockquote><h3>Rethinking ‘legacy’</h3><p>I don’t like this common use of ‘legacy’. It’s subjective, relative, disrespectful and not at all useful.</p><p>One person’s legacy code base is another’s best work of their career (the good type of legacy). Just because code is old, doesn’t mean it is not elegant, organized, performant and understandable. Just because code is new doesn’t mean it is not a mess.</p><p>In his 2004 book, <em>Working Effectively With Legacy Code</em>, Michael Feathers describes a different definition of ‘legacy code’. He defines it as code that is <em>not covered by tests</em>. That’s it. If you think about it for a moment, it makes sense. It applies to old or new code. It focuses on maintainability and understandability. Code without tests is hard to change with confidence.</p><p>Although Feathers focuses on imperative object-oriented languages like Java, we can apply his thinking about legacy code to CSS too. The complaints below apply to CSS as much as they do to Java or JavaScript:</p><ul><li>If you don’t have tests covering a particular bit of code, it’s hard to know how it is operating.</li><li>The code might work, but you’re not sure how.</li><li>You might not even know which parts of the code base are combining to produce the final system behaviour.</li><li>Tracking down the code that produces the behaviour you’re interested in can be frustrating and time consuming.</li></ul><p>So, how is this concept of legacy useful in CSS?</p><h3>Your refactor could be creating new legacy code</h3><p>Think about the last time you refactored some CSS. How did you make sure you weren’t breaking anything? Did you test manually and by eye? Or did you cover your changes with visual regression tests using image diffs? How many browsers and devices did you run these tests on?</p><p>It’s OK to admit that you didn’t test as much as you would like. The problems with unstructured CSS code bases can be bad. Enough that the priority is just to get something — anything — to replace what’s there. I’ve done that too many times in the past to count.</p><p>Manual cross-browser testing is time-consuming and difficult to repeat with consistency. Automated testing of layout and design has been difficult to achieve in the past, and is rare.</p><p>When we do a big refactor or rewrite, we may have fixed most or all of the explicit code problems. But how do we prevent our new shiny creation from becoming as much of a hairball as the thing we replaced?</p><p>By Michael Feathers’ definition, unless you put tests in place to keep things on track, you’ve just created more legacy code. You may have improved the situation for now, but your code will trend towards entropy like the rest of the universe.</p><p>How do we stop the rot?</p><h3>CSS is a team sport</h3><p>The next person that comes along to work on your code (or you in six months time) will have to understand and adopt the same approach as you. They will need to understand how to avoid specificity creep. They will need some confidence that they haven’t caused knock-on regressions in other parts of the code.</p><p>Remember that CSS is often a team endeavour, and many people will read and contribute to the code, now and in the future. Even if you are the only the person responsible now, who will maintain this code in the future?</p><p>Modern CSS architecture techniques like <a href="http://getbem.com/">BEM</a>, <a href="https://smacss.com/">SMACSS</a> or <a href="http://itcss.io/">ITCSS</a> encourage maintainability for teams as well as individuals. They do this by providing specific patterns for low specificity, modularity and consistent naming. This helps readability for others that need to understand what your code is doing. It helps them to make changes and additions of their own by enforcing constraints for how they should be done.</p><p>But the most important thing is to agree and maintain a consistent approach. To share that approach with everyone on the team, and to make sure that the team helps itself to maintain standards in the long term.</p><p>When taking on refactoring work, it’s important to look beyond the here-and-now of getting your code working. You should also consider how you and others will maintain the code for the long term.</p><h3>Always Be Refactoring</h3><p>When I think about the many Big CSS Rewrites I’ve been a part of in the past, a pattern emerges. The refactors or rewrites we do are big tasks in the first place because we aren’t taking on smaller ones along the way. Big rewrites are always painful. We usually have to negotiate time away from working on feature development, for little visible outcome to users. Then, 18 months later, we negotiate another big rewrite.</p><p>One of the reasons this happens is because of testing overhead. Validating that even small changes don’t cause knock-on effects takes time. So team-members shy away from making lots of small improvements beyond the work they have to deliver.</p><p>These small improvements and fixes often don’t get done. Inefficient and inconsistency strays into the codebase. Tech debt adds up, and you end up with another hairball.</p><p>We should be making small refactors as we go along. We don’t need to negotiate any special work, because this is part of the work of delivering new features.</p><p>We can only do this if testing changes is a low-friction exercise, or even better, happens automatically.</p><h3>A machine for preventing new legacy code</h3><p>Most articles about CSS refactoring focus on specific refactoring techniques. They rarely even mention testing as a safety net for changes. Those that do describe ad-hoc manual testing or <a href="https://decadecity.net/blog/2014/11/04/css-refactoring-wraith">visual regression testing</a> using image diff tools such as <a href="https://github.com/BBC-News/wraith">Wraith</a>, <a href="https://github.com/Huddle/PhantomCSS">PhantomCSS</a> or <a href="https://github.com/garris/BackstopJS">BackstopJS</a>. These tools take a little setting up, but they can quickly tell you if a page or component differs from an expected ‘reference’ image. You can use visual regression tests if you want to refactor code to produce the same result that you already have.</p><p>Visual regression testing tells you that <em>something</em> has changed. The tests themselves do not describe how we expect the system to behave. When a test fails, we still have to interpret the visual diffs to identify both what the expected layout is, and how our implementation differs from it. It’s really a more consistent, sensitive and faster version of manual cross-browser testing.</p><p>In contrast, most other types of automated testing compare the <em>behaviour</em> of the system with a specific expectation. We can test the system as a whole (end-to-end tests) or individual units of code in isolation (unit testing). For example, the <a href="https://cucumber.io/">Cucumber</a> framework provides a way to create human-readable specifications that can also serve as automated end-to-end tests. It is just as much about team communication and collaboration as it is about automated testing.</p><p><a href="http://galenframework.com/">Galen Framework</a> provides a way to test responsive layouts against human– and machine–readable specifications. You can run tests on different browsers and devices, and you can even use cloud testing services like <a href="https://www.browserstack.com/">BrowserStack</a> or <a href="https://saucelabs.com/">Sauce Labs</a>. All this can be part of a continuous integration task so that tests run whenever anyone commits code changes. You could use this approach in isolation, or in combination with visual regression tests.</p><p>The important thing to consider is how you or your team will be able to test CSS changes fast enough to reduce friction for making these changes.</p><h3>Testing is more than just automated tests</h3><p>Having a suite of visual regression tests or layout specification tests will help, but they are only part of a bigger picture.</p><h4>Design systems as test cases</h4><p>We would usually want to <a href="https://tinnedfruit.com/articles/test-your-design-system-not-your-website.html">avoid running design tests across our whole site</a>. Doing so would take far too long for anything but the most simple website. This is where a living style guide or design system can be useful. If every component has a URL, we can run tests in a predictable environment, rather than on a site with content that changes often.</p><p>Get yourself a testable style guide site. It doesn’t have to be super sophisticated. Check out <a href="http://styleguides.io/">styleguides.io</a> for heaps of helpful resources.</p><h4>Agreed code style, linting and code reviews</h4><p>Automated layout tests or visual regression tests only tell you if your components are rendering as expected. To ensure consistency of approach in your team, you’ll need to do more. To keep the benefits of a refactor or rewrite in the long term, you’ll need a shared and agreed coding style. And you’ll need regular code reviews to keep on top of it.</p><h3>Give it a go</h3><p>If you are in charge of a CSS code base, your job is to create a process where maintaining high quality happens by default and legacy code creation is minimised.</p><p>Keeping your CSS in good shape for the long term is about more than a good architecture. It needs to encourage others to contribute. Combine design systems, coding style guidelines, code reviews, testing, CSS architecture patterns and help with contributions to keep everyone focusing on long-term quality.</p><p>Setting up these things are not so hard by themselves. You can introduce them one by one. Give them some consideration so that your next refactor is a considerate, future-friendly one.</p><p><em>Originally published at </em><a href="https://tinnedfruit.com/articles/are-you-writing-legacy-css-code.html"><em>tinnedfruit.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d864dc702b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tinned-fruit/are-you-writing-legacy-css-code-3d864dc702b8">Are you writing legacy CSS code?</a> was originally published in <a href="https://medium.com/tinned-fruit">Tinned Fruit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>