How To Build Resilient JavaScript UIs

Original Source: https://smashingmagazine.com/2021/08/build-resilient-javascript-ui/

Things on the web can break — the odds are stacked against us. Lots can go wrong: a network request fails, a third-party library breaks, a JavaScript feature is unsupported (assuming JavaScript is even available), a CDN goes down, a user behaves unexpectedly (they double-click a submit button), the list goes on.

Fortunately, we as engineers can avoid, or at least mitigate the impact of breakages in the web apps we build. This however requires a conscious effort and mindset shift towards thinking about unhappy scenarios just as much as happy ones.

The User Experience (UX) doesn’t need to be all or nothing — just what is usable. This premise, known as graceful degradation allows a system to continue working when parts of it are dysfunctional — much like an electric bike becomes a regular bike when its battery dies. If something fails only the functionality dependent on that should be impacted.

UIs should adapt to the functionality they can offer, whilst providing as much value to end-users as possible.

Why Be Resilient

Resilience is intrinsic to the web.

Browsers ignore invalid HTML tags and unsupported CSS properties. This liberal attitude is known as Postel’s Law, which is conveyed superbly by Jeremy Keith in Resilient Web Design:

“Even if there are errors in the HTML or CSS, the browser will still attempt to process the information, skipping over any pieces that it can’t parse.”

JavaScript is less forgiving. Resilience is extrinsic. We instruct JavaScript what to do if something unexpected happens. If an API request fails the onus falls on us to catch the error, and subsequently decide what to do. And that decision directly impacts users.

Resilience builds trust with users. A buggy experience reflects poorly on the brand. According to Kim and Mauborgne, convenience (availability, ease of consumption) is one of six characteristics associated with a successful brand, which makes graceful degradation synonymous with brand perception.

A robust and reliable UX is a signal of quality and trustworthiness, both of which feed into the brand. A user unable to perform a task because something is broken will naturally face disappointment they could associate with your brand.

Often system failures are chalked up as “corner cases” — things that rarely happen, however, the web has many corners. Different browsers running on different platforms and hardware, respecting our user preferences and browsing modes (Safari Reader/ assistive technologies), being served to geo-locations with varying latency and intermittency increase the likeness of something not working as intended.

Error Equality

Much like content on a webpage has hierarchy, failures — things going wrong — also follow a pecking order. Not all errors are equal, some are more important than others.

We can categorize errors by their impact. How does XYZ not working prevent a user from achieving their goal? The answer generally mirrors the content hierarchy.

For example, a dashboard overview of your bank account contains data of varying importance. The total value of your balance is more important than a notification prompting you to check in-app messages. MoSCoWs method of prioritization categorizes the former as a must-have, and the latter a nice to have.

If primary information is unavailable (i.e: network request fails) we should be transparent and let users know, usually via an error message. If secondary information is unavailable we can still provide the core (must have) experience whilst gracefully hiding the degraded component.

Knowing when to show an error message or not can be represented using a simple decision tree:

Categorization removes the 1-1 relationship between failures and error messages in the UI. Otherwise, we risk bombarding users and cluttering the UI with too many error messages. Guided by content hierarchy we can cherry-pick what failures are surfaced to the UI, and what happen unbeknownst to end-users.

Prevention is Better than Cure

Medicine has an adage that prevention is better than cure.

Applied to the context of building resilient UIs, preventing an error from happening in the first place is more desirable than needing to recover from one. The best type of error is one that doesn’t happen.

It’s safe to assume never to make assumptions, especially when consuming remote data, interacting with third-party libraries, or using newer language features. Outages or unplanned API changes alongside what browsers users choose or must use are outside of our control. Whilst we cannot stop breakages outside our control from occurring, we can protect ourselves against their (side) effects.

Taking a more defensive approach when writing code helps reduce programmer errors arising from making assumptions. Pessimism over optimism favours resilience. The code example below is too optimistic:

const debitCards = useDebitCards();

