JavaScript for Line of Business Applications
507.4K views | +125 today
Follow
JavaScript for Line of Business Applications
Keeping track of current JavaScript Frameworks that help design your clientside Business Logic Layers.
Curated by Jan Hesse
Beam to my Inbox:
Your new post is loading...
Your new post is loading...
Scoop.it!

Keeping Promises With JavaScript

Keeping Promises With JavaScript | JavaScript for Line of Business Applications | Scoop.it

Get out of callback hell with Promises. Promises are an exciting new feature in JavaScript that makes asynchronous methods much easier to manage.

more...
No comment yet.
Scoop.it!

Concurrently JavaScript

Concurrently JavaScript | JavaScript for Line of Business Applications | Scoop.it

What is concurrency? How is it different from parallelism? JavaScript is single-threaded on the event loop, so how does its asynchrony fit into the mix?

These are great questions, but sadly, I think most JS developers are not really asking them enough. The concepts behind writing concurrent code are incredibly important, but we tend to only focus on the API provided to us by some library or framework. These APIs have a tremendous capability to shape our thoughts about the underlying functionalities, and often not in accurate or productive ways.

I want us to talk first about the concepts around concurrency before we focus on what we can do with some API or pattern. Don’t worry: following parts of this blog post series will talk more about APIs, if that’s what really gets you excited. But don’t skip over these concepts.

more...
No comment yet.
Scoop.it!

We have a problem with promises

We have a problem with promises | JavaScript for Line of Business Applications | Scoop.it

Fellow JavaScripters, it's time to admit it: we have a problem with promises.

No, not with promises themselves. Promises, as defined by the A+ spec, are awesome.

The big problem, which has revealed itself to me over the course of the past year, as I've watched numerous programmers struggle with the PouchDB API and other promise-heavy APIs, is this:

Many of us are using promises without really understanding them.

Some people try to explain promises as a cartoon, or in a very noun-oriented way: "Oh, it's this thing you can pass around that represents an asynchronous value."

I don't find such explanations very helpful. To me, promises are all about code structure and flow. So I think it's better to just go over some common mistakes and show how to fix them. I call these "rookie mistakes" in the sense of, "you're a rookie now, kid, but you'll be a pro soon."

more...
No comment yet.
Scoop.it!

ES6 Generators: How do they work?

ES6 Generators: How do they work? | JavaScript for Line of Business Applications | Scoop.it
Ever wonder what kind of magic is required to make ES6 generators work in ES5? Today we will find out, and learn a lot about generators along the way.

You might have heard of the importance of writing “non-blocking” javascript. When we do an I/O operation, like make an HTTP request or write to a database, we generally want to use something like callbacks or promises. Performing a “blocking” operation would cause the entire program to freeze, which in most cases is not a viable option. Imagine if all of your users had to sit and wait any time someone else wanted to interact with the system.

more...
No comment yet.
Scoop.it!

async tasks with es6 generators

async tasks with es6 generators | JavaScript for Line of Business Applications | Scoop.it

ES6 generators seem to be a very good fit for handling asynchronous actions. I've been using a library, generator-runner, which uses ES6 generators for running async tasks. To use the library you create a runner that takes two parameters:

  1. A generator function. Within this function you yield to a async task. The async task is invoked with a callback to continue the generator (calling next). The callback returns the value for the yield expression. The runner then takes the value for yield expression and returns it.
  2. A callback to handle the return of the generator. The return value from the previous step is handled here.
more...
No comment yet.
Scoop.it!

An introduction to reactive programming

An introduction to reactive programming | JavaScript for Line of Business Applications | Scoop.it

Can we do better? Can we combine the simplicity of synchronous code with the efficiency of the asynchronous approach? It turns out we can. Futures are an abstraction that allow us to express the effect of latency in asynchronous computations, encapsulate event-handling code, and use higher-order functions such as map, reduce, and filter, to compose clean and readable asynchronous code.

We will explore this by looking at a web-scraping word count example. First, we’ll write simple synchronous code and consider how this code may look rewritten with a callback-based asynchronous framework such as Node.js or Netty. Then, we’ll use promises to turn callback-based building blocks into functions returning futures, allowing us to compose code using functional programming constructs.

more...
No comment yet.
Scoop.it!

Traceur ES6 Generators

Traceur ES6 Generators | JavaScript for Line of Business Applications | Scoop.it
Generators are functions which can be exited and later re-entered.

ES6 comes with a new feature named Generator.Generators comes with many feature to be used by JavaScript developer.
I am going to post multiple articles on ES6 generators.This is part1 to get introduced with ES6 generator.In the upcoming posts we will learn more usage of Generators.

Jan Hesse's insight:

http://www.tutorialsavvy.com/2015/03/traceur-es6-generators-part-2.html/

