Javascript News

Syndicate content
Pipes Output
Updated: 48 weeks 6 days ago

The 30 Best Websites to Learn Marketing for Free

Fr, 2015-08-14 07:29

  Between January 2011 and January 2015, the number of job listings on Indeed containing “content marketing” or “content strategy” grew by about 350 percent; therefore, I think it’s safe to assume some of you startup founders are hiring a marketer or two. But how many of you actually know anything about digital marketing, specifically […]

Continue reading %The 30 Best Websites to Learn Marketing for Free%

WP API – Using the WordPress REST API

Do, 2015-08-13 19:00

Before we discuss the WP REST API, it's important to understand some terminology and background information. The acronym API stands for Application Programming Interface. An API is a programmatic way to interact with an application's data. For example, Facebook's API gives developers the ability to get all of the friends associated with a certain user. An API typically includes a specific set of instructions called documentation; to make it easy for any developer to work with it.

REST means Representational State Transfer. An API can be considered RESTful if its design/architecture subscribes to a specific set of constraints. You can look up what these constraints are here.

HTTP requests are often the way that you interact with a RESTful API (HTTP requests are also the primary way that data is transmitted across the Internet). HTTP means Hyper Text Transfer Protocol. This protocol allows information to be shared between a client (cell phone, tablet, laptop, desktop, etc.) and a web accessible server in a request-response protocol. As an example, in order to publish a status to a user's Facebook timeline, a HTTP request targeting that action on behalf of that user would be sent from our JavaScript code to Facebook's API (ie. a Facebook server). The client (JavaScript code) would receive a response from the Facebook server indicating that the user's status was successfully published.

1. A client makes a HTTP request to a server and 2. The server responds with an HTTP response.

In a HTTP request, you need to define the type of action that you want to perform against a resource. There are four primary actions associated with any HTTP request (commonly referred to as CRUD):

  1. POST (Create)
  2. GET (Retrieve)
  3. PUT (Update)
  4. DELETE (Delete)

A resource is a data object that can be accessed via a HTTP request. The WP REST API allows you to "access your WordPress site's data (resources) through an easy-to-use HTTP REST API". In the case of the most recent version of the WP API (version 2), the resources include the following 9 WordPress objects:

  1. Posts
  2. Pages
  3. Media
  4. Post meta
  5. Post revisions
  6. Comments
  7. Taxonomies
  8. Terms
  9. Users

With the WP API, you can perform any of the four CRUD actions against any of your WordPress site's resources listed above. For example, you can use the WP API to create a post, retrieve a post, update a post or delete a post associated with your WordPress website.

Continue reading %WP API – Using the WordPress REST API%

Video: Exploring the Xcode Interface

Do, 2015-08-13 17:30

Xcode is where all the magic happens. Just like a great artist can weld any brush to his will, we're going to pick up some great tips on getting very efficient with Xcode. This includes keyboard shortcuts, which can greatly improve your productivity.

Loading the player...

Continue reading %Video: Exploring the Xcode Interface%

The Pathway for New Railists

Do, 2015-08-13 14:30

For a while I was skeptical about writing this, till I saw a post on reddit where a user was asking for books on Rails to read. There are lots of articles online to suggest books, so in this article we eil go beyond merely suggesting books.

As a new Rails developer, it is advisable to follow a structured course if you want to be a proficient developer. The offering online is wide, and here are my own suggestions.

Learn Ruby First?

There are differing opinions on this. Some believe learning Ruby first is important, while others believe you can learn Rails first, and Ruby will follow.

Here is my opinion: "Learn Ruby first!" Why?

If you want to understand what is happening under the hood, you need the knowledge of Ruby. Here is a suggested Ruby pathway to get you going. Follow that path, then step on to this one.

Thou Shalt Learn Git!

There are no different opinions on this. Knowledge of git is important! Git is a distributed version control system, and Ruby/Rails developers use it all the time. You can learn about it using the book - Pro Git v2. Seriously, get comfortable with git first.

Books The Ruby On Rails Tutorial

This may be the defacto book for anyone who wants to venture into Rails development. Tell anyone you want to learn Rails and you will likely get a recommendation for THE Ruby on Rails Tutorial. Trust me when I say this is not the normal kind of Rails tutorial you find on any blog. The author, Michael Hartl, takes you through the process of building a Twitter clone application from the ground up. He does this without any user authentication gem, you can be sure that it is a thorough (and not contrived) tutorial. Some important concepts covered in the book are:

  • Git
  • Deploying to Heroku
  • Testing
  • Github

Continue reading %The Pathway for New Railists%

Writing better JavaScript with Flow

Mi, 2015-08-12 20:00

Testing plays an important role in the development of any product. As your application becomes more complex and you continue adding new features, you need to verify that your additions haven’t introduced bugs to your existing functionality. We often prefer to write code that can be easily tested but in those cases where the code hasn’t been written with testing in mind, our duty is to "make things testable". In both these approaches we are forced to write some extra code. Flow promises to solve this problem as far as type checking is concerned.

Flow is a static type checker for JavaScript first introduced by Facebook at the Scale Conference in 2014. It was conceived with a goal of finding errors in JavaScript code, often without messing with our actual code, hence consuming little effort from the programmer. At the same time it also adds type syntax to JavaScript that provides more control to the developers.

In this article, I'll introduce you to Flow and its main features. All the code reported in this article are available on GitHub.

Continue reading %Writing better JavaScript with Flow%

How to Improve Loading Time with basket.js

Mi, 2015-08-12 20:00

For modern Web pages, scripts are obviously a crucial element. Their weight is growing in terms of importance and the amount of bytes. For instance, think of single page applications and the amount of code they need to give us all the features and animations required, without having to hit the Reload button on our browser. The total size of scripts in a page is far from the one of video and audio files, but it's getting closer to the size of images.

In this article, I'll test the performance of two of the most visited websites, Facebook and Twitter, highlighting some of their major issues. Then, I'll focus on how to improve the loading time of the scripts of a page by introducing you to a library called basket.js.

Measuring the Performance of Facebook and Twitter

Before covering what basket.js is and what problem it solves, let's start with a real-world example. Let's use a tool like the Chrome Developer Tools or F12 Developer Tools to measure the number of bytes transferred and the loading time of the Facebook wall. To perform this task in a reliable way, you have to hard reload the page in your browser and empty the cache, of course. If you need more instructions, this tweet by Addy Osmani will help you.

Said that, what’s the total size of scripts loaded for the average Facebook wall (ballpark) and what’s the ratio images/scripts? And regarding the challenge of CSS versus JavaScript, which one is going to be heavier? Take a guess and write your answers down but... don’t cheat!

Continue reading %How to Improve Loading Time with basket.js%

manifoldJS with Crosswalk, A Simpler Dev Experience for Android

Mi, 2015-08-12 18:30

This article is part of a web dev series from Microsoft. Thank you for supporting the partners who make SitePoint possible. With version 0.3.0 of manifoldJS you can now choose to build your Android apps with Crosswalk instead of the traditional Android webview. It’s quite simple to implement as well. If you’re not familiar, manifoldJS […]

Continue reading %manifoldJS with Crosswalk, A Simpler Dev Experience for Android%

Video: Using map() to Create Lists in React

Mi, 2015-08-12 17:30

In this video, we'll build our first list component. We'll use props, a plain old JavaScript Array, and the map() function. If you have no previous experience with the map() function, don't worry. This is a very gentle introduction to map() with bunch of examples!

Loading the player...

Continue reading %Video: Using map() to Create Lists in React%

7 Photoshop Master Tips to Boost Your Productivity

Mi, 2015-08-12 15:30

There are literally millions Photoshop users out there, but how many of them use the application at its full potential? Maybe 10%? Less that 5%?

Lots of users learn enough Photoshop to get by and never go beyond that limit. Even sometimes after years of working with the program, they still work like hobbyists. Once they're used to work in such a way, it's hard for the bad habits to be broken.

