Changes in web development in the last decade

Only ten years ago internet was very different from what it is today. Most major banks did not have internet presence, for example. From today’s perspective, even tech companies like Facebook and Google were lagging behind in terms of user experience. Web development is mature now. Not only that, but the process of building websites has changed as well. For this reason, it’s interesting to look back on web development in the past and try to describe changes.

Let’s start with the biggest changes internet has experienced.

Strong response to new web standards

A decade ago, a lot of people were still using slow browsers like internet explorer. Internet explorer was based on old tech infrastructure, so website-specific languages like HTML and CSS could not move forward. Some websites did modernize, but they had to also develop alternate versions of their websites for those who used old browsers. Internet Explorer and similar browsers could not support many new features present in newer versions (CSS3 and HTML5).

Improvements in UX

This is related to the previous point. These days, more and more browsers support HTML and CSS features that improve user experience. Flexbox and grid systems make it easy to design the web application layout for example. It is also easier to build responsive web applications. Because most web apps are viewed on phones today, this makes a big difference.

10 years ago, it was nearly impossible to browse internet on your phone. Now almost every theme and CMS tool builds beautiful websites optimized for mobiles.

The development of front-end frameworks like React have also helped. The virtual DOM feature of React can single handedly improve user experience for dynamic applications like Instagram and Facebook. React is by far the most popular tool used for building user interfaces and entire web apps. It allows you to conditionally display or hide certain elements, or use JavaScript to dynamically add conditional className values to certain elements. React also allows you to use refs, an alternative to getElementById() method. You can use refs to improve user experience as well. For example, scroll to a specific element.

https://simplefrontend.com/react-scroll-to-bottom/

Emergence of no-code

Content management systems (CMS) have always existed. WordPress was no less popular a decade ago than it is today. WordPress websites have become more beautiful, and have basic dynamic features. Mostly they are used for creating blog websites.

However, one big change is the emergence of no-code services. These tools allow you to build web apps with much wider functionality than simple WordPress blogs. There are plenty of tools that do not require a programming knowledge for building various types of applications. Even for developing mobile apps. Shopify has created a solution for building ecommerce websites, for example.

As a result, now everyone has access to building fairly complex web applications. It takes less time to build a simple prototype or even an MVP.

No-code has not replaced programming languages though. It is simply a tool for translating ‘what you want to the code. Under the hood, it will be HTML, CSS and JavaScript.

Using map() and filter() methods in React

Ever since they were introduced, map() and filter() have become great tools for any programmer writing JavaScript code. Since React and other front-end frameworks are based on JavaScript, you can use these two methods in React as well.

In this article, we will discuss use cases for map() and filter() in React. Let’s start with the former.

React applications often receive data from an external API. When you need to display multiple components of the same type, data is usually formatted as array of objects. Each object describes an instance of a certain item. For example, an ecommerce website might receive an array of objects, where each object contains information about each product that needs to be displayed.

In these cases, you need to loop through an array of objects in React. map() is a great function to do just that. The method takes one argument – a callback function.

When you call map() on a certain array, it runs a callback function on every item in the array, then stores each of these items in a new array. You can use this functionality of map() to take objects in the array, and return JSX elements with specific attributes. You can get values from objects and use those values as contents or parameters of the JSX element.

JSX even allows you to embed a call to the map() function right in your code. JSX is nothing but JavaScript code disguised as HTML. Simply use curly braces to write JavaScript expressions within JSX. That way, the templating language will know that a certain part of your code should be evaluated as a JavaScript expression, not a normal content of the page.

React web developers often use map() to create JSX elements, or even separate components based on array of objects. It is a great way to automatically generate elements for every piece of data in the array.

Next is the filter() function. It works similarly to map(), with one big difference. It takes a callback function that returns a condition. The filter() function checks every item in the array against that condition, and creates a new array with items that met the condition. Therefore it is commonly used when you want to conditionally display elements and components for some items in the array.

To use filter() in JSX, you should follow similar rules to map().  You can embed it directly in JSX, but need to wrap the code with curly braces. You need the filter() method to conditionally loop through an array of objects in React.

In conclusion, these two functions are very useful for working with external data in React. You can use both map() and filter() methods to create elements from an array of objects. You take information from objects, and use it as content or attributes for components.

Using ternary operators for conditional styling in React

A lot of beginner web devs have asked me about applying conditional styles in React. I have finally found time to write this blog post to explain how to apply styles this way.

