May 15

React 18 was released in March 2022. Officially, React 18 is now ready to use! This release focuses on performance improvements and updating the rendering engine. React 18 sets the foundation for concurrent rendering APIs that future React features will be built on top of.

In my opinion, the latest feature that revolutionized the React Ecosystem was React Hooks, introduced in React 16.8 back in 2019. Since then, we have seen many versions being released. But without any major changes, what will happen in React 18? In this tutorial, we will have a quick look at the features released in React 18, and explain a few major concepts such as concurrent rendering, automatic batching, and transitions.

New Features

Automatic Batching

React 18 features automatic batching. To understand batching, let’s consider the example of grocery shopping from the same React Working Group discussion.

Let’s say that you are making pasta for dinner. If you were to optimize your grocery trip, you would create a list of all the ingredients that you need to buy, make a trip to the grocery store, and get all your ingredients in one trip. This is batching.

Without batching, you would start cooking, find out you need an ingredient, go to the grocery store and buy the ingredient. When you come back and continue cooking, you’ll find out you need another ingredient, you’ll then go to the grocery store again to buy that ingredient

In React, batching helps to reduce the number of re-renders that happen when a state changes, when you call setState. With this new exciting feature, React will combine multiple setState() calls into a single re-render to improve performance. Before this, if we had multiple setState() inside of a setTimeout(), React will re-render for every state update which sometimes causes performance issues if we have larger components. Previously, React batched state updates in event handlers.

You may already be familiar with this. This feature was available in React 17, but now it comes out of the box.

// React 17
  setTimeout(() => {
    setCount(c => c + 1);
    setFlag(f => !f);
    // The component will be rendered twice.
  }, 1000);
// React 18
  setTimeout(() => {
    setCount(c => c + 1);
    setFlag(f => !f);
    // The component will be rendered only once.
  }, 1000);

Transitions

This new feature lets the dev split the state update into two categories: urgent and low priority.

Transitions can be used to mark UI updates that do not need urgent resources for updating. For some actions, like selecting in a dropdown or updating an input, you want the action to respond immediately, so now we could distinguish between an urgent update and a non-urgent one. These non-urgent updates are called transitions. By marking non-urgent UI updates as “transitions”, React will know which updates to prioritize. This makes it easier to optimize rendering and get rid of stale rendering.

Updates wrapped in startTransition are handled as non-urgent and will be interrupted if more urgent updates like clicks or keypresses come in.

import { startTransition } from 'react';

// Updating state with urgent priority
setInputValue(input);

// Inside startTransition the updates won't be urgent
// and can be interrupted
startTransition(() => {
  setSearchQuery(input);
});

New Suspense Features

Finally, we will have Suspense on the server. In the server-rendered apps, we will have only one Suspense API.

In a client-rendered app, you load the HTML of your page from the server along with all the JavaScript that is needed to run the page and make it interactive.

If, however, the JavaScript bundle is huge, or you have a slow connection, this process can take a long time and the user will be waiting for the page to become interactive, or to see meaningful content. For optimizing the user experience and avoiding the user having to sit on a blank screen, we can use server rendering.

Server rendering is a technique where you render the HTML output of your React components on the server and send HTML from the server. This lets the user view some UI while JS bundles are loading and before the app becomes interactive. Server rendering further enhances the user experience of loading the page and reducing the time to interact.

Before React 18, this part was often the bottleneck of the app and would increase the time it took to render the component. Now React 18 adds support for Suspense on the server. With the help of suspense, you can wrap a slow part of your app within the Suspense component, telling React to delay the loading of the slow component. This can also be used to specify a loading state that can be shown while it’s loading.

Strict mode

Strict mode in React 18 will simulate mounting, unmounting, and re-mounting the component with a previous state. This sets the ground for a reusable state in the future where React can immediately mount a previous screen by remounting trees using the same component state before unmounting.

Strict mode will ensure components are resilient to the effects of being mounted and unmounted multiple times.

IE11 no longer supported