If you want to master Photoshop, it helps to establish good habits and good processes as early as possible. The tips below are designed to help you in this undertaking. Most of them do require initial extra time and efforts, but the benefits you'll gain in the long run are definitely worth it.

For the sake of brevity, I'll mostly talk about broad approaches to working more efficiently with Photoshop, rather than detailed instructions. For step-by-step breakdowns of each task, consult the Photoshop's documentation or you can search the Web for practical solutions and tutorials.

1. Tweak Your Preferences for Maximum Performance and Usability

Taking ownership of Photoshop's preferences is a boring but indispensable job if you plan to use the program optimally. Photoshop demands an enormous amount of computer resources, especially when working on large documents or you have opened multiple files.

If the program is poorly optimized, your workflow will be drastically slowed down. In contrast, properly set Photoshop preferences lead to faster performance, which means that you'll accomplish your tasks with a greater speed and less headache.

Let's see what the most crucial performance preferences are and how to adjust them:

  • Reduce the number of History States. History States designate for how many undos are available. Having many undo states might be good for you but it slow down the application performance. Increasing the number of History States means Photoshop uses bigger amount of RAM to manage the History panel.
  • Tweak the number of Cache Levels. Image caching helps Photoshop to redraw heavy, high-resolution images faster. It uses low-resolution versions of images to update the image more quickly. When you're working on high-resolution images or large documents, more Cache Levels (6 is good) will speed up the redraw process. On the other hand, when you're working on smaller documents you might need lowering the Cache Levels (2 is good), thus freeing more RAM and making Photoshop operates faster.
  • Set the proper Scratch Disks. I already told you that Photoshop is a resources eating beast. It uses not only the available RAM but also the free space on any available hard drive referred to as a Scratch Disk. By default Photoshop uses your primary hard drive as a scratch disk. But if you have additional drives you can use them instead. This will prevent damaging your boot drive and will increase the processing speed of Photoshop. For the best results, you should select a hard drive different from the one containing the image file you're working on and with plenty of free space.
  • Give Photoshop more RAM to operate on. Photoshop's favorite meal is RAM and its main motto: "The more RAM, the better." You can satisfy these Photoshop needs by increasing the amount of RAM the application is allowed to use. If you don't use too many programs opened you can safely set higher value (for example, 85%). But if you use Photoshop along with other applications (browser, word processor, Skype, etc.) make sure there is enough memory for them too. After all they are also hungry.

To insure that all of the above settings have taken affect you must restart Photoshop.

The performance is the first thing you should improve but there are also many usability preferences, which you can tweak to make using the program more comfortable. Bear in mind that not everyone agrees with the same usability settings, so you'll need to customize them to satisfy your own taste. This will make your workflow smoother and enjoyable.

2. Use Different Workspaces for Different Types of Tasks

Specific tasks require specific workspaces. Using one and the same workspace for every task you perform is simply not productive. Professional photographers have many different lenses and filters for use in different situations. They might still get the job done shooting with just one lens but the quality of the final result will suffer.

In the case of Photoshop, the quality may well be the same, but the amount of time spent by you will be way much longer.

Instead of re-designing your workspace every time you switch to a different task or project, it's far better to create your own specific task-oriented workspaces to use when needed.

Photoshop provides several default workspaces, such as Painting, Photography, and Typography. They are good for a quick start, but customizing workspaces to fit your personal and project needs can further improve and speed up your workflow.

A productive workspace should have all tools and panels you are likely to use while working on a particular task. All unnecessary or distracting stuff should be removed.

For example, if you design a lot of text-heavy illustrations, you would need the Character and Paragraph panels, but you're far less likely to need the Histogram panel. Here is an example of a workspace fine-tuned for text editing:

[caption id="attachment_112345" align="aligncenter" width="800"] The Typography Workspace prioritizes type oriented tools and panels.[/caption]

3. Customize Photoshop’s Default Menus

In his 2004 book “The Paradox of Choice”, Barry Schwartz shows us how having too many 'choices' becomes debilitating–even paralyzing–to shoppers. A similar effect applies to Photoshop users.

Customizing Photoshop’s default menus may not seems a big deal, but if your aim is maximum performance and usability you should do it. There are hundreds of options in the menus and it costs time to navigate through them.

So, if you don’t want or need to see certain menu items for particular workspace, you can turn their visibility off, thus making the menus more compact.

For quicker navigation you can also highlight certain menu items with specific color. A colored menu item is far easier to spot, rather than a regular one.

4. Get the Habit to Name and Organize Your Layers Properly

Layers are the "soul" of Photoshop and every other graphics editor–in fact it's hard to imagine the product without layers. As such it's important to master good layer management.

We've all had that friend who allows hundreds of files to accumulate on their desktop. Don't be that guy with Photoshop layers, and instead get into the habit of naming and organizing files as soon as you create them.

Even with Photoshop's improved layers searching capability don't get you off the hook. The searching and filtering options only work if your layers are sensibly named and organized.

Continue reading %7 Photoshop Master Tips to Boost Your Productivity%

Creating a PhoneRTC Calling App – Server Side

Mi, 2015-08-12 15:00

In the first part of this series we created the client side of our PhoneRTC application and in this article we create the server side that coordinates clients.

Signaling Server

The server-side component of the app is called the “signaling server”, as it’s used for exchanging information between peers.

Start by creating a new koler-server directory outside the www directory. Everything inside the www directory is packaged when building the app and we don’t want the server component included. Inside the new directory, open your terminal and install express, lodash and Socket.io as dependencies.

Continue reading %Creating a PhoneRTC Calling App – Server Side%

BDD in Laravel: Getting Started with Behat and PhpSpec

Mi, 2015-08-12 14:00
Getting Started with BDD in Laravel Introduction

BDD is a complicated subject for many developers, and getting started with it the right way often does not come easy - especially when needing to implement it into existing frameworks. This tutorial aims to help you get a BDD-powered Laravel project up and running in very little time, introducing you to the basic concepts and workflow you’ll need to proceed on your own. We’ll be installing and using Behat and PhpSpec.

In the tutorial, we assume you’re working on a Unix system and have basic theoretical knowledge of what BDD is about, but little or no practical experience.

We’ll also assume that us saying “Run the command” implies the command should be run in the terminal of the operating system.

Prerequisites

Optionally, if you intend to build what we set up here into a proper application, add in:

  • a database (MySQL)
  • Caching layers (Redis, Memcached…)
Creating a New Laravel App

To create a new Laravel application, we run the following command:

composer create-project laravel/laravel bdd-setup

The sample application is now created, and should greet you with “Laravel 5” if you visit the root of the app.

Setting up Behat

Several packages are required in order to make Behat play well with Laravel. Let’s install them all into our application’s development environment (with the --dev flag) and explain each.

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev sudo ln -s /home/vagrant/Code/bdd-setup/vendor/bin/behat /usr/local/bin/behat

behat/behat is the main package for Behat. The behat/mink package is used to emulate a browser, so we can have the test suite check our URLs and their output. behat/mink-extension is the glue for Mink and Behat, and the last package, behat-laravel-extension is Jeffrey Way’s own implementation of Behat bindings, specifically made for Laravel.

The last sudo ln -s line is optional, and adds Behat’s executable to a location in the $PATH, so the behat command can be executed without the vendor/bin prefix from our project’s root folder. In other words, behat --init instead of vendor/bin/behat --init.

Continue reading %BDD in Laravel: Getting Started with Behat and PhpSpec%

Versioning Large Files with Git LFS

Di, 2015-08-11 22:00

Versioning large files can be problematic with distributed version control systems like Git. Git Large File Storage (or LFS) is a new, open-source extension to Git that aims to improve handling of large files.

It does this by replacing large files in your repository—such as graphics and videos—with simple text pointers. These pointers reference the large files, which are hosted elsewhere, either by GitHub or another external source such as an AWS bucket.

Initially this is confusing, but hopefully LFS will make more sense by the end of this tutorial.

Availability

LFS will be available to all GitHub users soon, but as I'm handling a lot of large files through GitHub with my Chip Shop board game, I signed up to the early access program to find out more.

Note: Unless you have Git LFS enabled on your account, this tutorial won't work for you yet, but you can get an idea of the future feature.

Installing

If you have a Linux- or Windows-based system, visit git-lfs.github.com, download the installer, unarchive it and run the installer script.

If you have a Mac, do the same, but Git LFS is also available via Homebrew: install with brew install git-lfs.

Getting Started

Note: Git LFS will currently only work when using Git on the command line. I normally use Tower for managing my Git workflow, and this broke any LFS-related actions.

Create a Git repository as you normally do, and initialize the files you wish to track with LFS by issuing commands such as:

[code language="html"]git lfs track "*.psd"[/code]

[code language="html"]git lfs track "*.mp3"[/code]

Then use git as normal:

[code language="bash"]git add *.psd
git commit -m "Added PhotoShop files"
git push origin master[/code]

Continue reading %Versioning Large Files with Git LFS%

Adding a Stylish Lightbox Effect to the WordPress Gallery

Di, 2015-08-11 19:30

WordPress comes with built-in gallery functionality. Adding a gallery to a post or page involves performing a few simple steps:

  1. Click the Add Media button
  2. Click the Create Gallery link
  3. Select your images by clicking on them
  4. Enter at least the Title and Alt text into the appropriate textbox and click the Create a new gallery button

What WordPress doesn’t offer out of the box is the ability to zoom in on each gallery image with a cool lightbox effect.

In fact, you can adjust the gallery settings so that images link to a dedicated page (i.e., attachment page), to the image file itself, or to nothing at all.

In this post, I’m going to show how to integrate the popular jQuery Colorbox plugin by Jack Moore into the native WordPress gallery.

Continue reading %Adding a Stylish Lightbox Effect to the WordPress Gallery%

7 Tips to Taking the Guess Work Out of Choosing Stock Imagery

Di, 2015-08-11 18:30

This article was sponsored by Adobe. Thank you for supporting the sponsors who make SitePoint possible.

Stock imagery has become a huge part of the design process for graphic designers. The old adage is true that an image equals a thousand words.
Finding just the right image can reinforce the message you're trying to send on behalf of your clients. One of the biggest decisions a designer can make is choosing the right image. It can be tough to sort through all of the images that will work and won't work in a given design piece.
In this article we’ll take a look at some tips for choosing the perfect stock imagery for your project.

1. Lay Out the Content First

I know you'll be tempted to hop onto Adobe Stock and start looking around for images first — that’s the fun part, after all — but this may get you into trouble. You never really understand how much content you have or how much space you really have to work with until you get a real look at how much content you have to fit on a page.
Begin arranging and grouping elements until you have an arrangement you're happy with. This is a good starting point before you go searching for images because you'll have a better idea of what you'll really need, and actually use. How many times have you chosen a stock photo, downloaded it, and then you just couldn't get the content to fit?

2. Plan the Image's Destination

The placement of the image can make all the difference when it comes to choosing a type of image. If you have design elements or text around the edge of where the photo will be placed, you'll want to pick an image that has plenty of breathing room built in. The last thing you'll want is to have a crowded design.
Also, if there is an object or a person in the image, make sure that there is plenty of space around the edges of the image. This will give you room to scale and crop the image without having to worry about everything fitting in the design.
The example image above could be scaled, without losing the subject. It could be cropped, depending on the subject, only showing them from the waist up, still giving the impression they are in a tropical setting.

Continue reading %7 Tips to Taking the Guess Work Out of Choosing Stock Imagery%

The Top 18 Finds This Week

Di, 2015-08-11 17:34

  I’m that annoying co-worker. You know the one – the one who sends a million one-line emails with links for you to click on because she thinks they’re cool as ****. What I forget is that everyone does not like reading as much as I do so when I realized I was annoying some […]

Continue reading %The Top 18 Finds This Week%

Video: Understanding Android Differences

Di, 2015-08-11 17:30

In this video we'll look at understanding the differences between Android devices, system versions and the components that comprise the Android Operating System.

Loading the player...

Continue reading %Video: Understanding Android Differences%

Material Design with the Android Design Support Library

Di, 2015-08-11 17:00

Material Design, a new design language that gives design guidelines for Android apps and apps on other platforms, was introduced with the release of Android 5.0 Lollipop.

With it came new UI components such as the ‘Floating Action Button’. Implementing these new components while ensuring backward compatibility was typically a tedious process. Third party libraries would usually be needed to streamline the process.

At this year’s Google IO conference, Google introduced the Android Design Support Library which brings a number of important material design components to developers. The components are backwards compatible, with support back to Android 2.1 and implementing them is easier than previously. The library includes a navigation drawer view, floating labels for editing text, a floating action button, snackbar, tabs and a motion and scroll framework to tie them together. In this tutorial we’ll create an app that showcases these components.

Continue reading %Material Design with the Android Design Support Library%

Masking Passwords: Help or Hindrance?

Di, 2015-08-11 15:30

Sometimes the details make all the difference.

Typing your phone number into an online form and being told "no spaces allowed" is infuriating. It's a tiny part of the overall user experience, but it can totally change the feeling from seamless to clunky.

Password masking is another such detail. Password masking is that familiar practice of hiding the password characters – as entered by the user – behind bullets (●), asterisks (*), or similar camouflaging characters.

The idea behind masking is to prevent nearby observers reading the password "over the user's shoulder" and thus stolen. But there are a few significant disadvantages that may outweigh this primary advantage.

Problems with password masking Masking the password also hides it from the user

In our attempts to maximise security, too often we severely compromise usability. There's not much point in building a secure system if that security drives people away from using it!

Password masking is one of those examples where the by-product of security is a poorer user experience. By masking the password to protect against the vanishingly small chance a criminal is not only in the room, but no more than a few metres behind you, we're impairing every legitimate user. This means users can't:

  • see whether they've typed the right thing; or
  • easily correct their password if they get an error.

In turn this will mean a longer and more frustrating user experience. And these difficulties may lead users to choose far less secure – but easier to type – passwords, which poses a much more significant security risk.

"Over the shoulder" attacks aren't as common as we may think

Bruce Schneier, world renown security specialist, says it best in his post The Pros and Cons of Password Masking:

I believe that shoulder surfing isn't nearly the problem it's made out to be. One, lots of people use their computers in private, with no one looking over their shoulders. Two, personal handheld devices are used very close to the body, making shoulder surfing all that much harder. Three, it's hard to quickly and accurately memorize a random non-alphanumeric string that flashes on the screen for a second or so.

This is not to say that shoulder surfing isn't a threat. It is. And, as many readers pointed out, password masking is one of the reasons it isn't more of a threat. And the threat is greater for those who are not fluent computer users: slow typists and people who are likely to choose bad passwords. But I believe that the risks are overstated.

Continue reading %Masking Passwords: Help or Hindrance?%

Using @error responsibly in Sass

Di, 2015-08-11 14:00

Since Ruby Sass 3.4 and LibSass 3.1, it is possible to use the @error directive. This directive, similar to @warn, intends to kill the execution process and display a custom message to the current output stream (likely the console).

Needless to say this feature is greatly helpful when building functions and mixins involving a bit of Sass logic, in order to control author's input and throw an error in case anything goes wrong. You have to concede this is better than letting the compiler fail miserably, isn't it?

Everything is great. Except Sass 3.3 is still broadly used. Even Sass 3.2 at some places. Updating Sass is not always an easy task especially on large projects. Sometimes, spending time and budget on updating something that works fine is not an option. For those older versions, @error means nothing and is treated as a custom at-directive, which is perfectly allowed in Sass for forward-compatibility reasons.