return (
<ul>
{debitCards.map(card => {
<li>{card.lastFourDigits}</li>
})}
</ul>
);

It assumes that debit cards exist, the endpoint returns an Array, the array contains objects, and each object has a property named lastFourDigits. The current implementation forces end-users to test our assumptions. It would be safer, and more user friendly if these assumptions were embedded in the code:

const debitCards = useDebitCards();

if (Array.isArray(debitCards) && debitCards.length) {
return (
<ul>
{debitCards.map(card => {
if (card.lastFourDigits) {
return <li>{card.lastFourDigits}</li>
}
})}
</ul>
);
}

return “Something else”;

Using a third-party method without first checking the method is available is equally optimistic:

stripe.handleCardPayment(/* … */);

The code snippet above assumes that the stripe object exists, it has a property named handleCardPayment, and that said property is a function. It would be safer, and therefore more defensive if these assumptions were verified by us beforehand:

if (
typeof stripe === ‘object’ &&
typeof stripe.handleCardPayment === ‘function’
) {
stripe.handleCardPayment(/* … */);
}

Both examples check something is available before using it. Those familiar with feature detection may recognize this pattern:

if (navigator.clipboard) {
/* … */
}

Simply asking the browser whether it supports the Clipboard API before attempting to cut, copy or paste is a simple yet effective example of resilience. The UI can adapt ahead of time by hiding clipboard functionality from unsupported browsers, or from users yet to grant permission.

User browsing habits are another area living outside our control. Whilst we cannot dictate how our application is used, we can instill guardrails that prevent what we perceive as “misuse”. Some people double-click buttons — a behavior mostly redundant on the web, however not a punishable offense.

Double-clicking a button that submits a form should not submit the form twice, especially for non-idempotent HTTP methods. During form submission, prevent subsequent submissions to mitigate any fallout from multiple requests being made.

Preventing form resubmission in JavaScript alongside using aria-disabled=”true” is more usable and accessible than the disabled HTML attribute. Sandrina Pereira explains Making Disabled Buttons More Inclusive in great detail.

Responding to Errors

Not all errors are preventable via defensive programming. This means responding to an operational error (those occurring within correctly written programs) falls on us.

Responding to an error can be modelled using a decision tree. We can either recover, fallback or acknowledge the error:

When facing an error, the first question should be, “can we recover?” For example, does retrying a network request that failed for the first time succeed on subsequent attempts? Intermittent micro-services, unstable internet connections, or eventual consistency are all reasons to try again. Data fetching libraries such as SWR offer this functionality for free.

Risk appetite and surrounding context influence what HTTP methods you are comfortable retrying. At Nutmeg we retry failed reads (GET requests), but not writes (POST/ PUT/ PATCH/ DELETE). Multiple attempts to retrieve data (portfolio performance) is safer than mutating it (resubmitting a form).

The second question should be: If we cannot recover, can we provide a fallback? For example, if an online card payment fails can we offer an alternative means of payment such as via PayPal or Open Banking.

Fallbacks don’t always need to be so elaborate, they can be subtle. Copy containing text dependant on remote data can fallback to less specific text when the request fails:

The third and final question should be: If we cannot recover, or fallback how important is this failure (which relates to “Error Equality”). The UI should acknowledge primary errors by informing users something went wrong, whilst providing actionable prompts such as contacting customer support or linking to relevant support articles.

Observability

UIs adapting to something going wrong is not the end. There is another side to the same coin.

Engineers need visibility on the root cause behind a degraded experience. Even errors not surfaced to end-users (secondary errors) must propagate to engineers. Real-time error monitoring services such as Sentry or Rollbar are invaluable tools for modern-day web development.

Most error monitoring providers capture all unhandled exceptions automatically. Setup requires minimal engineering effort that quickly pays dividends for an improved healthy production environment and MTTA (mean time to acknowledge).

The real power comes when explicitly logging errors ourselves. Whilst this involves more upfront effort it allows us to enrich logged errors with more meaning and context — both of which aid troubleshooting. Where possible aim for error messages that are understandable to non-technical members of the team.

Extending the earlier Stripe example with an else branch is the perfect contender for explicit error logging:

if (
typeof stripe === “object” &&
typeof stripe.handleCardPayment === “function”
) {
stripe.handleCardPayment(/* … */);
} else {
logger.capture(
“[Payment] Card charge — Unable to fulfill card payment because stripe.handleCardPayment was unavailable”
);
}

Note: This defensive style needn’t be bound to form submission (at the time of error), it can happen when a component first mounts (before the error) giving us and the UI more time to adapt.

Observability helps pinpoint weaknesses in code and areas that can be hardened. Once a weakness surfaces look at if/ how it can be hardened to prevent the same thing from happening again. Look at trends and risk areas such as third-party integrations to identify what could be wrapped in an operational feature flag (otherwise known as kill switches).

Users forewarned about something not working will be less frustrated than those without warning. Knowing about road works ahead of time helps manage expectations, allowing drivers to plan alternative routes. When dealing with an outage (hopefully discovered by monitoring and not reported by users) be transparent.

Retrospectives

It’s very tempting to gloss over errors.

However, they provide valuable learning opportunities for us and our current or future colleagues. Removing the stigma from the inevitability that things go wrong is crucial. In Black box thinking this is described as:

“In highly complex organizations, success can happen only when we confront our mistakes, learn from our own version of a black box, and create a climate where it’s safe to fail.”

Being analytical helps prevent or mitigate the same error from happening again. Much like black boxes in the aviation industry record incidents, we should document errors. At the very least documentation from prior incidents helps reduce the MTTR (mean time to repair) should the same error occur again.

Documentation often in the form of RCA (root cause analysis) reports should be honest, discoverable, and include: what the issue was, its impact, the technical details, how it was fixed, and actions that should follow the incident.

Closing Thoughts

Accepting the fragility of the web is a necessary step towards building resilient systems. A more reliable user experience is synonymous with happy customers. Being equipped for the worst (proactive) is better than putting out fires (reactive) from a business, customer, and developer standpoint (less bugs!).

Things to remember:

UIs should adapt to the functionality they can offer, whilst still providing value to users;
Always think what can wrong (never make assumptions);
Categorize errors based on their impact (not all errors are equal);
Preventing errors is better than responding to them (code defensively);
When facing an error, ask whether a recovery or fallback is available;
User facing error messages should provide actionable prompts;
Engineers must have visibility on errors (use error monitoring services);
Error messages for engineers/ colleagues should be meaningful and provide context;
Learn from errors to help our future selves and others.

Get 49% off top VPN plus 1 year unlimited storage for free in this unmissable deal

Original Source: http://feedproxy.google.com/~r/CreativeBloq/~3/qW5j20_NbqA/free-unlimited-storage-with-vpn

ExpressVPN and Backblaze have joined forces.

3 Essential Design Trends, August 2021

Original Source: https://www.webdesignerdepot.com/2021/08/3-essential-design-trends-august-2021/

Sometimes the designs that make the most impact do a lot of unexpected things and break some of the most tried and true rules of visual theory.

Sometimes these design elements work brilliantly, and other times they are fleeting or fall flat. This month all of the examples here seem to break some conventional design rules. Here’s what’s trending in design this month…

1. Alternative Homepage Image/Video Crops

This trend breaks some traditional standards and is pretty refreshing – alternative homepage crops for images and video.

The full screen or 16:9 aspect ratio is out the window with vertical and square options that prove you can do more with your photo collection.

What’s great about this trend is that it’s super attention-getting because of the interesting use of space and imagery. Almost any design without the full-width hero header will grab your attention because it is different. These examples prove that point, and each design does it differently.

Now here’s the challenge: You have to make sure that this style has a solid fallback for mobile so that the result is equally impressive.