IE11 is no longer supported since React 18. If your app needs to continue bringing support to IE11, you will need to stay at React 17. x.

Conclusion

Some cool features like Automatic Batching or Adding Suspense should improve the performance of React in the latest release. I’m really excited to see how these new features will perform in a real-life app, but they look more than promising. In a summary, React 18 sets the foundation for future releases and focuses on improving the user experience.

Upgrading to React 18 should be straightforward and your existing code should not break after the update. The upgrade process should not take more than an afternoon.

Tags:

May 01

Google Play is officially launching its own version of privacy-related “nutrition labels” for apps. They are introducing a new section in Play Store listings that requires developers to describe the data their app gathers and how they will use it. This will be like a privacy label giving users crucial information at a glance, which should be enough to help them decide if they would like to proceed with the installation.

According to Google, users want to understand the purpose of the apps to collect their data and whether the developer is sharing it with third parties, as well as how developers protect that data. The new section is titled ‘Data safety’ and will appear alongside the usual sections like ‘About this app’ and ‘Ratings and reviews’. It will function as a privacy label, providing users with key information shortly, which should be enough to let them decide whether or not to install the app. Not only will developers declare what data they collect, but also what data they share with third parties, essentially disclosing the purpose behind the collection. Google showed off its version last year but is only beginning to roll it out this week. According to them, it will begin to roll out the new Google Play Data safety section to users on a gradual basis so that Android users won’t see this new section immediately but over the next couple of weeks.

Suzanne Frey, Vice President of Product, Android Security, and Privacy at Google said in a blog post, “You alone are responsible for making complete and accurate declarations in your app’s store listing on Google Play,”

Failure to do so would lead to policy violations, leading to the suspension of the app in the Google Play Store.

“Google Play reviews apps across all policy requirements; however, we cannot make determinations on behalf of the developers of how they handle user data. Only you possess all the information required to complete the Data safety form”. “When Google becomes aware of a discrepancy between your app behavior and your declaration, we may take appropriate action, including enforcement action,” explained Frey.

If the user wants to learn more about a particular entry, tapping on the corresponding item will collapse the menu to reveal more information on what is collected or shared. The third pillar of the Data Safety section will be the app’s security practices, which describe the security mechanisms employed to protect the collected data, like the MASVS standard. This third section also clarifies whether users are given the option to ask for the deletion of their data at any time. And finally, Data Safety will specify if the app follows Google Play Families Policy, which is geared toward children’s protection.

Developers can begin declaring how collected data is used starting today, with the deadline to complete their submissions being July 20th, 2022.

Google told that developers would provide this information themselves, which Google will not confirm. However, if it is discovered that a developer has misrepresented their data use disclosures, they will be required to fix the provided information. Google is essentially relying on developers, to be honest in the information they provide to users in this section.

While Google’s move is beneficial to Android users, a similar feature called ‘Privacy Nutrition Labels’ was already introduced by Apple in 2020. Apple also released a similar feature as part of numerous privacy-enhancing features in last year’s iOS 14. This is another case where competition in the mobile OS space has brought positive developments, giving users more insight and control over how their data are handled by the various software that runs on their smartphones.

While both sets of labels focus on informing users about how apps collect and manage data and user privacy, there are some key differences. Apple’s labels largely focus on what data is being collected, including data used for tracking purposes, and on informing the user what’s linked to them. Google’s labels, meanwhile, put a bigger focus on whether you can trust the data that’s collected is being handled responsibly by allowing developers to disclose if they follow best practices around data security. The labels also give Android developers a way to make their case as to why they collect the data directly on the label, so users can understand how the data is used — for app functionality, personalization, etc. — to help inform the user’s decision to download the app. They can also see if the data collection is required or optional.

Up until now, Android apps on the Play Store had to list a link to their Privacy Policy under the “Additional Information” section and provide a contact email. Since this privacy policy is hosted on an external location, it’s subject to modifications, might be vague, may not disclose all the crucial details about data collection and protection, and may even lead to a broken link.