So does that mean we can't use @error unless we decide to only support recent Sass engines? Well, you can imagine there is a way, hence this article.

What's the idea?

The idea is simple: if @error is supported, we use it. Else, we use @warn. Although @warn does not prevent the compiler from going any further, so we might want to trigger a compilation error after warning so that the compilation crashes for good. Enjoy it, it's not that often that you can recklessly crash something.

Continue reading %Using @error responsibly in Sass%

The ES6 Conundrum

Mo, 2015-08-10 21:30

ECMAScript6 or ES6 is the evolution of JavaScript and it is the future. It is the technology innovation for the web we’ve all been waiting for. It is full of great functionality we always craved and it finally enables us to build huge applications for the web in a scalable and easy to maintain manner. It empowers thousands of developers coming from Java or C# or other “higher” languages to finally write JavaScript and bring all the goodness of their experience to a market in dire need of organization and direction.

That’s the sales pitch and -- to be fair -- a lot of it is true. However, it also makes a lot of assumptions as to what needs fixing on the web. And there is a real problem with evolving a language as ubiquitous as JavaScript without having control of the environments it is executed in. The web is a distributed platform. It is much harder to change the wheels on a vehicle that is constantly in motion than on one you can bring back to the shop, lock up, upgrade and drive out again.

JavaScript Doesn’t Seem to Cut It Any Longer

The, shall we say, lenient architecture of JavaScript has always been a source of confusion for programmers coming from other languages. Especially the lack of classes and prototypical inheritance is a no-go for a lot of people. It feels counter-intuitive and it doesn’t represent what is being taught in schools about computing. To make matters worse, we have the beautiful, but confusing construct of closures and a lack of constants and type safety. All that meant that JavaScript got a reputation for being badly architected and not to be trusted with large code bases. Despite all this, it managed to evolve into one of the most used languages in software development now - to a large part thanks to the rise of the web.

ES6 and the following versions of the language are meant to do away with these annoyances and make JavaScript a better, more reliable and more efficient language.

This, to be fair, is nothing new. We had a few languages that built on JavaScript in the past and tried to fix these issues. TypeScript, Dart, CoffeeScript and even Flash’s ActionScript all tried to solve the same issue. The difference was that they all needed some kind of conversion or container to show up in the browser. ES6, now that it is finalized, is intended to be native to the browser and run just like JavaScript using a script element pointing to it. ES6 has a lot of impressive features:

  • Arrow functions as a short-hand version of an anonymous function.
  • Block-level scope using let instead of var makes variables scoped to a block (if, for, while, etc.)
  • Classes to encapsulate and extend code.
  • Constants using the const keyword.
  • Default parameters for functions like foo(bar = 3, baz = 2)
  • Destructuring to assign values from arrays or objects into variables.
  • Generators that create iterators using function* and the yield keyword.
  • Map, a Dictionary type object that can be used to store key/value pairs. and Set as a collection object to store a list of data values.
  • Modules as a way of organizing and loading code.
  • Promises for async operations avoiding callback hell
  • Rest parameters instead of using arguments to access functions arguments.
  • Template Strings to build up string values including multi-line strings.

Considering what we’re doing with JavaScript these days, this seems to be a real need. Gaming, App Development and even server side development all are possible in JavaScript. And with each environment we have developers that are used to different tools and methodologies. The wild west web development of the past seems to be counterproductive to the performance and maintenance needs of today. This reminds me of the time when we moved from DHTML to DOM Scripting. Order, we need order and reliability.

Where this falls apart is that currently ES6 is far from ready to be deployed on the web. That is not the fault of the language, but of the nature of the web. We can’t and shouldn’t dictate what people use to surf the web. But the support for ES6 in different current browsers is not encouraging.

The bigger problem is that ES6 breaks the device and browser-independent idea of the web for the first time in the history of JavaScript.

Continue reading %The ES6 Conundrum%