Monday, October 31, 2016

Ask the UXperts: Dark Patterns and Persuasive Design — with Ben Tollady

Design is often about balancing the needs of the user and the business.  A big part of what we want to do is help people to achieve what they want or need – usually avoiding pain or seeking reward. There are many ways of doing this, some of which walk fairly close to (or cross) the moral and ethical line. We call those ‘dark patterns’.

Persuasive design is generally recognised as a more ethical alternative — it involves using elements of cognitive psychology in order to change user behaviour through techniques like persuasion, social influence and the formation of habits.

Next up in our Slack channel, Ben Tollady of Thirst Studios will share advice around designing ethically and where the boundaries of ethical and responsible design lie.

The Details

Meet Ben Tollady

 

Ben TolladyBen Tollady is an accomplished designer, having worked in the field of user experience and interaction design for over a decade in both the UK and Australia.

His background in industrial design translates directly to his work in interaction design for the web and he firmly believes that successful interaction design revolves around simplicity and relevance.

Ben has taught UX at organisations such as Education Services Australia and currently resides upon the faculty for Tractor Design School as an industry mentor for its UX program.

How to Ask Your Questions

If you can’t make the live session but have questions, we’d love to collect them ahead of time and we’ll ask Ben on your behalf. You can submit your questions here. We’ll publish the responses (along with the full transcript) in the days following the session.

Here are a few questions to get you thinking:

  1. Can you give us some real life examples of dark patterns or unethical design in action?
  2. What are some of the cognitive biases that we can take advantage of as designers to be more persuasive in our work?
  3. Do you think it is our job as designers to call our other people if we believe they are designing irresponsibly?

How does Ask the UXperts work?

These sessions run for approximately an hour and best of all, they don’t cost a cent. We use a dedicated public Slack channel. That means that there is no audio or video, but a full transcript will be posted up on here in the days following the session.

The post Ask the UXperts: Dark Patterns and Persuasive Design — with Ben Tollady appeared first on UX Mastery.


by Sarah Hawk via UX Mastery

Adventures in Aurelia: Creating a Custom PDF Viewer

Handling PDF files within a web application has always been painful to deal with. If you're lucky, your users only need to download the file. Sometimes, though, your users need more. In the past, I've been lucky, but this time, our users needed our application to display a PDF document so they could save metadata related to each individual page. Previously, one might have accomplished this with an expensive PDF plugin, such as Adobe Reader, running inside the browser. However, with some time and experimentation, I found a better way to integrate PDF viewers in a web application. Today, we'll take a look at how we can simplify PDF handling, using Aurelia and PDF.js.

Overview: The Goal

Our goal, today, is to build a PDF viewer component in Aurelia that allows two-way data flow between the viewer and our application. We have three main requirements.

  1. We want the user to be able to load the document, scroll, and zoom in and out, with decent performance.
  2. We want to be able to two-way-bind viewer properties (such as the current page, and the current zoom level) to properties in our application.
  3. We want this viewer to be a reusable component; we want to be able to drop multiple viewers into our application simultaneously with no conflicts and little effort.

You can find the code for this tutorial on our GitHub repo, as well as a demo of the finished code here.

Introducing PDF.js

PDF.js is a JavaScript library, written by the Mozilla Foundation. It loads PDF documents, parses the file and associated metadata, and renders page output to a DOM node (typically a <canvas> element). The default viewer included with the project powers the embedded PDF viewer in Chrome and Firefox, and can be used as a standalone page or as a resource (embedded within an iframe).

This is, admittedly, pretty cool. The problem here is that the default viewer, while it has a lot of functionality, is designed to work as a standalone web page. This means that while it can be integrated within a web application, it essentially would have to operate inside an iframe sandbox. The default viewer is designed to take configuration input through its query string, but we can't change configuration easily after the initial load, and we can't easily get info and events from the viewer. In order to integrate this with an Aurelia web application — complete with event handling and two-way binding — we need to create an Aurelia custom component.

Note: if you need a refresher on PDF.js, check out our tutorial: Custom PDF Rendering in JavaScript with Mozilla’s PDF.js

The Implementation