Janmaat Fotografie does a great job accounting for interesting photo shapes and flips the script on mobile. (Rather than what you might expect with text then photos because of the desktop placement, the photo stack uses the same shape and layering and is above the text on mobile.) The result is phenomenal.

N3 uses a very vertical image in an almost split-screen style design. It’s a sharp contrast to many of the other split screens we are accustomed to with an equal divide. The distinct shape of the image is interesting and intriguing. It’s definitely not a shape we see in website design frequently.

Bounce uses a similar split-screen effect in the opposite manner as the example above, with the tall, vertical space as an “empty” area and the right side filled with a square video. The shapes help push and pull your eyes across the screen to look at all of the elements and take in the overall design. It’s one of those ideas that if you only talked about it, you might talk yourself out of it, but here, it’s pretty striking.

 

 

2. On-Screen “Stickers”

Stickers are a design trend that has made its way from social media to website design.

These website stickers break design rules because they cover content or seem to be put on the canvas haphazardly. And that’s why they are so attention-getting!

The benefit to these stickers is that they can highlight specific items or content or help focus a call to action.

Friesday uses stickers in conjunction with hover effects to keep users interacting with the design. Multiple stickers can even pop onto the screen in the same location. The animation is simple and fun and feels like a digital sticker book.

August Eighth uses a center sticker as a call to action. It’s a true focal point in the center of the screen with an almost three-dimensional effect that lifts it off the background video. It’s a borderline dark pattern since the only way to get the box off the screen is to click through to the shopping part of the website.

EasyGreen has a bright yellow sticker in the bottom corner that feels almost like the sticker on a piece of fruit. This style and placement work well for the content and product featured. It’s bringing the digital and real-world a little closer with this design element.

 

 

3. Breaking Design “Rules”

The third trend this month is kind of a catch-all for general rule-breaking. While the other trends show certain design elements that aren’t the norm, each of these examples really tosses everything you traditionally think about design out the window. (And that’s ok.)

The trick to a rule-breaking design is that it has to be focused and simple enough to keep users interested and provide intuitive elements that tell them how to interact with the design. It’s a delicate balance.

Here’s how these sites do just that.

Supercontinent has a lot going on. At least four typefaces on the screen at a time, movement (using different shapes and aspect ratios), overlapping elements, hidden navigation, and you may even find a few more broken rules if you look closely. And somehow, it still works.

What’s pulling this design together is a key unbroken rule – the chaos is rooted in a grid system that keeps it all somewhat organized. Plus, there’s plenty of white space to keep elements from feeling crowded and overwhelming.

Source of Plastic Waste combines elements in unexpected ways. There’s no real navigation; the site is just a continuous scroll. That’s a big website usability rule broken right out of the gate. There are other design elements as well, from the “header”/logo moving to the top right corner to the almost over-designed transparent box for text elements. There are a lot of scroll elements and actions happening and layers of text on text in some of the screens.

But here’s the thing about this design. As many rules as it breaks, the story is interesting enough to keep you scrolling. The question is, how long and how far do you go without getting lost or confused.

The Debris of Attention is designed to show “bad design” with elements that are frustrating and annoying on websites. The gamified design allows you to hover on each element to remove it and clean up the design.

While this site breaks the rules on purpose, it is still an experiment in how long a user will hang on with so many visual effects happening at once.

 

 

Conclusion

While most of the time, people think about “breaking the rules” as a bad thing, that’s not always true in the design space. Sometimes breaking the rules can result in an unexpected delight.

The challenge is to make sure that when you break the rules, the design is still usable, functional, and understandable. If so, you’ve found a winning combination.

Source

p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}

The post 3 Essential Design Trends, August 2021 first appeared on Webdesigner Depot.

The best camera bags and cases in 2021

Original Source: http://feedproxy.google.com/~r/CreativeBloq/~3/6Kxsw70PkjY/best-camera-bags-and-cases

The best camera bags, from backpacks to hard cases.

Pagination: 10 Clever & Unique Examples

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/-9_R7eS8S_A/