http://www.tutorialsavvy.com/2015/03/traceur-es6-generators-part-3.html/

http://www.tutorialsavvy.com/2015/03/traceur-es6-generators-part-4.html/

more...
No comment yet.
Scoop.it!

No promises: asynchronous JavaScript with only generators

No promises: asynchronous JavaScript with only generators | JavaScript for Line of Business Applications | Scoop.it

Two ECMAScript 6 features enable an intriguing new style of asynchronous JavaScript code: promises and generators. This blog post explains this new style and presents a way of using it without promises.

Before ECMAScript 6, you couldn’t pause and resume the execution of code, but you could simulate it, by putting console.log(result) into a callback, a so-calledcontinuation.

more...
No comment yet.
Scoop.it!

Handle asynchronous non-blocking IO in JavaScript

Handle asynchronous non-blocking IO in JavaScript | JavaScript for Line of Business Applications | Scoop.it

One of the big “WTF” hurdles for apprentice JavaScript developers, that come from languages that mostly embrace synchronous and blocking IO APIs like Java or PHP is to get into thinking asynchronously about everything IO related in JavaScript with its event loop construct.

It is actually one of the cool things about JavaScript and why NodeJS on the server got so much attention in the beginning, so it is something anyone at least half serious about learning JS should learn about.

more...
No comment yet.
Scoop.it!

Node.js Flow - Callback Hell vs. Async vs. Highland Streams

Node.js Flow - Callback Hell vs. Async vs. Highland Streams | JavaScript for Line of Business Applications | Scoop.it
In this post we'll be comparing node.js and javascript application flow using callbacks, the async library and highlands streams.
more...
No comment yet.
Scoop.it!

Asynchronous calls with ES6 generators

Asynchronous calls with ES6 generators | JavaScript for Line of Business Applications | Scoop.it

A few months ago Jake Archibald wrote an article about the awesomeness of the asyncfunctions in ES7 and how we can “emulate” them using ES6’s generators, using his spawn function, which has subset of the features of co.

In this blog post we’ll take a look at standard ways of handling asynchronous calls and how we can improve the readability of our code using generators. We’ll also take a further look at the implementation of spawn, since there are few tricky moments there.

more...
No comment yet.
Scoop.it!

Working with Multiple Values in a Promise Chain using Stateful Context

Working with Multiple Values in a Promise Chain using Stateful Context | JavaScript for Line of Business Applications | Scoop.it

In one of our project’s test code, we have to create many objects asynchronously and use them later in our tests. Our codebase is promise-based, so we have to chain these promises in a way that makes it possible to access all the variables we want in later time.

There are many ways to do this, which we’ll explore.

more...
No comment yet.
Scoop.it!

Continuations

Continuations | JavaScript for Line of Business Applications | Scoop.it
There is one abstraction that can be used to implement such apparently diverse concepts as exceptions, generators, coroutines and even the backtracking mechanism present in Prolog.

This article demonstrates how to use continuations to implement these constructs in a custom, small programming language. Then the implementation of an interpreter for that language is presented.

Finally a Java servlet is demonstrated. It uses continuations with server-side JavaScript to simplify writing complex workflows that hide the request/response cycle of HTTP.

more...
No comment yet.
Scoop.it!

Taking advantage of Observables in Angular 2

Taking advantage of Observables in Angular 2 | JavaScript for Line of Business Applications | Scoop.it
Angular 2 favors Observables over Promises when it comes to async. The rational behind this decision may not be obvious right from the start. There is definitely a learning curve to master Observables in all their beauty. In this article we like to explore some practical advantages with Observables for server communication.
Jan Hesse's insight:

FollowUp: http://blog.thoughtram.io/angular/2016/01/07/taking-advantage-of-observables-in-angular2-pt2.html

more...
Scoop.it!

Replacing callbacks with ES6 Generators

Replacing callbacks with ES6 Generators | JavaScript for Line of Business Applications | Scoop.it

By Matt Baker There are a lot of articles out there discussing the use of ES6 generators to remove the “callback pyramid” we so often encounter in JavaScript. Unfortunately, most of them rely on libraries, and few tell the whole story.

more...
No comment yet.
Scoop.it!

Embracing Promises in JavaScript

Embracing Promises in JavaScript | JavaScript for Line of Business Applications | Scoop.it

In this post we will look at how we can embrace promises to lead to much nicer code when working asynchronously with JavaScript. This post is not a full, in-depth exploration of Promises.

Throughout this post I will be working using the es6-promise library, a polyfill for the native Promise implementation that will exist in ECMAScript 6. 

more...
No comment yet.
Scoop.it!

core-js - ES6 polyfill library

core-js - ES6 polyfill library | JavaScript for Line of Business Applications | Scoop.it

Modular compact standard library for JavaScript. Includes polyfills for ECMAScript 5ECMAScript 6symbolscollectionsiteratorspromisesECMAScript 7 proposalssetImmediatearray generics. Some additional features such as dictionariesextended partial applicationconsole capdate formatting. You can require only standardized features polyfills, use features without global namespace pollution or create a custom build.

more...
No comment yet.
Scoop.it!

Asynchronous Processing with TypeScript and Generic Promises

Asynchronous Processing with TypeScript and Generic Promises | JavaScript for Line of Business Applications | Scoop.it
Promises make asynchronous processing simple, consistent and easy to use. And, with TypeScript and Promises.TypeScript providing support for generic Promises, you get both type safety and IntelliSense support.
more...
No comment yet.
Scoop.it!

Staying Sane With Asynchronous Programming: Promises and Generators

Staying Sane With Asynchronous Programming: Promises and Generators | JavaScript for Line of Business Applications | Scoop.it

Callback Hell, also known as Pyramid of Doom, is an anti-pattern seen in code of programmers who are not wise in the ways of asynchronous programming.

So it is definitely recommended to do it right from the get-go and avoid deeply-nested callbacks. My favourite solution for this will be the usage of the Promise object. I have been dealing with Node.js for my last few projects and Promise managed to keep my sanity in check. But if you are looking for something more edgy, you will love Generators. I will touch more in depth about both approaches below.

more...
No comment yet.
Scoop.it!

Parallel Processing with Promises

Parallel Processing with Promises | JavaScript for Line of Business Applications | Scoop.it
a simple method of writing a collaborative system

Using the design pattern described in this article, programmers can build collaborative systems of threads or processes that are simple and easy to reason about because of the abstraction provided by promises. As promises are available in many languages, this design pattern can be implemented in whichever language is most appropriate or even in multiple languages for each process.

more...
No comment yet.
Scoop.it!

A Promise on a Scrap of Paper

A Promise on a Scrap of Paper | JavaScript for Line of Business Applications | Scoop.it

Promises allow us to control commands that are executing at the same time or spontaneously. This control is codified and formatted in a way that humans can better read and understand. However, you probably still think of promises as a list of commands, but they're actually pieces of data representing an action. I'll show you how using a real world use of JavaScript promises that takes a list of resolutions I would like to screenshot and transform them into promised actions.

more...
No comment yet.
Scoop.it!

Synchronous asynchronous JavaScript with ES6 Generators

Synchronous asynchronous JavaScript with ES6 Generators | JavaScript for Line of Business Applications | Scoop.it

I was pretty much sold on Promises as the answer to everything. That was, until I heard about generator functions and iterator objects, a new way to define functions that paused and continued and available in ECMAScript 6.

Now I’m not going to get into the nitty gritty of these ES6iterators and generators, as far more intelligent people than me have already documented them in an much more elegant way than I ever could.

more...
No comment yet.
Scoop.it!

thaw.js - synthetic asynchronous processing in javascript

thaw.js - synthetic asynchronous processing in javascript | JavaScript for Line of Business Applications | Scoop.it

Browsers are synchronous. They have limits & can be slow. thaw.js defers processes until the browser is ready for them.
thaw.js makes frozen browsers thaw(.js).

Thaw.js is like the idea of javascript promises only tied to time.

more...
No comment yet.
Scoop.it!

gtor - A General Theory of Reactivity

gtor - A General Theory of Reactivity | JavaScript for Line of Business Applications | Scoop.it

In the context of a computer program, reactivity is the process of receiving external stimuli and propagating events. This is a rather broad definition that covers a wide variety of topics. The term is usually reserved for systems that respond in turns to sensors, schedules, and above all, problems that exist between the chair and keyboard.

The field of reactivity is carved into plots ranging from "reactive programming" to the subltly distinct "functional reactive programming", with acrage set aside for "self adjusting computation" and with neighbors like "bindings" and "operational transforms". Adherents favor everything from "continuation passing style" to "promises", or the related concepts of "deferreds" and "futures". Other problems lend themselves to "observables", "signals", or "behaviors", and everyone agrees that "streams" are a good idea, but "publishers" and "subscribers" are distinct.

more...
No comment yet.
Scoop.it!

Common patterns when handling promises

Common patterns when handling promises | JavaScript for Line of Business Applications | Scoop.it

Promises are becoming a top feature of JavaScript. They’re already part of most libraries and frameworks (jQuery, WinJS and AngularJS among others) and will soon be included natively in all browsers with the upcoming delivery of ECMAScript 6 (the standard behind JavaScript). They are heavily used every time you have to deal with asynchronous calls, like in Ajax, or in Single Page Applications which rely a lot on them.

more...
No comment yet.