To accomplish our goals, we're going to create an Aurelia custom element. However, we're not going to drop the default viewer into our component. Instead, we're going to create our own viewer that hooks into the PDF.js core and viewer libraries, so that we can have maximum control over our bindable properties and our rendering. For our initial proof-of-concept, we'll start with the skeleton Aurelia application.

The boilerplate

As you can see if you follow the link above, the skeleton app has a lot of files in it, many of which we're not going to need. To make life simpler, we have prepared a stripped down version of the skeleton, to which we have added a couple of things:

  • A Gulp task to copy our PDF files to the dist folder (which Aurelia uses for bundling).
  • The PDF.js dependency has been added to package.json.
  • In the root of the app, index.html and index.css have received some initial styling.
  • Empty copies of the files we're going to be working in have been added.
  • The file src/resources/elements/pdf-document.css contains some CSS styling for the custom element.

So let's get the app up and running.

First off, ensure that gulp and jspm are installed globally:

npm install -g gulp jspm

Then clone the skeleton and cd into it.

git clone git@github.com:sitepoint-editors/aurelia-pdfjs.git -b skeleton
cd aurelia-pdfjs

Then install the necessary dependencies:

npm install
jspm install -y

Finally run gulp watch and navigate to http://localhost:9000. If everything worked as planned, you should see a welcome message.

Some more set-up

The next thing to do is to find a couple of PDFs and place them in src/documents. Name them one.pdf and two.pdf. To test our custom component to the max, it would be good if one of the PDFs were really long, for example War and Peace which can be found on the Gutenberg Project.

With the PDFs in place, open up src/app.html and src/app.js (by convention the App component is the root or the Aurelia app) and replace the code that is there with the contents of these two files: src/app.html and src/app.js. We'll not touch on these files in this tutorial, but the code is well commented.

Gulp will detect these changes automatically and you should see the UI of our app render. That's it for the setup. Now it's on with the show ...

Creating an Aurelia custom element

We want to create a drop-in component that can be used in any Aurelia view. Since an Aurelia view is just a fragment of HTML wrapped inside of an HTML5 template tag, an example might look like this:

<template>
  <require from="resources/elements/pdf-document"></require>
  <pdf-document url.bind="document.url"
                page.bind="document.pageNumber"
                lastpage.bind="document.lastpage"
                scale.bind="document.scale">
  </pdf-document>
</template>

The <pdf-document> tag is an example of a custom element. It, and its attributes (like scale and page) aren't native to HTML, but we can create this using Aurelia custom elements. Custom elements are straightforward to create, using the basic building blocks of Aurelia: Views and ViewModels. As such, we'll first scaffold our ViewModel, named pdf-document.js, like so:

// src/resources/elements/pdf-document.js

import {customElement, bindable, bindingMode} from 'aurelia-framework';

@customElement('pdf-document')

@bindable({ name: 'url' })
@bindable({ name: 'page', defaultValue: 1, defaultBindingMode: bindingMode.twoWay })
@bindable({ name: 'scale', defaultValue: 1, defaultBindingMode: bindingMode.twoWay })
@bindable({ name: 'lastpage', defaultValue: 1, defaultBindingMode: bindingMode.twoWay })

export class PdfDocument {
  constructor () {
    // Instantiate our custom element.
  }

  detached () {
    // Aurelia lifecycle method. Clean up when element is removed from the DOM.
  }

  urlChanged () {
    // React to changes to the URL attribute value.
  }

  pageChanged () {
    // React to changes to the page attribute value.
  }

  scaleChanged () {
    // React to changes to the scale attribute value.
  }

  pageHandler () {
    // Change the current page number as we scroll
  }

  renderHandler () {
    // Batch changes to the DOM and keep track of rendered pages
  }
}

The main thing to notice here is the @bindable decorator; by creating bindable properties with the configuration defaultBindingMode: bindingMode.twoWay, and by creating handler methods in our ViewModel (urlChanged, pageChanged, etc) we can monitor and react to changes to the associated attributes that we place on our custom element. This will allow us to control our PDF viewer simply by changing properties on the element.

Then, we'll create the initial view to pair with our ViewModel.

// src/resources/elements/pdf-document.html

<template>
  <require from="./pdf-document.css"></require>

  <div ref="container" class="pdf-container">
    My awesome PDF viewer.
  </div>
</template>

Integrating PDF.js

PDF.js is split into three parts. There's the core library, which handles parsing and interpreting a PDF document; the display library, which builds a usable API on top of the core layer; and finally, the web viewer plugin, which is the prebuilt web page we mentioned before. For our purposes, we'll be using the core library through the display API; we'll be building our own viewer.

Continue reading %Adventures in Aurelia: Creating a Custom PDF Viewer%


by Jedd Ahyoung via SitePoint

PrognRoll – Tiny jQuery Plugin to Show Scroll Progress Bar on Page

PrognRoll is a tiny jQuery plugin that creates scroll progress bar on the page. You can also customize the progress bar.


by via jQuery-Plugins.net RSS Feed

Editorial: Is JavaScript Always the Best Solution?

Lately, there has been a lot of discussion surrounding the role of JavaScript in modern web pages and web apps. It all seems to have kicked off with an amusing (but not entirely untrue) article entitled How it feels to learn JavaScript in 2016 in which the author expresses his concern at the fragmented state of the JavaScript ecosystem and the amount of tooling necessary to start a JavaScript project today.

In the debate that followed, there was an interesting Twitter poll that caught my eye. It asked if in 2016, it's OK to build a website that doesn't work without JavaScript. Of the 4,157 people that replied, 42% (so 1,746 people) declared that it was. Woah!

As editor of SitePoint's JavaScript channel you might expect me to be among those 42%. Well, sorry to disappoint, but I'm afraid I'm not. As my colleague Patrick recently pointed out, it all depends upon the context. Keeping an open mind as to the most accessible and most reliable method of solving a problem, will inevitably lead to the best solution. Here's a small example to illustrate the point:

Continue reading %Editorial: Is JavaScript Always the Best Solution?%


by James Hibbard via SitePoint

There Are More Virtual Reality Headsets Than You Realize!

A collage of VR headsets

Virtual reality (VR) is a bit of a hot topic at the moment! I spend a lot of time putting together a weekly newsletter all about emerging tech news like virtual reality, talking about VR at events, showing people the possibilities of VR, teaching people to build VR experiences and more. There are a lot of VR thoughts flooding this brain of mine! Throughout all that, I've come across plenty of virtual reality headsets and thought I'd share something that not a lot of people out there realize — there are many more VR headsets out there than you think... and even more on the way! Here's a look at my favorites, starting with the more commonly known ones!

Oculus Rift

[caption id="attachment_142263" align="aligncenter" width="800"]Rift Consumer Edition The Oculus Rift Consumer Edition headset[/caption]

The Oculus Rift is the VR headset that started the whole VR trend once again! Even this headset has been around for longer than a lot of people realize. It has had several developer iterations, including the Oculus Rift Development Kit 1 (DK1) released in 2013 for their Kickstarter backers and the higher resolution Oculus Rift Development Kit 2 (DK2) released in 2014, before finally releasing the Oculus Rift Consumer Edition in 2016 to many eager VR adopters around the world. There were other unreleased prototypes of the Rift in between as well, but to keep things simple, we'll stick with the ones released to developers!

The Rift itself works by being connected to a PC. It currently no longer supports Mac OS. To be honest, I don't think any of the VR headsets that will be mentioned in this article work with Mac OS. VR apps can be installed via the Oculus Store.

What's the Rift capable of in comparison to other headsets? Here's a simplified list of features which I'll use across all currently available headsets I mention in this piece:

Resolution: 1080×1200 for each eye.
Field of view: 110°
Display tech: One OLED screen for each eye.
Refresh rate: 90 Hz
Headphones: Integrated into the headset.
Seated/standing or room-scale: Most experiences are seated or standing. Extra sensors can be purchased soon (announced in October 2016) that will allow for the ability to walk around a space, however I'm not sure how many Rift games have been built for that. Largely, Oculus have been focused on VR experiences you can have standing/sitting in one place.
Controllers: Oculus Touch handheld controllers available to order since October 2016.

HTC Vive

[caption id="attachment_142265" align="aligncenter" width="800"]The HTC Vive headset with its Lighthouse sensors and controllers The HTC Vive headset with its Lighthouse sensors and controllers[/caption]