Whether it’s a list of blog posts, a photo or video gallery, an image slider, or anything else on a website that has multiple pages, they all have something in common: pagination, or a way to navigate from page to page. While many websites use relatively common layouts and styles for page navigation, this is an area where designers and developers can add some creativity to enhance the user experience. In this post we have compiled 10 CodePen examples of creative page navigation for your inspiration. We hope these will inspire you to try out some new tricks of your own.

Your Designer Toolbox
Unlimited Downloads: 500,000+ Web Templates, Icon Sets, Themes & Design Assets


DOWNLOAD NOW

 

Responsive Flexbox Pagination

See the Pen
Responsive Flexbox Pagination by William H. (@iamjustaman)
on CodePen.0

Swiper

See the Pen
Swiper custom pagination by Pavel Zakharoff (@ncer)
on CodePen.0

Pacman

See the Pen
Pacman pagination by Mikael Ainalem (@ainalem)
on CodePen.0

Yeti Hand

See the Pen
Yeti Hand by Darin (@dsenneff)
on CodePen.0

Gooey

See the Pen
Gooey by Lucas Bebber (@lbebber)
on CodePen.0

Pure CSS3 Responsive Pagination

See the Pen
Pure CSS3 Responsive Pagination by Béla Varga (@netzzwerg)
on CodePen.0

Pagination Buttons

See the Pen
Pagination Buttons by Himalaya Singh (@himalayasingh)
on CodePen.0

AngularJS – Example with logic like Google

See the Pen
AngularJS – Example with logic like Google by Jason Watmore (@cornflourblue)
on CodePen.0

Flexing arrows

See the Pen
Flexing arrows by Hakim El Hattab (@hakimel)
on CodePen.0

Infinite

See the Pen
Infinite by Mariusz Dabrowski (@MarioD)
on CodePen.0

 

How Will You Spice Up Your Pagination?

Did these examples of page navigation give you some ideas? Did they spark your creativity and inspire you to try something different in your next project? Sure, you can stick with the basic, plain old page numbers, but why not kick it up a notch? Let us know if you try something new next time, and be sure to check out some of our other collections of code snippets while you’re at it.


Are There Cryptocurrencies Backed by Gold?

Original Source: https://www.hongkiat.com/blog/cryptocurrencies-backed-by-gold/

Many assets back cryptocurrencies. This diversity is part of what makes them so attractive. However, there’s been a recent surge in cryptocurrencies backed by gold, such as GoldCoin. In this…

Visit hongkiat.com for full content.

Easy Peasy: Lemon Squeezy Makes Selling Digital Products Simple and Affordable

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/Egr_RR3AUsA/

Before we begin, we want to make one thing clear: this is not a sponsored post. We here at 1WD are simply excited about and impressed with this new platform that is a simple and affordable way for anyone to start selling digital products online, so we wanted to help our readers discover this new tool. The people over at Make Lemonade – a small team of makers, creators, movers, and shakers – have done it again, providing us with an easy, fast, and secure way to sell digital downloads, subscriptions, and software licenses. in this article we’re going to take a look at what Lemon Squeezy has to offer.

Overview

The concept is simple: easily create a beautiful “lemonade stand” for your digital products in minutes and start selling online. With pricing plans that range from free to $79 per month, anyone can take advantage of the platform and get started relatively quickly. No hosting fees, plugins, or any of the other hassles that typically come with setting up an e-commerce store. Whether you have one or one thousand products, you can get up and running with minimal elbow grease.

Getting Started

The sign up process is quick and painless. Fill out your name, email, desired store URL, and you’re good to go. Yes, it’s really that simple.

Once signed up, you’re greeted with the following screen:

Welcome screen - Selling digital products on Lemon Squeezy

From here you can add products, set up your account and payment details, and design your new store. It’s pretty simple and intuitive to accomplish each of these items, and no coding knowledge is needed. We only played around with the free version, so we don’t have any details or comparisons to offer details on what might be different about paid plans, but based on the feature differences they list on their pricing page (more below), we are guessing they are pretty similar.

Designing Your Store

The store design features are pretty limited. You’re not going to have a one-of-a-kind, stand out in the crowd lemonade stand, so if that’s a high priority then this may not be the best fit. But if you care more about getting your product(s) online and available for purchase as quickly as possible, then Lemon Squeezy is your answer.

The design capabilities are basically the choice of header image, showing your logo, store description and name, and product details. It looks like the yet-to-be-released “Juicy” plan – at $79 per month – will offer a drag and drop website builder and templates, but that option is not yet available. Still, the minimalist style of a store here is clean, crisp, and user friendly.

Desktop Storefront

Payment Methods

Straight out of the gate, Lemon Squeezy accepts credit cards and PayPal when your customers are paying for products. More payment methods are in the pipeline, but these basic methods make it easy for most users. one important note is that Lemon Squeezy acts as the Merchant of Record, meaning the store owner does not have the burden and legal responsibility of collecting and reporting Tax and EU VAT.

Checkout - selling digital products with Lemon Squeezy

Marketing

One of the features we especially like is the built-in email marketing tools. Your customers and visitors can become email subscribers, which then gives you the ability to reach out to them for future, data-driven campaigns. You can also offer freebies for an email address to grow your mailing list. All of this is built in to the platform, so you don’t have to utilize third-party email platforms like you would in other e-commerce solutions. Unfortunately, the marketing features are currently “coming soon” as of this writing, but whenever they arrive this adds great value to the platform.

Freebie offer - selling digital products with Lemon Squeezy

Reports

Sales, Audience, and Analytics reports are another feature that is showing as “coming soon”. Since this is a common useful element of any e-commerce platform, it is disappointing to see that it has not been offered at launch. In our opinion it may have been wiser to hide these “coming soon” features (along with marketing) until they are actually available.

Sales reports coming soon

Pricing

Compared to other e-commerce platforms, selling your digital products on Lemon Squeezy is extremely affordable. The “Fresh” plan is free and offers many of the same features as paid plans. The biggest difference is in the percentage fee: 8% per transaction vs. 3.5% for the paid plans. The “Sweet” plan is $29 per month and the “Juicy” plan is $79 per month. The most expensive plan is still listed as “coming soon”, but it looks like that plan will include a lot of extra features once it’s available. Both paid plans are even cheaper when you pay annually – they give you 2 months free with this option. Be sure to check out the full features comparison on their pricing page.

Conclusion: Lemon Squeezy Is A Great Way To Start Selling Your Digital Products Online

This exciting new e-commerce platform is impressive, although there are still a lot of features that will be coming soon to it. While it’s nice to see what will eventually be, we’d prefer those unavailable features to be hidden until we can use them. Otherwise, the platform has a lot of potential and lots of reasons to start using it now if you’re in the market for your own…uh…market!

Be sure to check out our other e-commerce related articles here on 1WD while you’re visiting.


Branding for TFCO

Original Source: http://feedproxy.google.com/~r/abduzeedo/~3/xn_TkY9oEO8/branding-tfco

Branding for TFCO
Branding for TFCO

abduzeedo07.29.21

Ted Oliver shared a branding and visual identity project for TFCO. (The Foaming Co.). TFCO developed a self-levelling foamed cellular concrete, an extremely useful solution in the modernization of the Civil Construction sector, ensuring efficiency in the final result of flatness, leveling and adherence, in addition to optimizing construction time and cost. 

Design

The visual identity developed for TFCO has solid forms with a notch in the 30º angle, giving personality and originality to the brand.

The notch symbolizes the shadow projected by the constructions, the stretched letter F, symbolizes the process of applying the cellular concrete to the surface.

black and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motionblack and white brand brand identity branding  concrete construction Engineering  gray logo motion

For more information make sure to check out Ted on 

Behance
Instagram
Website