DevOps Services Pricing: AWS vs Azure vs Google Cloud

Cloud computing has rapidly become a strong driving factor for companies worldwide, as software is transferred out of in-house data centers in an effort to modernize, reduce costs, and boost agility. Businesses more and more use it as an all-in-one solution, a model in which a third-party supplier comprises and manages a customer’s fundamental infrastructure.

Among the most used and popular DevOps services, namely Amazon Web Services, Azure DevOps services, and Google Cloud services, there is a battle going on in the market. Based on Statista analytics, Amazon Web Services, the most prominent provider in the cloud computing industry, held 32% of the total market in the 3rd quarter of 2021. Microsoft Azure comes in 2nd place with a 21% market share, followed by Google Cloud with an 8%. Therefore, in the 3rd quarter of 2021, these three cloud suppliers are undoubtedly leading within the statistics.

Ask the Bartender: Should I Use a Page Builder or Wait for Block Themes?

As a non-developer, I honestly don’t know what direction to take my WordPress site anymore.

I used to rely on themes and even bought some premium ones, but over time, I’d outgrow them. As an artist myself, I prefer having control over every aspect of my website, from its layout, colors, to its fonts. Thus, I turned to page builders.

I tried Elementor Pro, but it was frustrating how it was so difficult to create more advanced layouts without exponentially increasing the DOM size of the page. I had to install several Elementor plugins just to get the job done, but then it also made the site slower. Elementor would also often conflict with Gutenberg block styles since I used the block editor for writing posts.

There’s Oxygen, which I’ve heard great reviews of, but its learning curve is too much for me. I also couldn’t get used to themes being completely disabled, as I relied heavily on child themes, knowing a bit of CSS.

Now, there’s this whole Gutenberg uprising. FSE is the future, but I cannot adapt at all. Not to mention that there aren’t that many FSE themes out there yet.

I feel like I’m stuck between a rock and a hard place. I don’t know if I should take the theme route, the page builder route, or the Gutenberg route. If I take either of the first two, I fear they may become obsolete or incompatible in future versions of WordPress as Gutenberg is further developed. And if I take the Gutenberg route right now, I don’t really have much options yet. As it is, Gutenberg doesn’t seem to have any built-in ways of displaying custom meta fields like those from ACF. I don’t want to turn to another premium plugin for it, either.

How much longer is Gutenberg’s development going to take before ordinary but semi-advanced users like me can actually make use of it? What’s actually the best route to take in WordPress right now, a time when a lot of groundbreaking changes are constantly being rolled out?

Isabel

Before diving too deep into this, I want to clarify some terminology for readers. Some of the above uses of “Gutenberg” refer to site editing, a feature landing in the January release of WordPress 5.9. However, to use the site editor, users will need to activate a block theme. Currently, there are not many to choose from simply because this technology is under development.

You are not alone in wondering when we will move beyond what is a seemingly never-ending transitional phase. We are only now getting to some of the features touted three or four years ago when I was a full-time theme author. I am neck-deep in the development side of all this daily, so I can only imagine what it is like for non-developers.

The question is tough to answer without a hyper-specific use case. And, the right solution for one person will not always be ideal for another. There are questions of time, resources, budget, etc.

I only like the page-builder route if you are crunched for time and have a business riding on this. In the short term, Elementor and others make a lot of sense for getting something up and running fast while also giving you design freedom, assuming you have gotten past the learning curve. If this is the case, there is nothing wrong with going in this direction. I do not see builders disappearing anytime soon.

Finding an ideal theme can take a lot of searching. Typically, I recommend end-users look for a design that matches at least the overall layout that they want. Colors, fonts, and other stylistic pieces of it are generally easy to change. The average theme nowadays has options for essentially “skinning” the website.

The second part of this is whether you only want control over the global design or if you want to customize the layout for the inner pages of the site too. For the latter, you need something that supports the current WordPress features.

If you are looking for something sooner rather than later, I would go with a theme that supports block editor styles, bundles several custom patterns, and includes a “blank canvas” template for building landing pages. This route gives you something that is forward-looking but does not rely on third-party builders. Many of these theme authors are already preparing for or building block themes for WordPress 5.9 and beyond.

I am partial to the Eksell theme by Anders Norén. He also has a block theme named Tove that is more flexible.

Eksell WordPress theme home/portfolio page.
Eksell theme homepage.

Be skeptical of themes that only have block editor styles. I have seen enough that only add some custom CSS for a few blocks and call it a day. It is nothing more than another bullet point for their marketing material.

If you can afford to wait a couple of months, you should keep an eye on the upcoming Twenty Twenty-Two theme. It is one of the most beautifully-designed default themes I have seen, but it also has a ton of room for customization. Currently, it has over 60 custom patterns, so that gives you a lot of layout options. I expect this block theme to set the bar that all others must rise to.

A group of six screenshots of the Twenty Twenty-Two WordPress theme with different colors and font combinations.
Twenty Twenty-Two color and font variations.

There is one area where page builders excel in comparison to WordPress at the moment. And that is with horizontal layouts. When creating flexible columns or grids for all screen sizes, the block editor falls short. While the block system’s tools have improved, this gap will not close for a while.

I mentioned patterns being one of the primary components more than once. If a theme offers a solid set of block patterns that focus on layout variations, piecing together a site can sometimes be as easy as pointing and clicking the mouse.

If you need to do some heavy work with layout, there are several block-based grid plugins. When I have needed such a tool, I have almost exclusively relied on the Layout Grid Block by Automattic. It performs this one job and does it well. The plugin bridges the gap between page builders and the block editor when coupled with a well-designed theme.

Everything comes down to timing. You don’t want to build your site on top of one system only to recreate the entire thing from scratch six months from now. For that reason alone, I would forego page builders altogether, except where time is limited. Give block themes like the upcoming Twenty Twenty-Two some time to come into their own.

Automate Data Transformation Using IBM App Connect

IBM App Connect has introduced a new Artificial Intelligence (AI) feature that is capable of auto-generating data transformation expressions, and that helps accelerate your integration flow-building experience.

Data Mapping remains a fundamental part of integration development, but it takes time. An increasing number of applications, lack of naming standards, and nested field structures further compound the complexity for the integration developers. Once the mapping is done, data transformation is the next challenge for the users since each application expects data to be in a certain format.  Also, while building integration flow, developers need to understand the format of the source and target data field and come up with transformation expressions that can change data from source to target format. This exercise is done manually and it takes a lot of time and skills to build such transformation expression.

Cordova: Communicating Between JavaScript and Java

Background

Cordova is an open-source cross-platform development framework that allows you to use HTML and JavaScript to develop apps across multiple platforms, such as Android and iOS. So how exactly does Cordova enable apps to run on different platforms and implement the functions? The abundant plugins in Cordova are the main reason, and free you to focus solely on app functions, without having to interact with the APIs at the OS level. 

Introduction

Here, I'll use the Cordova plugin in HUAWEI Push Kit as an example to demonstrate how to call Java APIs in JavaScript through JavaScript-Java messaging. The following implementation principles can be applied to all other kits, except for Map Kit and Ads Kit (which will be detailed later), and help you master troubleshooting solutions.

Vicious (Test) Mockery of a Perl Modulino

Over the past two years, I've gotten back into playing Dungeons & Dragons, the famous tabletop fantasy role-playing game. As a software developer and musician, one of my favorite character classes to play is the bard, a magical and inspiring performer or wordsmith. The list of basic bardic spells includes Vicious Mockery, enchanting verbal barbs that have the power to psychically damage and disadvantage an opponent even if they don't understand the words. (Can you see why this is so appealing to a coder?)

Mocking has a role to play in software testing as well, in the form of mock objects that simulate parts of a system that are too brittle, too slow, too complicated, or otherwise too finicky to use in reality. They enable discrete unit testing without relying on dependencies external to the code being tested. Mocks are great for databases, web services, or other network resources where the goal is to test what you wrote, not what's out in "the cloud" somewhere.

2 Ways to Make a UUID Generator for Postgres

Postgres performs better than some other databases because it supports concurrent write operations without the need of read/write locks. Because it is completely ACID-compliant and provides transaction isolation and snapshots, many applications are using Postgres these days. Unfortunately, while PostgreSQL is great for storing and comparing UUID data, it lacks capabilities for creating UUID values in its core. Instead, it relies on third-party modules to create UUIDs using specified techniques. In this article, you'll learn about the PostgreSQL UUID data type and how to generate UUID values with examples utilizing various functions and modules.

What Is a UUID?

UUID stands for Universal Unique Identifier, defined by RFC 4122 and other related standards. A UUID is a series of lower-case hexadecimal digits separated by hyphens. UUIDs are a combination of 36-character sequences of numbers, letters, and dashes that are intended to be globally unique.

ACF Solicits Lifetime License Holders for Contributions, Urging Them to Purchase Annual Subscriptions

The Advanced Custom Fields (ACF) marketing team at Delicious Brains kicked up a sandstorm over the weekend after it emailed its lifetime license holders, asking them to consider signing up for a discounted subscription. Despite Delicious Brains’ explicit promise that they would never be required to pay for ACF updates in the future, the sales email insinuates that the development team is in need of appreciation in the form of annual paid subscriptions:

I know you already have a lifetime license for ACF Pro, but I’m hoping you’ll consider signing up for a discounted subscription to support our ongoing work in continuing to improve Advanced Custom Fields.

We’ve shipped two major releases (5.10 and 5.11) since we took over development of the plugin from Elliot in June, including a full-featured REST API! If you’re a fan of the work we’ve done so far, nothing will show our developers that you appreciate them more than signing up for an ACF Pro subscription, especially since you already have a lifetime license.

This bewildering pitch to lifetime license holders landed in email boxes on the Friday after Thanksgiving in the US. It drew more attention after Paul Charlton, creator of WPTuts, tweeted a screenshot of the email, saying it left “a really bad taste” in his mouth. Charlton also recorded a reaction video that succinctly articulates why the email was so irksome to many lifetime license customers. He suggested Delicious Brains instead take the approach of offering a discount on their other subscription products.

“If you’re going to broach the topic of asking lifetime subscribers to suddenly pay for $250/year for the same product, I would just think that something, anything, could be offered,” one lifetime license holder said.

Some lifetime license holders found the email pitch was especially perplexing after the confusing messaging when Delicious Brains acquired ACF. A hasty response to a customer inquiry caused lifetime license holders to question if the company would continue honoring the agreement after the acquisition.

“Lifetime license holders will get all ACF Pro software updates forever,” Delicious Brains founder and CEO Brad Touesnard said at the time. “They won’t be required to pay for version 6.0 or any other major or minor releases in the future. They signed up for updates for life, so we’ll continue to deliver on that promise forever.”

Some lifetime license holders tried to read between the lines of the recent sales emails and wondered if Delicious Brains was signaling an end to its commitment.

“What happened to our lifetime licenses being honored and we would get full and continued updates for life?” Brian J McCracken said in response to the email. “They haven’t said they aren’t doing that but talk about skirting the intention with this guilt trip.” Others are also skeptical, speculating that Delicious Brains may repurpose the code for a new product so they can “kill off the LTD’s once and for all.”

“I honestly believe they WANT the LTD owners to leave,” WordPress developer Wendell Harness said. “Think about it — they won’t have to support us anymore. An email like this may garner a few buy-ins while also wiping away a bunch of people they no longer want to support. It’s brilliant. Rude, but still brilliant.”

Those on the other side of the argument disagree with the notion that lifetime license holders should expect updates indefinitely.

“You paid a hundred bucks or so 5 years ago and you expect a company to keep adding value to your business that could have been generating hundred of thousands of dollars in revenue,” 10up WordPress engineer Clayton Collie said in response to critics of the email. “They could abandon the project. How would you feel about that?”

After the sales email created new confusion on the status of lifetime licenses, ACF tweeted to reaffirm their commitment to honor them, but many recipients had already formed their own conclusions about the intent of the email.

“We’ve heard from many lifetime customers who are happy with the work we’ve already been doing to improve ACF and glad to contribute by subscribing,” Touesnard said in response to customers who suggested the company offer something in return for signing up to a new annual subscription. “If you don’t feel the way they do, that’s fine, you aren’t required to subscribe.”

The heated conversations have renewed the controversial topic of selling lifetime licenses in the WordPress product space. Few have done this successfully long term, and it gets trickier when a company is acquired.

“I see both sides for this – as someone who bought a lifetime ACF license 7 years ago and also a plugin dev,” Amber Hinds said. “Really lifetime licenses should be offered with extreme caution.”

In many cases, when early adopters purchase a lifetime license, they are usually paying much more than the regular license, for an unproven product that isn’t guaranteed a future. This gives newer products the money they need to build momentum but also offers something in return. It’s a transaction where each participant extracts some value and assumes a share of the risk.

In this particular scenario, ACF appears to be mistaking its relationship with lifetime license holders as something more akin to investors or donors. Customers who purchase lifetime licenses rarely share those same motivations.

It’s quite unusual for a Black Friday sales email to ask for contributions for a product consumers have already paid for long ago. This unorthodox sales approach and timing was off-putting to many of the recipients. Was it worth upsetting a slew of customers who are not bringing ACF any money for the rest of its life as a product? Only the Delicious Brains team knows how successful the campaign has been so far. When asked if the email is generating new signups from lifetime license customers, Touesnard said the developer who pulls that report was not currently available.

“Does a company that spans across five very popular products require a donation approach, to keep a product like ACF, afloat?” WordPress business podcaster Matt Medeiros said in a post titled “WordPress, the multi-billion dollar software industry that has us begging for money.”

“If so, we better start getting better at pricing and voting with our dollars,” he said.

“Either way, expecting lifetime updates for one price, coupled with a part-time donation strategy, is bad for both the consumer and the business. I don’t see any other major markets operating this way.”

Artificial Intelligence Vs Software Engineering: What Is the Difference?

Artificial Intelligence vs. Software Engineering

While Artificial intelligence (AI) and Software Engineering are two major branches of computer sciences, experts and professionals have consistently acknowledged their differences and the roles they both play in the advancements of computer efficiency generally. However, while there are differences between the two fields, people have difficulty telling where they differ. Therefore, this blog will outline the differences between AI and Software Engineering to help you know the varying metrics. 

Difference Between Software Engineering and Artificial Intelligence

Definitions and Expected Outcomes

The biggest difference between software engineering and Artificial intelligence is their outcomes and the tasks they set out to achieve.

Android Native – How to set Dark Theme

Introduction

With OLED screens becoming more and more common on smartphones, adapting a dark theme to your app can provide a boost to battery life.

In this tutorial, we will learn how to add a dark theme to your native Android app.

Goals

At the end of the tutorial, you would have learned:

  1. How to modify the dark theme.
  2. How to switch themes programmatically.
Tools Required
  1. Android Studio. The version used in this tutorial is Arctic Fox 2020.3.1 Patch 3.
Prerequisite Knowledge
  1. Basic Android.
Project Setup

To follow along with the tutorial, perform the steps below:

  1. Create a new Android project with the default Empty Activity.

  2. Extract the Hello World! String resource to the strings.xml file, so res/values/strings.xml should have

     <string name="hello_world">Hello World!</string>
MODE_NIGHT Flags

The first concept that we need to understand are the MODE_NIGHT flags.

Inside of the androidx.appcompat.app.AppCompatDelegate class, there are a few constants prefixed with MODE_NIGHT, with each representing a flag that determines how your app switches to the dark theme.

  1. MODE_NIGHT_AUTO: Deprecated. Replaced by MODE_NIGHT_AUTO_TIME.
  2. MODE_NIGHT_AUTO_BATTERY: Night mode switches on when Battery Saver is enabled.
  3. MODE_NIGHT_AUTO_TIME: Night mode switches on/off depending on the time of day.
  4. MODE_NIGHT_FOLLOW_SYSTEM: Follow the System settings. For example, on my phone (Android 12), this setting can be found at Settings > Display > Appearance > Dark Theme.
  5. MODE_NIGHT_NO: Night mode is switched off.
  6. MODE_NIGHT_UNSPECIFIED: Mostly used with setLocalNightMode() to override the default night mode.
  7. MODE_NIGHT_YES: Night mode is turned on.

While it is possible to set these flags programmatically, the Android OS can also control them based on user settings. It is not a requirement to interact with these constants if you just want your app to follow the System settings because your app uses MODE_NIGHT_FOLLOW_SYSTEM by default.

DayNight themes

The second concept that we need to be familiar with is the DayNight themes. To support Dark themes, your App theme must extend Theme.AppCompat.DayNight or Theme.MaterialComponents.DayNight.

Theme.AppCompat.DayNight comes from the androidx.appcompat library, while Theme.MaterialComponents.DayNight comes from the com.google.android.material library.

For this tutorial, the App themes are located under res/values/themes(Android view).

themes.png

You will also find another theme file that has the word night in parentheses under res/values/themes. There is no such directory named themes in your project, Android Studio automatically groups the theme XML files together in Android view to make the project navigation easy to understand. If you switch back to the Project view, you can see that there are only the values directory and the values-night directory.

values.png

night is a legal configuration qualifier name based on this table.

Provide resources for Dark theme

If you want your app to use MODE_NIGHT_FOLLOW_SYSTEM, then there is no coding required at all. The two most basic steps that you need to take are:

  1. Have your App theme extend a DayNight theme (explained in the previous section).
  2. Provide the Dark theme resources inside a values-night directory.

The Empty Activity project created by Android Studio already has Dark theme support.

  1. Switch to Android view.

  2. Navigate to res/values/themes.

  3. Open themes.xml.

  4. You can see the DayNight theme extended by your App theme here.

     parent="Theme.MaterialComponents.DayNight.DarkActionBar"

The project also provided the resources for the Dark theme with the values-night qualifier.

  1. Still under res/values/themes, open themes.xml (night).
  2. The style name and the parent theme are also exactly the same as the regular theme. There are only a couple of tags with different values. The values in the night version will be used when the Dark theme is turned on.

compare.png

  1. In res/values/colors.xml, add a new color called blue with the code #0027FF.

     <color name="blue">#0027FF</color>
  2. We can modify the Dark theme directly. Open the night themes.xml file.

  3. Add a new attribute with the name android:colorBackground and set the value to the blue color that we defined earlier.

     <item name="android:colorBackground">@color/blue</item>
  4. Open activity_main.xml in the Design surface.

  5. Switches to Night mode by pressing the keyboard shortcut N or select the Moon icon located in the Toolbar. This feature allows us to preview the night theme without running the App.

preview.png

Please note that I am using blue for simplicity only. Real world applications should follow Color and Accessibility guidelines from the design language documentation(Material, Apple HIG, Adobe Spectrum, etc).

Set Dark theme programmatically

It is also possible to set the Night mode programmatically. We just have to call the static function setDefaultNightMode() from the AppCompatDelegate class.

  1. In MainActivity.kt, replace the current onCreate() function with the code below.

     override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES)
     }
  2. Normally, you should allow your users to switch the theme with a Switch, but for simplicity, we are just turning the Dark mode on when the App first launches.

Run the app and we will see that it now uses (customized) Dark mode.

blue_app.png

Solution Code

MainActivity.kt

package com.example.daniwebdarktheme

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES

class MainActivity : AppCompatActivity() {
   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)
       AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES)
   }
}

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <color name="purple_200">#FFBB86FC</color>
   <color name="purple_500">#FF6200EE</color>
   <color name="purple_700">#FF3700B3</color>
   <color name="teal_200">#FF03DAC5</color>
   <color name="teal_700">#FF018786</color>
   <color name="black">#FF000000</color>
   <color name="white">#FFFFFFFF</color>
   <color name="blue">#0027FF</color>
</resources>

strings.xml

<resources>
   <string name="app_name">Daniweb Dark Theme</string>
   <string name="hello_world">Hello World!</string>
</resources>

night/themes.xml

<resources xmlns:tools="http://schemas.android.com/tools">
   <!-- Base application theme. -->
   <style name="Theme.DaniwebDarkTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
       <!-- Primary brand color. -->
       <item name="colorPrimary">@color/purple_200</item>
       <item name="colorPrimaryVariant">@color/purple_700</item>
       <item name="colorOnPrimary">@color/black</item>
       <!-- Secondary brand color. -->
       <item name="colorSecondary">@color/teal_200</item>
       <item name="colorSecondaryVariant">@color/teal_200</item>
       <item name="colorOnSecondary">@color/black</item>
       <!-- Status bar color. -->
       <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
       <!-- Customize your theme here. -->
       <item name="android:colorBackground">@color/blue</item>
   </style>
</resources>
Summary

We have learned how to modify the dark theme and various ways to switch on the dark mode. The full project code can be found here: https://github.com/dmitrilc/DaniwebDarkTheme

Android Native – How to apply textAppearance

Introduction

All TextView objects have a special attribute called textAppearance. This attribute can be used to set the style for text content in a TextView without affecting other styling attributes on the same TextView object.

In this tutorial, we will learn how to apply textAppearance to TextView objects.

Goals

At the end of the tutorial, you would have learned:

  1. How to apply textAppearance to TextViews.
Tools Required
  1. Android Studio. The version used in this tutorial is Arctic Fox 2020.3.1 Patch 3.
Prerequisite Knowledge
  1. Basic Android.
Project Setup

To follow along with the tutorial, perform the steps below:

  1. Create a new Android project with the default Empty Activity.

  2. Extract the Hello World! String resource to the strings.xml file, so res/values/strings.xml should have

     <string name="hello_world">Hello World!</string>
Apply textAppearance via XML

There are two ways to apply textAppearance to a TextView. We can apply it via XML or programmatically. To apply textAppearance using XML, we would need to set the android:textAppearance attribute.

  1. Open up activity_main.xml in the Design surface, select the TextView, and search for textAppearance in the Attributes panel.

attributes.png

  1. Select the dropdown menu to use the Large value.

large.png

  1. In Code view, the attribute that was added to TextView is:

     android:textAppearance="@style/TextAppearance.AppCompat.Large"

There are a lot more values or even custom styles that you can add to textAppearance that are not in the dropdown menu. To see more values provided by Android,

  1. Switch to Design view.
  2. Select the Pick a Resource button on the textAppearance attribute. The button is tiny, so it can be hard to spot. Refer to the screenshot below.

pick_a_resource.png

  1. Upon the window opening, you will be able to find a lot of premade textAppearance styles.

resource_list.png

  1. Select Cancel to close the window.

So far, our TextView XML looks like below.

<TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="@string/hello_world"
   android:textAppearance="@style/TextAppearance.AppCompat.Large"
   app:layout_constraintBottom_toBottomOf="parent"
   app:layout_constraintLeft_toLeftOf="parent"
   app:layout_constraintRight_toRightOf="parent"
   app:layout_constraintTop_toTopOf="parent" />

Run the app and we can see that the text is larger than without this attribute.

2_screens.png

Apply textAppearance programmatically

Now that we have successfully set textAppearance via XML, we will learn how to set it programmatically in this section. Setting textAppearance programmatically has a higher precedence than via XML, so textAppearance in code will override any value set in XML. To prove this point, we will attempt to set the textAppearance to Medium and observe how the app behaves at runtime.

We have not set an ID for textView yet, so let us add it to make it easier to get a reference to the textView object in our code. To set the ID in Design surface,

  1. Open activity_main.xml in Design surface.
  2. Select the TextView in the Component Tree.
  3. In the Attributes panel, add textView_helloWorld. There does not seem to be an official naming convention for android:id by Google, so I am using elementType_elementDescription because it is the most readable to me. That is totally fine if you follow a different naming convention.

id.png

If you want to add the ID in Code view instead, copy and paste the XML below.

<TextView
   android:id="@+id/textView_helloWorld"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="@string/hello_world"
   android:textAppearance="@style/TextAppearance.AppCompat.Large"
   app:layout_constraintBottom_toBottomOf="parent"
   app:layout_constraintLeft_toLeftOf="parent"
   app:layout_constraintRight_toRightOf="parent"
   app:layout_constraintTop_toTopOf="parent" />

To set textAppearance programmatically, normally we can use the setTextAppearance() function. Its method signature is

open fun setTextAppearance(resId: Int): Unit

The resId argument requires an ID of a textAppearance style resource found via R.style.textAppearance*.

  1. Open MainActivity.kt.

  2. In the onCreate() function, after the setContentView() function call, add the code below.

     val textViewHelloWorld = findViewById<TextView>(R.id.textView_helloWorld)
     textViewHelloWorld.setTextAppearance(R.style.TextAppearance_AppCompat_Medium)
  3. If your minimum target has been set to API level 21 (the default setting for the IDE used in this tutorial), you will run into a problem with the code above because the version of setTextAppearance() that we used was added in API level 23.

api_error.png

  1. Fortunately, there is a TextViewCompat helper class that we can use to provide compatibility to older API levels. We do not need to provide complex API checking logic with this helper class. The helper method that we need to use is:

     static fun setTextAppearance(@NonNull textView: TextView, @StyleRes resId: Int): Unit

It is a static method, so we do not have to create a TextViewCompat object. We simply need to provide a TextView object and the style resource ID. Replace the code written in the previous step with the code below.

TextViewCompat.setTextAppearance(
   findViewById(R.id.textView_helloWorld),
   R.style.TextAppearance_AppCompat_Medium)

Run the app and we will see that textView_helloWorld now displays in Medium size, completely overwriting the Large size set with android:textAppearance earlier.

3_screens.png

Solution Code

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   tools:context=".MainActivity">

   <TextView
       android:id="@+id/textView_helloWorld"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="@string/hello_world"
       android:textAppearance="@style/TextAppearance.AppCompat.Large"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintLeft_toLeftOf="parent"
       app:layout_constraintRight_toRightOf="parent"
       app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.kt

package com.example.daniwebtextappearance

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.core.widget.TextViewCompat

class MainActivity : AppCompatActivity() {

   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)

       TextViewCompat.setTextAppearance(
           findViewById(R.id.textView_helloWorld),
           R.style.TextAppearance_AppCompat_Medium)
   }
}

strings.xml

<resources>
   <string name="app_name">Daniweb textAppearance</string>
   <string name="hello_world">Hello World!</string>
</resources>
Summary

We have learned how to set textAppearance on TextView objects. The full project code can be found here https://github.com/dmitrilc/DaniwebTextAppearance/tree/main

Data Governance and Data Management

Introduction

Enterprises that dont embrace data or are late to the party face serious consequences compared to early adopters. As to talking about good data practices, most people associate the word with only a few of the multitude of practices that constitute a successfully run, data-driven enterprise.   

Besides data analysis, data management is what readily comes to mind. Though equally universal — and perhaps are even more critical — data practice is the practice of data governance.   

How to Use Amazon SQS in a Spring Boot App

In this blog, you will learn how to use Amazon Simple Queue Service (SQS) in a Spring Boot App. You will use the AWS SDK for Java for this purpose. Most of the SQS features, which can also be executed manually via the AWS console, will be covered within this blog.

1. Introduction

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale your applications. It is a fully managed service, so you will not have to take care of managing the service yourself. You can create queues, send and receive messages, send messages to a Dead Letter Queue when they could not be processed successfully, etc.

VB6 sample code

Hi Guys,

I am using Visual-Basic-6

The below code works fine to attach a single file into mail.

objMail.attachments.Add ("C:\Zim Suite\Requests\" + Text1 + "-" + Text2 + "-" + Text5 + "-Test Document" + ".pdf")

How do I attach multiple files into my mail?

Text1, Text2 and Text5 are common to all files. The extensions could be a mixture of .pdf, .jpeg and .xlsx files.

Diagonal Stripes Wipe Animation

I was playing this game on Apple Arcade the other day called wurdweb. It’s a fun little game! Little touches like the little shape dudes that walk around the screen (but otherwise don’t do anything) give it a lot of character. I kinda want little shape dudes that walk around on websites. But another UI choice caught my eye, the way that transitions between screens have these diagonal lines that grow and fill the screen, like window blinds closing, kinda.

Here’s a quick screencast showing how those wipes work:

I wanted to have a crack at building this.

The first thing that went through my mind is repeating-linear-gradient and how that can be used to build stripes. So say we set up like this:

.gradient {
  background-image:
    repeating-linear-gradient(
      45deg,
      #ff8a00,
      #ff8a00 10px,
      #e52e71 10px,
      #e52e71 20px
    );
}

That would buy us stripes like this:

We can use transparent as a color though. Meaning if we covered the screen with stripes like these, we could see through where that color is. Say like this:

In that gradient definition, we use 10px as the “start” and 20px as the “end” of the gradient before it repeats. Part of the trick here is keeping that 20px “end” the same and animating the “start” number up to it. When we do that, it actually covers the screen in a solid color. The problem is… how do you animate it? You can’t do this:

Screenshot of a CSS code snippet on a dark gray background with syntax highlighting. An arrow is pointing from the repeating linear gradient on the element to another repeating linear gradient inside keyframes. A note that says not going to animate is displayed in large white letters above a crying emoji.

What we need to do is animate that “start” pixel value number alone. We can use a custom property, but it’s a little tricky because without declaring them, custom properties are just strings, and not animatable lengths. So we’d have to do it like this.

@property --start {
  syntax: "<length>";
  inherits: false;
  initial-value: 10px;
}
#cover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
    45deg,
    #ff8a00,
    #ff8a00 var(--start),
    transparent var(--start),
    transparent var(--end, 20px)
  );
  animation: cover 1s linear infinite;
}
@keyframes cover {
  to {
    --start: 20px;
  }
}

We’ve got to use @property here to do this, which I really like but, sadly, has limited browser support. It does work though! I’ve got all that set up, including a quick prefers-reduced-motion media query. I’m using a smidge of JavaScript to change the background halfway through the animation (while the screen is covered) so you can see how it might be used for a screen transition. Again, note that this is only working in Chromium-based browsers at the moment:

Notice I’ve used CSS custom properties for other things as well, like the angle and size of the stripes and the speed of the animation. They are both very trivial to change! I’ve chucked in knobs so you can adjust things to your liking. Knobs? Yeah, they are cool:

Like and subscribe

This whole thing started as a tweet. In this case, I’m glad I did as Temani Afif chimed in with a way to do it with masks as well, meaning pretty solid support across all browsers:

I don’t think animating background color stops or a mask position is particularly performant, but since we’re talking “screen wipes” here, one could imagine that the page isn’t likely to be interacted with anymore until the page transition is over, so maybe that’s not the world’s biggest deal.

Smashing Podcast Episode 44 With Chris Ferdinandi: Is The Web Dead?

In this episode, we’re asking if changes to best practises over the last year have negatively impacted the web. Is it all downhill from here? Drew McLellan talks to expert Chris Ferdinandi to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s the author of the Vanilla JavaScript Pocket Guide series, creator of the Vanilla JavaScript Academy Training Program and host of the Vanilla JavaScript Podcast. We last talked to him in July 2020, where we asked if modern best practices about for the web. So we know he’s still an expert in Vanilla JS, but did you know he’s solely responsible for New Zealand being missing from 50% of world maps? My smashing friends, please welcome back, Chris Ferdinandi. Hi Chris, how are you?

Chris Ferdinandi: Oh, I’m smashing. Thanks for having me Drew. Interesting thing. I actually make sure New Zealand is not on maps because it’s probably my favorite country in the whole world and I don’t want too many people to know about it.

Drew: You want it to remain unspoiled.

Chris: Indeed.

Drew: So welcome back to the podcast. Last time we talked, we posed this question of if modern best practices, the use of reactive frameworks and these sorts of things were actually bad for the progress of the web. And I don’t know whether it was a controversial episode or it just struck a chord with a lot of listeners, but that conversation has been one of the most shared and listened to episodes that we’ve put out that smashing.

Chris: Oh, that’s awesome.

Drew: It’s actually been more than a year now, 15 months since we recorded that, which at the pace the web moves is like literally forever. So I wanted to ask, has anything changed? Is the web still in a terminal decline? Has the needle shifted at all?

Chris: Yeah, quite a bit has changed quite a bit has not. So I think, it’s so weird. The web technology changes so fast, but the web itself tends to move a little bit slower just in terms of developer trends and habits. And so you see these slightly longer arcs where you’ll have a bunch of technology pile up around one approach and then it’ll slowly start to swing the other way and then change all at once. And so last time we talked, I think one of the big kind of... Well, I had two big points related to the modern web. The first was, we’re using a lot of tools that give developers convenience, but we’re using those tools at the expense of the user. So we’re throwing a ton of client-side JS at people, and that introduces a ton of agility and performance issues.

Chris: The other big point that I was really hammering on was that these tools don’t necessarily improve the developer experience as much as I think people think they do. They do for some people. And I think for another segment of the front end professionals it actually can make things a little bit worse. But what I’m starting to see happen now, and one of the things I’d love to dig into a little bit more is I think we’re seeing a new, it’s almost like a second generation of tools that take a lot of the developer benefits that these client-side frameworks bring and strip away the punishing effects that we put on our users as a result. So it’s taking those same concepts and tools and packaging them a little bit differently in a way that’s actually better for the front end.

Chris: So one of the things I’ve been talking about with people lately is this idea that modern development has broken the web, but it’s also starting to fix it. And so we can definitely dig into that in a bunch of different angles, depending on where you want to take this conversation.

Drew: Sure. What sort of things have you seen in the last year that really stand out from that point of view?

Chris: Yeah, so the two biggest trends I’ve noticed are the rise of microframeworks. So where we saw a lot of really big all encompassing libraries for a while React, Vue before that angular, which is just a massive beast at this point, we’ve started to see smaller libraries that do the same thing come into their own. So for example, I think the king of this hill is probably Preact, which is a three kilobyte alternative to React that uses the same API, ships way less code and actually runs orders of magnitude faster on safe updates than React does too. So you’ve got things like that.

Chris: For a while you had... Well, it’s still out there, but Alpine JS, which was inspired by VJS and then actually inspired Evan You who built Vue to release Petite Vue, which is a 5.5 kilobyte subset of Vue that’s optimized around progressive enhancement. So these are still client-side libraries, but the intent behind them is that they ship less code, include fewer abstractions and ultimately work faster and put less of that cost on the front end user. So that’s been one angle.

Chris: And then the second trend I’ve seen that I think is personally more compelling is a shift from libraries to compilers. And so the one that kicked this whole trend off was felt by Rich Harris, which takes the idea of state based reactivity. But instead of having this be a thing that runs in real time in the client, you author your code with the same general pattern that you might with React or Vue, and then you run a build tool that compiles all that into plain old HTML and vanilla JavaScript, and that’s what gets shipped to the browser. And so you’ve stripped out almost all of the abstractions in the client and you deliver something that’s way closer to what you might hand write with old school DOM manipulation, but with the developer convenience of state based EI. So that was really interesting.

Chris: More recently there’s a new tool called ASTRO that builds on what Rich did with Svelt, and also allows you to pull in components from your favorite libraries so you can mix and match Vue, React, FELT, Vanilla, JavaScript, all in one package, compile it all out into Vanilla JavaScript and ship orders of magnitude, less code without the abstractions. And so it would run way faster in the browser as well. And those are, I think for me, really the two big things that are like standing on the shoulders of giants and producing a front end that will hopefully start to be a little bit faster. The compilers in particular are interesting because they take us away from rendering HTML in the browser as much as possible. You still render your HTML or you still author it with JavaScript if you want, but the outputted result is more static HTML and less JavaScript, which is always a good thing.

Drew: Do you think this is the ecosystem’s response to this quiet developer dissatisfaction about the weight of modern frameworks? Is it just a natural heave and ho?

Chris: Yeah, it is. Although to be honest, I’m not entirely sure how much of this was driven by... Well, there’s some definitely some performance minded developers out there who have been very vocal about how these tools are bad for the user. I don’t know that that’s necessarily representative of the general population though. I mean, certainly a subset of it given how the last time we talked that episode did, but I think one of the things that none of these tools for me get at is... Or the thing that I’m most bothered by by the modern web that I don’t think these tools address is that I personally feel like just the development process in general is over complicated.

Chris: This is where I get into the whole like, I don’t think the developer experience is actually better with these tools, but I think for a lot of developers in maybe a team environment, it can be. For me as a largely solo developer, I find these tools more trouble than they’re worth, but I know a lot of folks disagree with me there, so I don’t want to dismiss that as invalid. If you find these tools useful great, but yeah, I think this is maybe a natural pendulum swing back in the other direction.

Chris: The third thing that I didn’t talk about that your question actually makes me think about though is, there is almost a natural cycle in the web where you start to throw a lot of JavaScript at solving problems as the web and the capabilities of it grow. And eventually those JavaScript libraries get absorbed by the platform itself, but it’s a much slower process than creating a new JavaScript library is, because it’s standard processes and how important those are. So we saw the same thing happen with jQuery, right, where the amount of JavaScript being used on the web swelled with jQuery and jQuery plugins.

Chris: And then eventually the web platform realized that these ways of doing things are really smart and we started to get native ways to do it. And then there was this really long, slow petering off of the shift away from jQuery. So I think these libraries, as much as they’ve done a lot of... That’ll be a little controversial here and say, they’ve done a lot of damage to the web. They’ve also served an important function in paving cow path for what native APIs could look like it could do. So I don’t want to completely dismiss them as terrible.

Drew: It’s interesting that you mentioned ASTRO just a little bit earlier. I’ve actually recorded an interview with Matthew Phillips. I’m not sure if it goes out before or after this one. He’s one of the core developers on ASTRO. And it certainly is a very creative and an interesting approach to the problem. I do wonder as you saying how much this is. We’ve created a set of problems for ourselves and so now we’ve created a new solution, which patches over those problems and gives us something even better. But are we just stacking the bricks on top of each other and still ending up with a very wobbly tower because of it? Are we just going down the wrong path?

Chris: It depends. So I, as the hair on my head has started to disappear and my beard has gotten whiter, I’ve started to talk in fewer absolutes than I did. And so five years ago, I would’ve said, "Absolutely yes." I don’t want to diminish the value of these tools in a team environment. And the other thing, I honestly think a lot of libraries really have the potential to at least patch fix in the interim is accessibility problems with the web around complex UI components. So in short, if I were to give this just a one sentence, yes, I do think in many ways we’re creating a really delicate house of cards that collapses very easily. And I think one of the nicest things about using mostly or almost entirely platform native to build for the web, so just authoring an HTML, CSS and JavaScript is, you cannot touch that code for five years and come back to it and you don’t have any dependencies to update. You don’t have any build tools to run, to start working with it again. It just works. And that’s really great.

Chris: But I think the thing I see with libraries is a lot of them come into creation to fill gaps in what the platform can do. And what I’ve noticed happens is after the platform catches up, the libraries stick around for a really long time. And so the thing I always try to do is be a little bit deliberate about what I add to the things I build, because it’s really easy to add stuff and really hard to take it away once it’s there. And just, I think to ground these heady abstract concepts, I’m talking about for a sec, every year, web aim, Web Accessibility consultancy firm does a survey of the top million sites on the web. And they run an audit, just automated audits. They’re not doing a detailed inspection of all these sites. So just stuff that, simple like robot tasks and pickup. And historically, one of the things they’ve always found is that sites that use UI rendering libraries have more accessibility issues than sites that don’t.

Chris: This year they found the same trend with one exception. Sites that use React actually have fewer accessibility issues than sites that don’t. And that is a notable trend or noticeable departure, rather from the year before when React sites had more accessibility issues.

Chris: I noticed a lot of focus on accessibility in the React community over the last year, building more accessible components, accessible routing, things of that nature. And for complex components, things like tabs and disclosure widgets, and sliders and things like that, it is really hard to do those accessibly with just HTML and Vanilla JavaScript. Trying to keep track of which ARIA attributes you need to add on, which elements and how to change them based on different behaviors and how to shift focus and announce different things is really complex. And I think these libraries as much as they can be a very delicate house of cards, I see a huge potential there to fill these gaps. Where I’d ultimately love to end up though, is in a place where the platform, the web, browsers offer native components that do those things so that you don’t need the libraries. And I think the details and summary elements provide a really nice model for what that could look like.

Chris: So if you’re listening to this and you don’t know what those are, the details element is an HTML element that you wrap around some content, and then inside it you nest a summary element with like a little description of what’s in that content. And by default, this element will be a collapsed bit of content. And when you click on the stuff in the summary, it expands and then when you click it again, it collapses and it shows a little arrow when it’s open or closed to indicate what’s happening here. It’s accessible out of the box. If the browser doesn’t support it, it shows all the content by default. So it’s just automatically progressively enhanced. You don’t need to do anything special there.

Chris: It can be styled with CSS. You can even change what the icons that display when it’s expanded and collapsed are, just with CSS. You don’t need to write any JS for it, but if you wanted to extend the behavior in some way you can, because it also exposes a JavaScript event that fires whenever it’s toggled open or closed. And I would love to see more stuff like that for tabs, for image sliders or carousels or photo galleries, which just... We have so many different interactive components now on the web that may or may not always be appropriate, but they’re in the designs and people are building them and having a way to do those things where you didn’t have to fumble through how to make them accessible or lean on a 30 kilobyte library would be awesome.

Chris: And so for me, that’s, I think, the next evolution of the web. That’s where I really want to see things start to go. And I think that’s the big need that these libraries address today in addition to some other stuff like changing the UI based on state changes and interesting use cases like that.

Drew: Yeah. Modern browsers are just so capable now and they automatically update themselves and they include many of the features natively that we’ve previously relied on, on big frameworks and build tools for. Is the requirement of a build process to deploy a project a red flag in 2021? Should HTML and CSS and JS just be deployable as it is?

Chris: So technically they are. I don’t think for most build processes that’s real or for most apps or sites or companies that’s necessarily realistic today. I don’t know that I’d call it a red flag as much as a resigned I wish it wasn’t like this, but I understand why it is, for me. Even for myself, my site has several thousand pages on it now. I think I’m up to three or four thousand pages and there’s no way I am just hand coding all those. I use a static site generator and I think tools like that can be really great.

Chris: I think there’s some challenge there in that they become things that have to be kept updated and maintained. And so I like to keep mine as lean as possible, but I think build tools that put more of the run time on you, the developer, and thus allow you to ship less to the browser are a good thing, especially as the things we build become more complex. So I don’t know that I would necessarily say it’s just by default a red flag. I think a lot of it depends on how you’re using it. If you need to run a build to ship a one or two page marketing site or brochure site, yeah, that’s a red flag. But if you’re building some complex applications and these allow you to author in a way that’s more sensical for you and then ship less stuff to the browser, that’s not a bad thing. And that’s why I find tools like ASTRO really, really interesting because there is still a build step there, but it’s a build step in the service of providing a better end user experience.

Drew: Yes. It’s shifting all that computation onto the server to build time or pre deferred time and not on page request time.

Chris: Yeah. And so for me, I almost break build steps into... Like for me, the gold standard is if I can ship it without any build step at all, that’s awesome. But even for myself, the vanilla jazz guy, that’s not how I do things a hundred percent today. And so I think the next step up is compilers that reduce your code to as much HTML and plain old JavaScript as possible, versus those that create even more JavaScript, like the ones that take a bunch of little files and make an even bigger file. So more of the former, less of the latter if possible is always a good thing, but not always possible.

Drew: I think getting off the dependency treadmill, as it were, it’s got to be a big draw to a Vanilla JavaScript approach, not having a million dependencies to be updating all the time, but I guess one of the advantages to some of these bigger frameworks is that they sometimes dictate and sometimes facilitate a uniform way of working, which is really important with larger teams. Is there a danger of a project going a bit off the rails without those standards and procedures in place that a framework imposes?

Chris: Yes. Yeah. I think that’s fair. I used to downplay, I think, the significance of this for a while. And I think that is valid. That is a fair benefit of these tools. I think that maybe the small counter argument here is if you Google, "How to do X with React," you’re going to get half a dozen different approaches to doing that thing. So there are conventions, but there’s not necessarily hard and fast, like if you don’t do it this way, everything breaks kind of rules. One of the appeals of these tools is that they have a lot of flexibility. Certainly they do enforce more standard approaches though than just green fields, browser native things do. And so I think there’s maybe a bit of a balance, even if you don’t have a strong team lead who’s driving internal code standards.

Chris: I have seen even framework based projects go off the rails with hodgepodge approaches before. So it’s not like these tools automatically give you that, but they definitely give you some guidelines, maybe some rails that nudge you in the right direction. And I know some people need that. If that is something you need, this is where I really like that we’re seeing more of these smaller libraries that use the same conventions, like Petite Vue or Preact and compilers that also... Like FELT has some very rigid rails around it, certainly more so than you would see with ASTRO and so if you really need that, I think you have some options that don’t punish users for that need as much as what we had been doing a few years ago.

Drew: In the work that I do, we use Vue and the Vue single file components are a really compelling case for this in that we have engineers writing front-end code, who aren’t necessarily front-end specialists who say here’s a way to create a skeleton single file component. Your template goes here, your Java script goes here, your CSS goes here. And just naturally as a result of that, we end up with a very consistent code base, even though it’s been created by a very diverse set of people. And so the conventions like that can really have a big benefit to teams who aren’t necessarily all headed in the same direction because the engineering department’s so massive or whatever.

Chris: Yeah, for sure. Where I think you sometimes get into trouble with that... And I agree. I absolutely like the ability to make a code base look consistent with a bunch of different people working on it is really, really important because the people writing the code today are not necessarily going to be the ones maintaining it later. And that can get messy fast. The flip side is, if you are someone who is not comfortable or really well versed in JavaScript, a lot of the modern tool set is really geared towards JavaScript. And there are a lot of people on teams who specialize primarily in HTML or CSS or accessibility. And for them, JavaScript is not a core competency nor do I think it’s fair to expect it to be. And just like you don’t expect all your JavaScript developers to be experts in CSS.

Chris: And so it can make their job a lot harder. And this is for me, always that like that give and take with these tools is they can do some really awesome things, but they can also gate keep a lot of people out of the process. And I feel like that balance is different from team to team, but for me, one of the big arguments for leaning more on browser native stuff, or ditching as many of those dependencies as possible is that you open up your development process to a lot of people who are not as JavaScript heavy.

Drew: There’s always this undercurrent within the industry that suggests there’s the current way of doing things, the latest and there’s the outdated way. And if you’re not up to date with whatever the latest is, you’re somehow not as good an engineer or whatever.

Drew: In your estimation does taking a Vanilla JavaScript approach enable you to swim free of all that is Vanilla JS like an evergreen approach that stands apart from those techniques.

Chris: Yeah. Yeah. There’s a few threads in what you just mentioned, Drew. So one of them is, if you understand the fundamentals of the web, I have found that it’s a lot easier to like a bee, just bounce from different technology to different technology and understand it enough to like... Even if you don’t use it, look at it and be like, "Okay, I can see some benefits to this or not, and evaluate whether it’s the right choice." If you need to dive into a new technology based on client needs or shifting direction in the company, you can. I think it’s a lot harder to do that if you only know a library and you’ve only learned the web in the context of that library.

Chris: Now the caveat here is, I learned JavaScript in the context of jQuery and then backed my way into Vanilla JavaScript, and then moved on to a bunch of other things too. The more I think about how that process went for me though, I think I was able to do that as easily as I did in large part because by the time I made that jump, ES5 had come out and had taken a bunch of its conventions from jQuery. And so there was a lot of these real one for one map. Mental map things I could do. I don’t know if we’re quite there yet with some of the state based UI libraries, but we’re definitely headed in that direction and I think that’s great. But the other thing here, there is this real pressure, as you mentioned in the industry to always keep up to date with all these new technologies, in large part because people who develop these technologies and people who work at the big companies are the ones who get invited to speak at conferences and talk about all the cool things they’ve built.

Chris: But the reality is that a lot of our web, like I’d say a majority of our web, runs on boring old technology that hasn’t been updated in a while, or has been updated, but in just a patch fix process. A lot of really important applications run on Python or PHP, or as a backend with just some sprinkling of lightweight HTML, CSS, and JavaScript on top. jQuery is still used on a lot of important stuff to the exclusion of other libraries. And it doesn’t always feel like it because I feel like most job descriptions that you see talk about wanting experience in React or Vue or something these days. But my experience from working in bigger technology companies or older product companies, is that there are a lot of jobs to be found working on old stable technology. And a lot of times it’s not always the most exciting work, but a lot of times they’re jobs that pay well and have really great hours and a lot of work life balance in a way that you won’t get in a really exciting tech company working on the latest stuff.

Chris: And so there’s these trade offs there. It’s not always a bad thing. Yeah, I think it’s one of those, like the new, new, new thing is potentially a very vocal minority of the web that’s not representative of as the web as a whole.

Drew: And there seems to be along with this idea that you should be adopting everything new and immediately casting away everything that you’ve been using for the last 12 months. There’s also this idea that you should be engineering things that are enterprise grade of engineering, but you ought to be doing every small project the way that an enormous company with 400 engineers is building things. And those two ideas actually aren’t compatible at all. It’s the big companies with all these hundreds of engineers who are using the old crusty technology, because it’s reliable and they’ve got far too much momentum. They hate to be dropping it and picking up something new. So those two ideas are indirect conflict, I think.

Chris: Yeah. It’s funny. You always see the whole like, "Well, will it scale, will it scale," kind of thing all the time. And does it need to? Are you building things for a Facebook sized audience? I’m sure you’ll get there at... Well, you’ll get there, but it would be wonderful if you got there at some point, but like, if you’re not there today, maybe that’s not necessarily how you need to start out. Like those aren’t your needs today. You’re pre-engineering for a problem that you don’t have to the detriment of some problems that you do.

Chris: I think the other thing here is there’s this presumption that because Facebook or Google or Twitter do things, it’s a good idea, or it’s a good idea for everybody. And that’s not necessarily the case. Those companies do a lot of things right. But they also do a lot of things poorly and they do them that way because of engineering trade offs they’ve had to make because of how their teams are structured or very specific internal problems they had at the time that they made this decision or because some executive somewhere felt really strongly about something and made the internal team do it, even though it wasn’t necessarily best at the time. And then these things stick around. And so, yeah, I think one of the biggest things I see happen in our industry to our own detriment is looking at those few really big visible technology companies and thinking, "If they do it this way, I have to too," or "That’s the right call for everybody."

Chris: It’s that old, like no one got fired for hiring IBM kind of thing, but applied to if it’s good enough for Google or if it’s good enough for Twitter or whatever, so yeah. I agree. I think we do a lot of that and maybe that we shouldn’t.

Drew: I asked on Twitter earlier on that what frustrated people about modern web development best practices and from the responses I got, there’s certainly a lot of dissatisfaction with the current state of things. One trend, which over the last few years is getting momentum is like the Jamstack approach to building sites. And it seems on the surface that this going back to just client-side apps and nothing complex on the server, it sounds like it’s going back to basics, but is it doing that? Is it or is it just masking the complexity of the stack in a different way?

Chris: It depends. I’m a little biased here because I love the Jamstack personally, but I have also seen... Well, I shouldn’t say I have seen. I think what I’m trying to say here is the Jamstack is a term that can apply to a wide range of approaches up to and including a really large two megabyte of JavaScript single page app that has no server side rendering on one end. And then on the other end, flat HTML files that use absolutely no JavaScript at all, and instantly loading your browser and just happen to be shipped from a CDN or something like that. And technically speaking, both of those are Jamstack and are not the flat HTML thing. So Jamstack is not inherently better than server rendered, but in many cases it can be.

Chris: So for those of you who don’t know, Jamstack used to be an acronym that stood for JavaScript, APIs and markup, and they’ve since changed the spelling and changed the definition a little bit there. And it really encompasses an approach to building the web that doesn’t rely on server side rendering. So anything you’re serving, you’ve already compiled and put together and that’s what ships in the browser. And if there’s any other processing or scripting that happens, that happens in the client. Doesn’t have to, but often does. And so what I think is awesome about Jamstack if done a certain way, is it can dramatically improve the performance of the things that you’re building.

Chris: If you’re not just shipping like a metric ton of JavaScript to the client and having all the stuff that you used to do on the server happen in the browser instead, because the browser will always be less efficient at all that scripting than the server would be, but where this really comes to shine, and so I’ll use like WordPress as an example. I love WordPress. I built my career on WordPress. It’s the reason why I was able to become a developer, but every time someone visits a WordPress site out of the box, it has to make a call to a database, grabs some content, mash it into some templates, generate HTML and ship that back to the browser.

Chris: And there are some plugins you can use to do some of that ahead of time, but it is a very slow process, especially on a shared inexpensive web host. A Jamstack approach would be to have that HTML file already built, and you cut... You don’t cut the server out, but you cut all of that server processing completely out. So the HTML file already exists and gets shipped. And in an ideal world, you would even push that out to a bunch of CDNs so it sits as close to the person accessing it as possible. And what that can do is take a load time from a couple of seconds on an inexpensive host to less than half a second, because of how little computing time it takes to actually just request a file, get the file back and load it, if it’s mostly HTML.

Chris: And so, yeah, I really like rambling in long winded response to your question, Drew, but I think the answer is, if you’re using it with something like a static site generator, it can be amazingly more performant than some of the other things we’ve done in the past. And it allows you to get that same WordPress experience where I’m authoring content and I have some templates and I don’t have to hardcode HTML, but the performance is way better on one end.

Chris: And then on the other end, you could theoretically define a React app as Jamstack as well and it can be really slow and buggy and terrible. And so it depends. The other thing I’m seeing happen that’s really, really funny and interesting is we just keep reinventing PHP over and over and over again as an industry in various ways. So-

Drew: We still have PHP as well. It’s not gone.

Chris: Right? And yet PHP still exists and still works great. And so we’ve got... Like I remember when Next.js came out. There was all these kind of, "And here’s all the things you can do with it." And I was like, "Oh, that’s like PHP," but a decade later. And then my friend Zach Leatherman who built Eleventy which is an amazing static site generator has been experimenting with some compiling in real time on the server stuff with Eleventy.

Chris: So it’s like just in time Jamstack and he even jokes that he’s essentially recreated PHP in node and JavaScript, but it’s slightly different because there’s like a serverless build that happens that then instant deploys it to a CDN and it’s like a little weird. So it’s still a house of cards. You’re just shifting around where those cards live and who’s responsible for them, but yeah, yeah. Jamstack is cool. Jamstack is problematic. It’s also not. It’s awesome. It’s potentially overused both as a term and a technology. Yeah. It’s a whole lot of things and I love it in the same way that I love PHP. It’s great and it has problems and every technology and approach is a series of trade-offs.

Drew: Do you think we’re going through some industrial revolution in web development? What used to be skilled painstaking work from individual arts and is now high volume, high production factory output. All the machines have been brought in and the frameworks and the build tools and have we lost that hand rolled touch?

Chris: Well, I mean, yes, to an extent, but we don’t have to. I mean, that analogy is appropriate in many ways, because a lot of the ways we do things today produce... I like to call them front end pollution in the over-reliance on JavaScript, but also in the very literal sense. We have so many heavy build processes now that they generate more actual literal pollution as well. But I think the counter argument here is with a... I will use farming, right? You could go out and hand mill your wheat with a scyther. I forget what you call those. The crescent shaped tool that you use to chop your wheat, or you could use an oxen drawn machine that will pull that off, or you can use a big tractor.

Chris: And I think there’s a clear argument that at some point, factory farming is this big industrial complex that has lost a little bit of that close to the Earth touch, but I don’t think I necessarily need my farmers to be hand chopping their wheat. That is wildly inefficient for very little benefit. And there’s probably a balance there. And I feel the same thing with what we’re doing here. Some of these tools allow us to do more artisan work faster and more efficiently. And sometimes they just turn it into generating a bunch of garbage and turn it out as fast as possible. And there’s not necessarily a clear cut delineation for where that crossover happens. I think it’s a little fuzzy and gray and like a you know it when you see it kind of thing. Sometimes not always. But yeah, I think it’s a little bit of both. The commercialization of the web is both a really terrible thing and also a really great thing that has allowed folks like myself to have a living working on the platform that I love full time.

Chris: That’s awesome. But it’s also produced a lot of problems and I think that’s true for any technology. There’s good and bad that comes with all of it.

Drew: And maybe sometimes we’re just producing really fat pigs.

Chris: Yeah. I’ve gotten a lot more like, it depends as I’ve gotten older. This stuff used to really, really upset me from a purist standpoint. And I still really hate the fact that we’ve forced our users to endorse such a fragile and easily broken web. The web in general has gotten four to five times faster in the last decade. And the average website has only gotten a hundred milliseconds faster in terms of load time, because we just keep throwing more and more stuff at our users. And we could have a really fast resilient web right now if we wanted one, but we don’t. And part of that is a natural trade off for pushing the capabilities of the web further and further and that’s awesome, but I feel like sometimes we do things just because it’s shiny and new and not because it adds real benefit to folks. So I’d love to see a little bit more balance there.

Drew: Is part of the problem that we’re expecting the web to do too much? I mean, for many years we didn’t really have any great alternatives. So we enhanced and maybe over-stretched the high tech document system to behave like a software application. And now we’ve all got really powerful phones in our pockets, running a range of network connected apps. Is that the appropriate outlook for this functionality that we’re trying to build into websites? Should we just all be building apps for that case and leaving the document based stuff to be on the web?

Chris: I would argue the other direction. I think the bigger problem is... So maybe there are certain things for which I even personally I prefer like a native app over something in the web. But I think having the web do more frees you from app ecosystems and allows you as a team to build a thing and be able to reach more people with it, not have to download an app before you can access the thing you want. That’s a really cool thing. And I would argue that potentially the bigger problem is that browsers can’t keep up with the pace of the thing that we want the web to do. And that’s not a knock on the people behind the standards processes. I would not want to go back to every browser just does their own thing and the hell with it. That was awful to develop for.

Drew: It was, yeah.

Chris: We do have some of those similar problems though, just based on how the standards process works. So sometimes you’ll see Google get frustrated because they have so much in-house development power, get frustrated with other browsers that are part of that process not wanting to go along with something or not moving fast enough. And so they just... Leeroy Jenkins it and just run off and go do whatever they want to do. On the flip side you sometimes see Apple moving very, very slow because they don’t put as much investment into the web as they do other parts of their business, which is hopefully, maybe starting to change a little bit with some of the more recent hires they’ve made. But I think one of the things you run into is just the web tends to move a little slowly sometimes.

Chris: Technology moves fast, but the browsers themselves and the technologies they implement don’t always keep up. And so I don’t believe we demand too much of our browsers. I just think you get this natural ebb and flow where we demand a lot. We build a bunch of libraries to polyfill the things that we want and then when the browser eventually catches up, there’s this really slow, petering off as library usage for that particular stuff drops off.

Chris: Yeah. But I don’t know that I would say we demand too much of the web. Yeah, I don’t know. I actually, I love all the things the web can do. I think it’s really, for me, it’s what’s so exciting about the web. I think my frustration is more just with how slow some of these technologies are to come out, particularly on iOS devices. And I say this as someone who, I love my iPhone, but progressive web apps continue to be a second... They just don’t get as much priority as native apps do on that platform, which is disappointing.

Drew: So looking to the future on that note, what should we, as a development community be working on to fix some of these issues? Where should we be placing our efforts?

Chris: Yeah. So I think there are a few different things. And I think some of the tools we’ve talked about, I don’t think they’ll ever necessarily go away. They might change in form a little bit, but so I already see some cool things on the horizon. One of the things people love about single page apps that we’ve never been able to do with, I call them multistage apps, but they’re really just plain old webpages is like the nice transitions that happen between views where you might like fade in, fade out, or something like that.

Chris: There’s a native API in the works that’s going to make that a lot easier. That’s awesome. There’s also a native API in the works for HTML sanitization. So one of the big things that libraries do for you is they, when you’re rendering HTML from third party data, they have some libraries baked in that will help reduce your risk of cross-site scripting attacks.

Chris: There’s not really a good, just native way to do that, but there’s one in the works that will make that a lot easier. And even if you continue to use state based libraries, that should allow them to strip a bunch of code out and that would be an awesome thing.

Chris: One thing that the native web can’t do yet that would be really cool, is a way to handle DOM dipping so that if you want to build some HTML based on a JavaScript object and then update it as the object changes, it would be really cool if you didn’t have to rely on a library for that. And that there was maybe a performant out of the box way to do that in the browser. I think that would solve a lot of problems. As well as more accessible interactive components. I absolutely love when HTML and CSS can replace something I used to need JavaScript for. Doesn’t need to be as rigorously tested, way more fault tolerant, less likely to break, more performant all around. It’s a net win. And so I’d love to see more of those come to the platform.

Chris: So from a browser native thing there’s that. And then the other big thing I think we’re going to start to see more of is a shift away from client-side libraries and a shift to more pre-compiled stuff. Whether that’s static side generators, something like ASTRO that still uses JavaScript libraries, but pre renders them instead of making the browser do it. But those are the, I think, the big things I’m seeing start to happen and I think we’re going to see more and more of.

Drew: So you saying maybe it’s not all doom and gloom and perhaps we can fix this? There’s a way out?

Chris: No, yeah, I see us emerging from the dark ages slowly. And what I think is going to happen is we’re going to hit a point where much like where today people are like, "Why does everybody still use React?" I can imagine in 7 to 10 years time, we’re going to be like, "Why does anybody..." I’m sorry. Not React. jQuery. "Why does everybody still use jQuery?" We’re going to see the same thing with React and Vue. Like, "Why does everybody still start a project with those?" And there’s going to be some new libraries that are starting to emerge to solve a whole new set of problems that we haven’t even dreamed of today.

Drew: One comment from Twitter that I really identified with was from Amy Pellegrini, who said, "Every time I update something, everything gets broken." Yep. I just think we’ve all been there, haven’t we?

Chris: Yeah. I unfortunately don’t think that will ever fully go away because even in the non-build tool era of jQuery, we used to just load it with a script element. You would run into situations where different versions would be incompatible with each other. And so you’d drop a plug in into your site and it would be like, "Sorry, you’re running jQuery 1.83, and this requires 1.89 or higher because it added this new..." And so there’s always been some version of that. I think it’s a lot more pronounced now because so much of it happens in the command line and spits out all these terrible errors that don’t make sense. But yeah, that unfortunately I don’t think will ever go away. I feel the pain though. That one, it’s a big part of the reason why I try and use as few dependencies as possible.

Drew: Me too. Me too. So I’ve been learning all about the lean web or learning more about the lean web than our conversation. What have you been learning about lately, Chris?

Chris: Yeah. Great question. So I have been going deep on service workers in part because I love their ability to both make the web faster, or even if you’re not building a progressive web app, they’re just really, really cool. One of the things I’ve absolutely loved them for though is they allow me to build a single page app like experience in terms of performance, without all the complexity of having to handle JavaScript routing and stuff. So I can have a multipage app, cache my API calls for a short period of time without having to cache them in memory. And so I’ve been able to do some really cool things with them. And then the other thing I’ve been learning a lot about lately is serverless, which allows me to get the benefits of having some server-side code without having to actually manage a server, which is great.

Chris: And so I went really, really deep on those, put together a couple of courses on both of those topics as well, but they have benefited me immensely in my own work, in particular service workers, which has been amazing. I’m obsessed with them. Recommend them for everybody.

Drew: That’s amazing. And where can people find those courses that you put together on?

Chris: So if you go to vanillajsguides.com, you can dig into those and a whole bunch of other courses as well.

Drew: Amazing. If you dear listener would like to hear more from Chris, you can find his book on the web at leanweb.dev and his developer tips newsletter, which I believe now gets over 12,000 subscribers-

Chris: Yeah. Up a little bit from the last time we chatted.

Drew: Yeah. That’s at gomakethings.com. Chris is on twitter @chrisferdinandi. And you can check out his podcast at podcast.com or wherever you usually get your podcasts from. Thanks for joining us today, Chris. Do you have any parting words?

Chris: No, that was a really great summary, Drew. Thank you so much. You hit all the key links. So thanks so much for having me. This was great.