This Data Safety gives users a clear understanding of what happens with their data without requiring them to spend time digging into sections, while it also empowers Google with enforcement. Moreover, since reading large texts of legal jargon isn’t exactly what users look forward to when browsing the Google Play Store for new apps, almost nobody checks these.

App privacy labels have already been accused of being an unreliable source of information following their launch on the App Store. According to a report by The Washington Post last year, many of the labels they reviewed in a spot-check provided false information. For instance, apps claiming they collected no data were actually found to be doing the opposite — collecting it and sharing it. Google is confident about the step it is taking and also claims to be honest about this Data Safety feature they are bringing.

With a large number of scam apps, malware, and usury apps found on Google Play, this new Data Safety section will not only be useful for Android users but also allow Google to find policy violators more quickly. For more information on the new system, what it includes, and how it works, check out Google’s support page.

Tags: , ,

Apr 30

Two years after Epic Games revealed Unreal Engine 5 with a gorgeous tech demo, the next-gen game engine is officially available, Epic Games announced on Tuesday. The latest edition of the benchmark game development engine touts a new “fully dynamic global illumination” tool, plus a geometry system that allows creators to build games with “massive amounts of geometric detail.” After being available in Early Access since May 2021 and Preview since February 2022, Epic Games has now released Unreal Engine 5 which will no doubt go on to power some of the biggest upcoming releases.

Epic announced Unreal Engine 5’s launch with a Twitch and YouTube live stream showing high-performance visuals and real-time rendering. Unreal Engine 5 will also use a new World Partition system that, Epic says, “changes how levels are managed and streamed,” by dividing up the game world into a grid and streaming only its necessary cells.

Unreal Engine 5 is Epic’s latest in the line of game engines available to game developers big and small. While the release of a new game engine isn’t typically news that excites folks until video games start getting made with them, Epic first revealed Unreal Engine 5 with a blockbuster tech demo Called Lumen in the Land of Nanite, the tech demo was made to specifically demonstrate two of the marquis features of Unreal Engine 5. Lumen is a dynamic illumination tool where the light adapts to the world naturally and easily.

“With this release, we aim to empower both large and small teams to really push the boundaries of what’s possible, visually and interactively. UE5 will enable you to realize next-generation real-time 3D content and experiences with greater freedom, fidelity, and flexibility than ever before.” — Epic Games.

Epic also said that developers would be able to continue using “workflows supported in UE 4.27” but get access to the redesigned Unreal Editor, better performance, improved path tracing, and the list goes on.

A “preview” version of Unreal Engine 5 has been available for a while now, but on Tuesday it officially took Unreal Engine 4’s place as the current Unreal version: Unreal Engine 5 is out now. We can expect new Unreal-based games to use the latest engine, as well as many in-progress games, such as Stalker 2, the next Tomb Raider (also announced that day), and games from developers such as Remedy, Obsidian, and Ninja Theory. The video embedded above is a new UE5 tech demo compilation from Gears of War studio The Coalition.

Two new starter samples have also been made for developers: Lyra Starter Game, City Sample

Lyra Starter Game

Lyra Starter Game is a sample gameplay project built alongside Unreal Engine 5 development to serve as an excellent starting point for creating new games, as well as a hands-on learning resource. We plan to continue to upgrade this living project with future releases to demonstrate our latest best practices.

City Sample

The City Sample is a free downloadable sample project that reveals how the city scene from The Matrix Awakens: An Unreal Engine 5 Experience was built. The project—which consists of a complete city with buildings, vehicles, and crowds of MetaHuman characters—demonstrates how we used new and improved systems in Unreal Engine 5 to create the experience.