First off, I will quickly provide some background information to really understand conditional styles. React allows you to apply styles based on current value of a variable. It can be any variable, but input components in React typically store values in the state object. Whenever the state changes, component is rerendered. So if user changes their input, and the appearance of application depends on a state value, then component will be updated, and styles might change.

If you’ve ever tried switching from a dark to a light theme, this is why the change is so fast. Web apps you use are likely built in React (or similar front-end framework). They don’t have to reload. They store user’s inputs in the state, and if the user changes their selections, the styles for HTML elements change with it. This is an excellent guide on implementing dark mode in React web apps.

With that being said, let’s get back to the topic of using ternary operators for conditional styling in React. This is more common and easier to do than you might think.

Like in normal HTML, you can set inline styles to React elements in JSX. Even more importantly, JSX allows you to set style attribute to a JavaScript expression.

Inline styles in JSX are similar to those in HTML, but also different in few important ways. For once, they are not a string or a text. inline styles in React are formatted as objects, where object property is the CSS property, and the value is the style choice.

Since it’s just a normal JavaScript object, you can easily add ternary operators to conditionally style React elements. Let’s take a look at one example:

<div style={{backgroundColor: dark ? “black” : “white” }}></div>

In this case, the <div> element is conditionally styled. You can go even further and nest multiple ternary operators to implement a if/else scenario. It will not be readable, but you can technically do it.

Using ternary operators to style elements is common practice among React web developers. It’s important to remember the syntax, especially if you’re going to nest multiple ternary operators or use them frequently.

If your conditions are too complex, your JSX query might become too confusing and difficult to follow. In that case, you can take the entire styles object out of the JSX code. Define it somewhere else. Add as much complexity and as many nested ternary operators as you’d like. Then in JSX, you can simply set the style attribute to reference of that object.

Overall, inline styling is a great feature for developers. It’s simple and often times effective. However, as your experience grows, you may want to explore other options for dynamic styling in React. For example, libraries like styled-components.

One alternative is to define a normal class, and add className conditionally in React. This is particularly useful when there are multiple styles that need to be conditionally applied. You can re-use the same class on multiple elements in JSX.

Autonomous planes are here, and they look promising

You may not think that planes can be autonomous. But if you think about it, they are easier to automate than normal cars, for example. It’s easier to coordinates them so planes don’t crash into each other, and there are no foot passengers to consider.

Management of some of the biggest airplane manufacturers like Boeing and Airbus are convinced that fully autonomous passenger planes are the future. Latest airplanes are pretty autonomous as it is. Autopilots and other airplane systems have gotten to the point where they can do a lot of the work all by themselves. Human pilots are often there to oversee their functionality and work. Having said that, most experts believe current technology advancements are not sufficient to support fully autonomous planes. Pilots still need to be in the cabin.

Still, if we believe Boeing CEO, we’re not too far from the future where passenger planes will take off and land without human’s support.

Airbus is stepping up their automation game as well. They introduced DragonFly, to make Airbus pilots’ lives much easier. For example, DragonFly makes it much easier to fly around airports before you land. Usually this process takes a lot of time and energy from pilots, DragonFly helps with that.

There is also a startup that works on integrating direct autonomous flights, so they can be smoothly unloaded at the destination airports. All their flights are autonomous, and only controlled by employees from the ground. Eventually, it could be entirely free of any human intervention. Ameriflight, on the other hand, helps delivery services like FedEx fly autonomous planes.

Emergence of automated planes could have huge repercussions for the industry. Not only for passengers, but for flying cargo planes. Amazon already delivers a lot of products overnight, imagine what they could do if they had limitless access to skies.

With that being said, autonomous flights are more likely to affect cargo transports first, before it moves to passenger planes. That’s logical – we need to test their credibility on products before trusting automated planes with human passengers. It will also be difficult to convince people to fly these planes that don’t have any pilots.

Airlines pay a lot of money to pilots. Businesses, of course, want to cut down on that cost.

Many people are concerned about what this means for human pilots though. Don’t worry, they are not going to lose their jobs. Businesses work so hard to prove autonomous capabilities to entice FAA requirements. Currently the rule is that every commercial flight must have at least two pilots. If autonomous capabilities become advanced enough, it could lead to changes in this rule.

In general,  I support the idea of helping people who become redundant as a result of technological advances. Eventually advances become the norm and new jobs appear in other areas, but individual humans should not suffer as a result of autonomous driving or flights.