The HTC Vive isn't quite as well known outside of the tech and gaming community but it's growing in momentum that is well deserved! The Vive is a partnership between HTC and Valve, which was officially revealed in March 2015. My favorite thing about the Vive is that it comes with "Lighthouse sensors" to allow you to walk around an area of a maximum of 15x15 feet. This ability to walk around is known as "room-scale". It also comes with two handheld controllers. Because of this, a large amount of the Vive VR apps and games out there work wonderfully with full immersion — you can walk around an experience, look at it from different angles and interact with it using both hand controllers. One of my favorite VR applications, Tilt Brush, lets you draw in 3D space. You can literally draw an environment around you, look at it from all angles and (with one of the latest updates) have it react to music! It is fantastic.

Just like the Rift, the Vive works by being connected to a PC. HTC Vive games and VR experiences can be purchased from Steam or the Vive's own store called Viveport. Steam's VR experiences can also be played on other VR headsets, depending on the app's requirements (if it requires Vive controllers, for example, then the app won't likely be compatible).

Resolution: 1080×1200 for each eye.
Field of view: 110°
Display tech: One OLED screen for each eye.
Refresh rate: 90 Hz
Headphones: Requires external headphones to be plugged in.
Seated/standing or room-scale: The Vive is known especially for its room-scale capabilities!
Controllers: The Vive comes with two handheld controllers.

Sony PlayStation VR

[caption id="attachment_142268" align="aligncenter" width="800"]The PlayStation VR headset with Move Controllers and the PlayStation Camera The PlayStation VR headset with Move Controllers and the PlayStation Camera[/caption]

Many people out there don't know this is coming, but by Christmas, virtual reality is going to be in a lot of homes around the world. It works by connecting up to the PlayStation 4 and has its own slightly less advanced controllers. It is priced cheaper than the above two headsets but isn't quite as fully featured. From the sounds of it though, the games on their way for this platform just might make up for its slightly less impressive specs. Sony has a lot of partners in the game development industry. Upcoming titles like Batman: Arkham VR and Resident Evil 7 in VR sound like they'll be a lot of fun! Each game will have a different level of VR compatibility, different controller requirements... etc, which will be listed on each game box.

Resolution: 960x1080 for each eye.
Field of view: 100°
Display tech: One OLED screen split in two for each eye.
Refresh rate: Can switch between 120Hz and 90 Hz.
Headphones: Requires external headphones to be plugged in.
Seated/standing or room-scale: Sony recommends people sit for the majority of their VR experience. There is no capability for walking around like the room-scale of the Vive.
Controllers: Games may use the typical PlayStation controllers, or you can purchase one or two PlayStation Move controllers separately. They also come in a bundle with the headset. A "PS Aim Controller" is also on the way for first-person shooting games.

Google Cardboard

[caption id="attachment_142264" align="aligncenter" width="800"]A Google Cardboard headset The latest Google Cardboard headset[/caption]

The Google Cardboard headset is a portable headset that originally was indeed made of cardboard! Of all the VR headsets, this is the one most people who I've come across have tried. Rather than the headset itself doing very much, it is a container for a smartphone that runs the applications. Each VR application displays two images, one for each eye, in a splitscreen view. Those views are looked at through lenses in the Cardboard headset. These are the cheapest and easiest way to try out VR as they originally cost around $20 and can now be even cheaper! There are plenty of stores out there who have been selling relatively inexpensive Google Cardboard-compatible headsets including Aldi, Lincraft, Tesco, Walmart and Costco. This list alone could have been three times as long if I included every Google Cardboard-style headset out there today! Google Cardboard apps can be found in the Google Play store, and WebVR experiences (VR running in the smartphone browser) also are quite easy to try out on the Google Cardboard.

Continue reading %There Are More Virtual Reality Headsets Than You Realize!%


by Patrick Catanzariti via SitePoint

A Crash Course of Changes to Exception Handling in PHP 7

Exception handling saves your code in the most unusual circumstances. PHP 7 has introduced two new classes that assist a developer in handling errors with ease, and that's what we'll look at in this post. Before the introduction of these classes in PHP 7, exception error classes were written to handle the different types of errors.

Illustration of female leg stepping on rake with the word Oops in big letters, indicating pending accident

Throwable Class

Throwable is the interface from which, Exception and Error classes branch out. This particular class helps you catch any throwable errors, irrespective of whether they are an exception or an error. For example:

<?php
try {
    throw new Exception("This is an exception");
}
catch (Throwable $e) {
    echo $e->getMessage();
}

Or the newly defined ParseError:

<?php
try {
    $result = eval("2*'7'");
}
catch (Throwable $e) {
    echo $e->getMessage();
}

After executing this code, you will get a ParseError because ";" is missing inside eval().

User defined classes cannot implement Throwable directly, and must instead extend Exception which implements Throwable.

Error Class

The Error class in PHP 7 is a new type of class that handles the different errors - they are either fatal errors or type errors, and this class is only for internal PHP errors. Error is divided into four subclasses:

Continue reading %A Crash Course of Changes to Exception Handling in PHP 7%


by Ahmed Khan via SitePoint

Why people participate in UX research (and why the reasons matter)

Finding and scheduling suitable research participants is one of the biggest logistical challenges of UX research. Not to mention then getting those participants to fully engage in research activities. 

There have been many articles written about finding UX participants and ensuring they are at least representative of your users. But I’m yet to find much good discussion about the motivations for participants to take part in our research, and how that affects their participation and the research results. 

Understanding the underlying contexts, motivations, and biases when people enter a study helps plan and interpret results in the most neutral way possible.

There are many exceptions, but the most common ways to find UX research participants are to reach out to existing customers or leads, or use panels of UX tools like usertesting.com or recruiting companies. Even if you write a screener and recruit for a well-defined persona, each source results in different motivations, and can lead to varied responses to research activities.

Let’s look at each main recruiting source and some of the pros, cons, and things to be aware of while crafting your research plans.

Existing Users

People who already have a relationship with your brand can’t help but bring their preexisting impression of the company – whether positive or negative – to research sessions. Their overarching perception of your brand will sway their impressions of the product you’re investigating.

This is called the halo effect. If you generally like a brand, you’ll be primed to like everything about it. If you dislike the brand, you’ll be primed to think more negatively about every aspect you see.

Let’s say, for example, that you’ve always wanted a BMW, and hold the company in high regard. You get brought in to test a new navigation system and have trouble entering your address.

If you've always wanted to drive one of these, you might have trouble giving unibiased feedback. Photo by adel ben http://ift.tt/2dK41Jh

If you’ve always wanted to drive one of these, you might have trouble giving unbiased feedback. Image source

Your first thought may not be that the system has a usability problem. Without even realising it, you might blame yourself, thinking you made a mistake, or write it off as part of being just a prototype.

The information in front of you doesn’t match your previous expectations (a phenomenon known as cognitive dissonance). So you assign the trouble elsewhere, downplay the importance of the issue, or focus your attention on the aspects of the experience that you like (what’s called confirmation bias). That means as a UX research participant, you’ve failed to give a lot of really important information without even knowing it.

A user’s experience with an overall brand also plays into their motivation to participate in a test. If a person frequently uses a product, they may have a vested interest in seeing the service improve and/or vouching for specific changes or improvements. If they like the product or have a good relationship with someone who works there, they may participate because they want to help out. On the other hand, if they’ve had negative experiences, they may look at a research session as a chance to vent or find an inside connection to get things changed.

Special note: If you work on enterprise tools and/or your users are internal, you’re likely to experience exaggerated effects of both the halo effect and confirmation bias, as well as battling politics and ulterior motives. You can’t avoid this, but it’s good to have a heads up.

Panel members

Participants who actively sign up for a research panel know they’ll be compensated for their time when they participate, and are more likely to view responding as a job.

The downside of panels is you don't know as much about them - including if they're just in it for the money. Photo by http://ift.tt/2eekUdc

The downside of panels is you don’t know as much about them – including if they’re just in it for the money. Image source

Many panels allow researchers to “rate” participants, so respondents know that if they give poor quality feedback, they could lose opportunities. The upside of this is that they are the most likely group to show up to sessions as scheduled and respond appropriately and consistently in longitudinal studies. Several studies have shown that monetary incentives increase participation rates.

The downside is that they may view their participation as only a job. They may not be invested in your product or may want to fudge their way into being seen as a representative user.

We’ve all heard of the professional user research participant, who will “ frequently supplement their income by participating in user research… and say and do whatever it takes to get into a study.” Writing effective screeners can help prevent some of those participants from partaking, but even the most qualified panel respondent is more likely to be motivated by money over altruism or intrinsic interest in the product.

So how can you make the most of your user research?

Now that we’ve looked at some of the issues, let’s take a look at the steps you can take to get the best possible engagement and data from research sessions. We have tools at our disposal, regardless of the source of our users.

Offer compensation (in a way that participants want to receive it)

Remember that participating in a study is essentially a social exchangePeople need to feel they at least come out even. Money, of course, is one of the easiest benefits to provide. 

Studies show that monetary incentives, including receiving a fixed amount of cash, being entered into a lottery for a prize, and charitable donations on a participant’s behalf, can make respondents more likely to participate in research. Besides the obvious benefit of getting paid, compensating participants shows you value their time and input.

Furthermore, giving participants an incentive of any kind can help spark the social construct around the reciprocity principle. Essentially, if you give something (anything) to someone, they will feel compelled to do something in return. This can be especially powerful, especially for longitudinal studies. Anecdotally, I’ve found I get the best response rates when I give about a third of an incentive after successful setup of a longitudinal study and the rest of the incentive upon completion.

Get creative with cash incentives - try a lottery or donation to a charity.

Get creative with cash incentives – try a lottery or donation to a charity.

When choosing compensation, be aware that different types of monetary incentives will be most effective for different types of studies and different types of people. People who have strong inclinations toward self-direction, learning new things, or risk-taking respond better to lottery-type incentives than fixed amounts. People who value close social relations and betterment of the group over oneself prefer money given to a charity in their honour.

So think about the type of characteristics your target persona has and consider whether you can shift (or at least experiment with shifting!) the type of incentive you offer. Think carefully about offering a discount to your service as motivation. This can sway people too far and they might feel uncomfortable saying anything negative.

Also be mindful of the amount of incentive you provide. You want to provide an amount that demonstrates you appropriately value their time without breaking the budget. For instance, I’ve paid doctors much more to participate in a study than general e-commerce shoppers and typically pay participants of in-person or ethnographic studies much more than respondents to remote sessions.

Help participants see the importance of their feedback

To tip the social exchange cost/benefit ratio even more, give people context about why their help is useful and what you’ll do with the information. People like to know the feedback they give isn’t just going into a corporate vacuum, never to be seen again.

You can do this simply by introducing the topic at the beginning of a session – something as simple as, “we’re talking about x today because we’ve noticed some issues and would like to make improvements.” Though be careful, because there are times that it makes sense not to give too much away at the beginning of a session.

I’ve also found that people love hearing about changes we’ve made based on their feedback, especially with long term customers or internal users. It’s not always possible to share, but if you can, highlight specific study periods and lessons learned in release notes or even press releases. Participants appreciate it, and are more likely to take part again, or encourage others to do the same.

Create expectations through group labels

This last one is a bit tricky, but several studies show that people are more likely to adopt behaviours based on external labels if they are relatively positive. One study showed that when researchers labelled a random group of people as politically active, they were 15% more likely to vote, and several studies have shown that people tend to like to belong to groups or follow social norms.

My educated guess is that labelling people sets an expectation they’ll behave a certain way. If they don’t follow through, they start to experience the same kind of cognitive dissonance as when you find an issue with a product you love. You can subtly shift language to let people know you expect them to follow through – for example, tell them they’re in the group most likely to respond.

Switch it up when you can

When you know how people can be swayed based on the way you recruit, you can take steps to minimise bias in your results. As you can see, different sources of users and incentives vary the amount and quality of participation. When possible, try to use different types of recruiting methods and experiment with compensation to maximise your results.

What are some of the ways you reduce bias from people taking part in UX research? Let us know in the comments!

The post Why people participate in UX research (and why the reasons matter) appeared first on UX Mastery.


by Amanda Stockwell via UX Mastery