You will also find plenty of Linux and Vulkan improvements for Unreal Engine 5 including: Nanite and Lumen (with software ray tracing only) on Linux, the Unreal Build Tool was also upgraded to support Clang’s sanitizers for Linux (and Android), Vulkan and Linux support was also added to their “GameplayMediaEncoder”, compliant 64-bit image atomics in Vulkan that fixes all validation issues with 64-bit atomics and allows the use of RADV driver (AMD + Linux) for Nanite and Lumen, multiple crashes were solved for Linux. There are some features specific to open-world games, too, which may be useful for CD Projekt Red’s new Witcher game; the studio announced last month that it’s switching to Unreal Engine 5. One of those features is World Partition, which handles the on-the-fly loading and unloading of open worlds as players move through them. Adoption of UE5 will mean different things for different studios, but the big themes are workflow streamlining and high-fidelity geometry and lighting. The 2020 Unreal Engine 5 reveals video leads with its new “micro polygon geometry system,” Nanite, and its “global illumination solution,” Lumen. With Nanite and Lumen, Epic says that developers can import film-quality 3D assets with “massive amounts of geometric detail” and set up dynamic lights without worrying about certain complex technical steps, especially those to do with optimization. The engine handles the ‘making it run on our PCs’ part, or at least more of it.

UE5 also includes new modeling and animation tools, “a fundamentally new way of making audio,” and other features meant to simplify the work of game development and keep as much of it as possible in the Unreal Engine development environment. In fact, using Epic’s Quixel Megascans (super detailed environment models) and MetaHumans (realistic, customizable human models), which are free to use in Unreal Engine projects, you can make a playable game without ever minimizing the UE5 dev kit.

Another interesting fact about Unreal Engine 5 is, like the previous version, Unreal Engine 5 is free to download and use; Epic doesn’t collect royalties on indie games until they’ve earned over $1 million in revenue. It is now available on the Epic Games launcher. If you already had the UE5 preview version installed, it’s about a 5 GB update.

Tags: ,

Nov 07

Last week, Browserling, world’s leading cross-browser testing company, announced that they’re launching a network of online developer tools that offer simple, free and easy to use utilities for programmers.

They’re starting with four sites in the network and will be expanding their network to thirty websites. Each site in their network covers one specific programming category. There are no ads, popups, blinking download buttons, or other garbage. Just useful utilities that work in your browser. All utilities are created by skilled software engineers and they just do the right thing.

Let’s review first four sites in the network.

#1 Online JSON Tools


Online JSON Tools for Programmers
Online JSON Tools

Online JSON Tools is the first website in Browserling’s online tools network. It’s all about working with JSON data structures and objects. You can perform all the most common operations, such as minify JSON, beautify JSON, validate JSON, escape and unescape JSON, convert JSON to XML, CSV, TSV, and YAML, and encode/decode JSON to/from base64 encoding.

Soon you’ll also be able to syntax highlight JSON and edit it in your browser, display a summary of JSON object statistics, flatten JSON objects, convert JSON to HTML tables and LaTeX tables, compare two JSON structures, and encode and decode JSON to and from percent-encoding.

#2 Online String Tools


Online String Tools for Programmers
Online STRING Tools

Online String Tools is the second and the largest website in Browserling’s online tools network. It’s all about working with strings. There are over 100 tools in this website and many more are getting added every week. Online String Tools allow you to encode, decode, convert, filter, replace, and generate strings right in your browser.

For example, you can URL-encode and URL-decode strings, HTML-encode and HTML-decode strings, base64-encode and base64-decode strings, slash-escape and slash-unescape strings, generate random strings and generate strings from regular expressions. You can split strings, join strings, convert strings to binary and ASCII codes. And much more.

The upcoming tools in Online String Tools website will be a multi-replace string tool that allows you to replace multiple strings at once, online diffing tool that will show changes between two strings, Levenshtein distance calculator, which will also let you view the distance visually, a string rewriting system, Zalgo string generator, and a string typo generator.

#3 Online CSV Tools


Online CSV Tools for Programmers
Online CSV Tools

Online CSV Tools is all about working with Comma Separated Values (CSV) files and data. It currently offers over 20 CSV tools. You can convert CSV to JSON, XML, TSV, and YAML. Encode and decode CSV to and from base64 encoding, and perform various row and column operations, such as swap CSV rows, replace, append, insert, and delete CSV columns and transpose CSV.

Here’s a list of CSV tools that Browserling has planned adding in the next few months. You’ll be able to convert CSV to a PDF document and HTML, Excel, and LaTeX tables, then create images of CSV data, generate SQL queries from CSV files, merge CSV files, change quoting of CSV fields, delete empty CSV rows and columns, minify CSV and also diff two CSV files to find differences.

#4 Online XML Tools


Online XML Tools for Programmers
Online XML Tools

Online XML Tools is a collection of useful XML utilities for working with Extensible Markup Language documents and data structures. You can beautify XML, minify XML, escape and unescape XML, validate XML, and convert XML to various other data formats, such as JSON, CSV, YAML and XML. You can also encode and decode XML that’s been stored in base64 encoding.

Some of the upcoming tools in XML tools collection will be XML syntax highlighter and XML editor, then you’ll be able to view XML document statistics, and compare two XML files for visual differences.

#5 And beyond

Browserling is adding 25 or more sites to their network in the next 2-3 years. Here’s a list of upcoming sites:

  • Online TSV (Tab Separated Values) Tools
  • Online YAML (Yet Another Markup Language) Tools
  • Online PDF Tools
  • Online IMAGE Tools
  • Online AUDIO Tools
  • Online BROWSER Tools
  • Online CSS Tools
  • Online JS (JavaScript) Tools
  • Online CRYPTO Tools
  • Online RANDOM Tools
  • Online FILE Tools
  • Online TIME Tools
  • … and many more!

If you love what Browserling is doing you can follow @browserling on Twitter or follow Browserling on Facebook.

Jul 17

Microsoft Popfly is a set of online visual tools for novice programmers and end-users to build Web pages, applications and games.  This was Microsoft’s attempt to bring programming to the masses, similar to Hypercard on the Macintosh, or the original Visual Basic on Windows before it became a real (complicated) object-oriented language under .NET.

But this fly lived for only two years.  Microsoft has just announced that on August 24, 2009, the Popfly service will be discontinued and all sites, references, and resources will be taken down.  At that time, access to your Popfly account, including any games and mashups that you have created, will be discontinued.

Continue reading »

Apr 15

Grok2 has highlighted an old but excellent essay about why computer programming is fun.  This quote is from one of our industry’s groundbreaking books, The Mythical Man-Month by Frederick P. Brooks, Jr.  First published in 1974, the book posited the computer law that “adding programmers to a late project makes it later.” 

Brooks’ innocent but insightful comments about his delight in programming the green-screen dumb-terminal IBM OS/360 is even more relevant in today’s world of high-resolution dynamic graphical displays and the global reach of Web applications.  The players have changed, the technology has certainly changed, but the joy of computer programming endures.

Continue reading »

Feb 05

You know it’s time to find a new job when your boss buys you one of these chairs:

Continue reading »

Jan 14

Experts from more than 30 U.S. and international cyber-security organizations jointly released a consensus list of the 25 most dangerous programming errors that lead to security bugs and cyber-crime.

The impact of these programming errors is significant.  Just two of these errors resulted in more than 1.5 million website security breaches during 2008.  These breaches allowed malicious software to take control of the computers that visited those web sites, turning their computers into zombies that committed further cyber-crimes.

Shockingly, most programmers do not understand or look for these errors.  Colleges rarely teach programming students how to avoid these errors.  And most software companies don’t explicitly test for these errors before releasing their products.

Continue reading »

Jul 17

A creed is a statement of belief or faith often recited as part of a religious service or organizational gathering.  The word “creed” derives from the Latin credo (I believe) or credimus (we believe).  Perhaps the oldest is Apostle’s Creed cited in Christianity.  However, the Rifleman’s Creed is arguably the most famous, made popular by the Stanley Kubrick war movie “Full Metal Jacket” (warning: language).  This has inspired me (with tongue planted firmly in cheek) to write a creed for our noble profession of software development.

Continue reading »

May 07

It’s widely accepted in the software industry that some programmers are much more productive than others. Many experts cite an order-of-magnitude productivity difference between the “best” and “average” programmers.

Continue reading »

Tags: