Tuesday, May 30, 2017

Why Use React JS for Fast Interactive User Interfaces?

Why React for Fast Interactive User Interfaces

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.

Nowadays users expect sleek, performant web applications that behave more and more like native apps.

Techniques have been devised to decrease the waiting time when a website gets downloaded on a user's first visit. However, in web applications that expose a lot of interactivity, the time elapsing between a user action taking place and the app's response is also important. Native apps feel snappy, web apps are expected to behave the same, even on less than ideal internet connections.

A number of modern JavaScript frameworks have sprung up which can be very effective at tackling this problem. React JS can be safely considered among the most popular and robust JavaScript libraries you can use to create fast interactive user interfaces for web apps.

In this article I'm going to talk about what React JS is good at and what makes it work, which should provide you with some context to help you decide if this library could be a good fit for your next project.

What Is React JS?

React JS is a Facebook creation which simply labels itself as being a JavaScript library for building user interfaces.

It's an open source project which to date rakes in well over 67,000 stars on GitHub.

React JS is:

  • Declarative — which means that you only need to design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes
  • Component-Based — you create your React-powered apps by assembling a number of encapsulated components, each managing its own state
  • Learn Once, Write Anywhere — React is not a full-blown framework, it's just a library for rendering views.

How Does the Virtual DOM Work?

The Virtual DOM is at the core of what makes React fast at rendering user interface elements and their changes. Let's look closer into its mechanism.

The HTML Document Object Model or DOM is a

...programming interface for HTML and XML documents. ... The DOM provides a representation of the document as a structured group of nodes and objects that have properties and methods. Essentially, it connects web pages to scripts or programming languages.

MDN

Whenever you want to change any part of a web page programmatically, you need to modify the DOM. Depending on the complexity and size of the document, traversing the DOM and updating it could take longer than users might be prepared to accept, especially if you take into account the work browsers need to do when something in the DOM changes. In fact, every time the DOM gets updated, browsers need to recalculate the CSS and carry out layout and repaint operations on the web page.

React JS makes possible for developers to make changes to the web page without having to deal directly with the DOM. This is done via the Virtual DOM.

The Virtual DOM is a lightweight, abstract model of the DOM. React uses the render() method to create a node tree from React components and updates this tree in response to changes in the data model resulting from actions.

Each time there are changes to the underlying data in a React app, React creates a new Virtual DOM representation of the user interface.

Updating UI Changes With the Virtual DOM

When it comes to updating the browser’s DOM, React roughly follows the steps below:

  • Whenever something changes, React re-renders the entire UI in a Virtual DOM representation
  • React then calculates the difference between the previous Virtual DOM representation and the new one
  • Finally, React patches up the real DOM with what has actually changed. If nothing has changed, React won't be dealing with the HTML DOM at all.

One would think that such a process, which involves keeping two representations of the Virtual DOM in memory and comparing them, could be slower than dealing directly with the actual DOM. This is where efficient diff algorithms, batching DOM read/write operations, and limiting DOM changes to the bare minimum necessary, make using React JS and its Virtual DOM a great choice for building performant apps.

Is React Good for Every Project?

Continue reading %Why Use React JS for Fast Interactive User Interfaces?%


by Maria Antonietta Perna via SitePoint

How to Use Sequel Pro to Manage MySQL Databases on macOS

Many developers who use MySQL for their databases may be pros at managing MySQL databases from the command line, but others really need a visual tool, something with a graphical interface, to use when managing databases. It seems that one of the most common tools used for that purpose is phpMyAdmin. This is a web based tool, one that is installed on your web server. Users can head to a particular address and port, login as a database user, and visually manage databases on that server. While useful, this can be inherently insecure, providing a web interface for MySQL users.

Another option is MySQL Workbench, a program that can be downloaded for use on many major operating systems, and can remotely connect to databases for management and planning purposes. This post, however, will illustrate the use of a third option for macOS users: Sequel Pro

Sequel Pro is a native application for macOS. You can set up as many database connections as you need in a favorites list, allowing quick access to those which you need to get at repeatedly. Sequel Pro also provides options to use SSH keys from within the application, in order to let you use it to manage databases over SSH, using keys rather than a username and password. This provides significant security advantages over methods that require users to login using only a MySQL user and corresponding password.

Using Sequel Pro

Sequel Pro is an easy way to manage your databases on macOS. Getting started is a simple process; you download the application, install it, and then launch Sequel Pro!

Setting up a New Database Connection

When you launch Sequel Pro, if you have no databases set up yet, you'll be greeted by the screen that asks you to create a new server connection.

Sequel Pro - New DB

The above is the connection information for a standard database, but you can also choose the SSH tab to use SSH to connect to your database, depending on your server's configuration and security.

Sequel Pro - New DB 2

The requested details are relatively straightforward.

  • Host - The IP or URL used to access the database
  • Username - The username of a MySQL user (one with the correct permissions to read from or write to the database)
  • Password - The password of a MySQL user (one with the correct permissions to read from or write to the database)
  • Database - The name of the specific database to which you intend to connect
  • Port - The port via which to connect to the server. The default is 3306 for a standard MySQL connection.

And if the type of new connection is SSH, you'll need to provide your SSH host, username, password, and a port (defaults to 22) as well. If you would prefer to use an SSH key, you can click the key icon by the password field to allow the selection of a key file from your Mac's filesystem.

Once you've connected to your database, you'll be presented with the Structure View.

Structure View

Sequel Pro - Structure

The structure view is just what it says - the view that allows you to see, and modify, the structure of the database. Tables are listed on the left, and the right pane contains a list of fields for the currently selected table, and their respective properties. Here you can edit fields, altering their names, giving them default values, altering their encoding schema, altering their maximum length, or making them keys for their table. You can also create new fields in this view.

Content View

Sequel Pro - Content

The content view is where you'll be looking at or modifying the actual values in your database tables. You can run searches, using the bar and the filters at the top, searching against the values of any field. Records can be modified after being selected, and the plus symbol at the bottom of the window will allow you to add new ones. Editing content here will be familiar to anyone who has used another GUI for editing. It's a nicer interface than most desktop programs available, though, and very easy to use.

Continue reading %How to Use Sequel Pro to Manage MySQL Databases on macOS%


by Jeff Smith via SitePoint

These 5 things are killing your Facebook ads’ ROI (and how to fix the problem in a flash)

Do you feel that you have done your best launching your Facebook Ad? Followed all the guides and considered all the hints and tips that came into your sight and yet? The results are far away from what you had been expecting? Don’t fret about it, you’re not the first and surely not the last one...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Guest Author via Digital Information World

The Web’s Most Annoying Dark Patterns

We have created a monster. Despite living and working on the web, many of us detest the ways in which the technology is abused. A few frustrations are inevitable but many techniques are malicious -- if not edging on fraudulent. Other dark-patterns are just plain stupid.

Here is a list of my top web irritations. I won't shame anyone directly but, when I encounter these, I'm tempted to give it all up and go live on a beach…

Web Page Bloat

I've complained many times but few developers care about page load times or performance. Average page weight reached 2,884kb in May 2017. That's an average for content pages -- not apps, not games, not social networks.

Is user experience improving by more than 20% every year? I think not.

Needless Multi-Page Articles

Splitting a long article into separate pages is fine. Splitting a short article into sentence-sized pages to increase your advertising impressions is not.

Continue reading %The Web’s Most Annoying Dark Patterns%


by Craig Buckler via SitePoint

Bilberrry Web Development

Whether you are launching a new website, building a new web/mobile application or pursuing new online marketing strategies, Bilberrry has you covered. The internet is part of our identity, and we are here to make it part of yours as well.


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

Plickt Website e Design

WordPress theme responsive with HTML5/CSS3 + Javascript/jQuery for Plickt on Brazil, Santa Catarina.


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

Bookblock

Bookblock are a design led manufacturer of Stationery and Leather. As well as offering an extensive range of customisable stock products Bookblock offer brands, organisations and individuals around the world the capability of designing and building c


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery