JavaScript for Line of Business Applications
606.5K views | +6 today
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...

Popular Tags - Filter using the Funnel

Scoop.it!

TypeScript is to JavaScript as C++ is to C

TypeScript is to JavaScript as C++ is to C | JavaScript for Line of Business Applications | Scoop.it

Or is it? Do you have an opinion?

I selected this title because that analogy helps me as I’m learning more about TypeScript. It has “truthiness”. But in a good way. It will help you understand the motivations behind TypeScript, and how its syntax and concepts relate to JavaScript syntax and concepts. 

It’s “truthiness”, because if you take that concept too literally, it breaks down. TypeScript makes some features easier than in JavaScript, but it doesn’t feel quite as revolutionary as the jump from C to C++ (or maybe I’m just older). TypeScript isn’t changing the techniques used in JavaScript, like the shift from procedural to object oriented programming from C to C++. It is making Object Oriented constructs easier, but they aren’t impossible in JavaScript.

Augusto Porto's curator insight, September 11, 2013 3:00 PM

Is it? Any Opinions?

Scoop.it!

Mocking Server Dependencies in JavaScript and AngularJS

Mocking Server Dependencies in JavaScript and AngularJS | JavaScript for Line of Business Applications | Scoop.it

Most Single Page Applications (SPA) written in HTML and JavaScript interact with server side code using the familar XMLHttpRequest object. During development it can be convenient to run the application with mock data that eliminates this server dependency. This can be useful if the server side stack is complex and not easy to set up on a local machine or if a shared dev server running the server components suddenly goes offline. It’s also handy for tweaking the data returned by the services to ensure the UI behaves appropriately in specific scenarios. Naturally it’s imperative to integrate the SPA with real server code early and often but the flexibility provided by the “server mock” technique can be indispensible.

Note: while this article will illustrate how to mock services in an AngularJS application, this pattern applies to any UI technology (JavaScript or otherwise). The key is achieving Separation of Concerns (SoC) that allows real services and mock services to be easily swapped.

No comment yet.
Scoop.it!

A simple photo app with Knockout.js - Lesson 1

A simple photo app with Knockout.js - Lesson 1 | JavaScript for Line of Business Applications | Scoop.it

In the course introduction we look at what Knockout.js is, what architectural pattern it is built on, and how it can help us rapidly develop sophisticated, interactive user interfaces that don't turn into a tangled mess of event handlers. We also set up our development area ready to start coding in lesson 2.

In lesson 2 we add the wrapper for our app and see how easy it is to create a simple constructor for our application that accepts configuration options and supports chaining. We also saw how to use jQuery's extend method to merge the configuration object with the default properties of the application.

TBC

No comment yet.
Scoop.it!

Real-Time Chart using HTML5 Push Notification (SSE) and ASP.NET Web API

Real-Time Chart using HTML5 Push Notification (SSE) and ASP.NET Web API | JavaScript for Line of Business Applications | Scoop.it
Creating a chart to display real-time updates using native HTML5 push notification (Server-Sent event) and ASP.NET Web API.

In this article, we’ll create a chart to display real-time updates using native HTML5 push notification. The HTML5 Server-Sent event (SSE) model allows you to push real-time data updates from the server to the browser. 

Here, our objective is to get random number at random time interval from server and plot the chart.

To start receiving server notifications, we simply open a connection to an SSE URI and setup our callbacks in javascript...

No comment yet.
Scoop.it!

Taking JavaScript Seriously in Grails (AngularJS and CoffeeScript)

Taking JavaScript Seriously in Grails (AngularJS and CoffeeScript) | JavaScript for Line of Business Applications | Scoop.it

Whenever I write JavaScript I throw all software craftsmanship discipline out the window. There are no unit tests and very little structure to the code. It's just me and the browser refresh button until we get it right. If you are lucky you may have jQuery to provide a nice CSS selector based api that somewhat shields you from browser quirks. Maybe you even kept your project from devolving to the point where every page is basically its own JavaScript app with no hope of reuse between them. Even then JavaScript is still likely a second class language in your project. Surprisingly, this state of affairs is normal. I want to take my client side scripting just as seriously as any other code in my Grails web app. I want tests, structure, and less boilerplate, and I am going to use AngularJS and CoffeeScript to do that.

No comment yet.
Scoop.it!

Functional reactive programming in JavaScript

Functional reactive programming in JavaScript | JavaScript for Line of Business Applications | Scoop.it

Mid May, I gave a talk at NodePDX on functional reactive programming in JavaScript. I discussed the general ideas behind the programming paradigm and various implementations that exist. The video is finally available online and the slides are also available.

 

* Flapjax

* Reactive Extensions (RxJS)

* Shafty

*Javelin

* Bacon.js

 

No comment yet.
Scoop.it!

5 Single Page App Best Practices

5 Single Page App Best Practices | JavaScript for Line of Business Applications | Scoop.it

One of the hottest web architecture trends today is Single Page Apps or SPA. This architecture eliminates the traditional request response model the classic web was built upon. Instead it requires only a single page be retrieved from the server. Subsequent views (analogous to traditional pages) are brought in and out of view as needed. The SPA architecture relies heavily upon AJAX requests to pass JSON objects to and from the server to the client to merge with views that present data.

The benefits of a SPA include much less network activity, faster responses to user interactions, smaller server loads. It also makes it possible to use fancy view transitions, which give the appearance of a native application.

SPAs are a very new technique and often leave developers confused and looking for best practices. Traditional techniques and architectures no longer apply to web development and need to be replaced with a new way of thinking as well as learning how to use JavaScript and HTML5 features effectively.

* Client-Side Routing
* Markup Management
* Data Retrieval And Storage
* Using WebStorage To Persist Data
* Deep Linking and History Management
* Conclusion

No comment yet.
Scoop.it!

ES6 Iterators, Generators, and Iterables

I wrote up a quick guide to the terminology around ES6's iteration-related concepts, plus some notes and other resources.

An iterator is an object with a next method that returns { done, value } tuples.

An iterable is an object which has an internal method, written in the current ES6 draft specs as obj[@@iterator](), that returns an iterator.

A generator is a specific type of iterator which also has a throw method, and whose nextmethod takes a parameter.

A generator function is a special type of function that always returns a generator, and which can use the special contextual keyword yield inside of itself. You can send values or exceptions into the body of the function, at the points where yield appears, via the returned generator's nextand throw methods. They are created with function* syntax.

A generator expression is a shorthand expression for creating generators

No comment yet.
Scoop.it!

Using Express.js for APIs

Using Express.js for APIs | JavaScript for Line of Business Applications | Scoop.it

A few tips and libraries for creating and documenting RESTful APIs with Express.js.

These days I spend more time using Express for APIs that send nothing but JSON. In this post I’ll cover a few libraries and reminders to help keep your code organized and your API friendly for developers.

I’m assuming an API backed by MongoDB, and that we’re using Mongoose. Covering the basics of Mongoose is beyond the scope of this article, but I want to highlight a few lesser-known bits.

No comment yet.
Scoop.it!

Part 2: Backbone.js Deconstructed

Part 2: Backbone.js Deconstructed | JavaScript for Line of Business Applications | Scoop.it

In part 2 of Backbone.js Deconstructed, we will be examining the meat of Backbone. The meat being Backbone, views, models, and collections. Equipped with the knowledge conveyed in part 1, you should be adequately prepared to get intimate withBackbone.View, Backbone.Model and Backbone.Collection constructors and corresponding object instances. Before we begin, I am going to lay out my strategy for discussing the meat.

While it is common that most efforts to teach Backbone start with learning about models, I actually think this prohibits learning. I believe once the peripheral parts are understood, the easiest path for grokking Backbone starts with the view. I strongly suggest a mastery of views before you attempt to populate a view with data (i.e. models or collections of models) and eventing the view to stay in sync with the data. The plan is to first examine views, then models, then collections in that order. Once each of these parts are understood, we will take this knowledge and use it to examine a small and contrived contact's application. Don't be afraid to examine the application first, In fact I recommend it, as it will give some a helpful context before reading sections 2, 3, and 4.

1 - Article Overview
2 - Backbone.View
3 - Backbone.Model
4 - Backbone.Collection
5 - Building A Simple Contacts Application
6 - Conclusion

No comment yet.
Scoop.it!

Using the DOM in an AngularJS application

Using the DOM in an AngularJS application | JavaScript for Line of Business Applications | Scoop.it

Even though you should not manipulate the DOM in an AngularJS application but leave that up to AngularJS itself to do there are certainly places where you will need to interact with it. For example you might want to react to events and do something in reusable manner. Sure you can use the ngClick directive to react to a click but there are cases where you need to react to a click and don't want to repeat the same click handler each time.

The place to add these kind of interactive DOM related code in AngularJS is in a directive and not in a controller. In fact a controller should never be aware of the DOM  at all to keep it testable.

In the previous blog post I showed how to use a directive with a template to make our HTML smaller and more reusable, in this blog post I am going to show how you could implement your own version of ngClick. Not that you need one but it's an easy example of how to get started with DOM manipulation from a directive :-)

 

8 part series:

* Getting started with AngularJS
* Creating an AngularJS Controller
* The AngularJS $scope is not the MVC Model
* Using repeating elements in AngularJS
* Filtering the data in an AngularJS ngRepeat element
* Using the AngularJS FormController to control form submission
* Creating an AngularJS Directive
* Using the DOM in an AngularJS application

No comment yet.
Scoop.it!

AngularJS vs. DurandalJS

AngularJS vs. DurandalJS | JavaScript for Line of Business Applications | Scoop.it

Here’s the deal, I like DurandalJS. Though, I’m not going to lie, I really like AngularJS as well. These two technologies compete in many respects as they both seem to tackle the same problem. What problems are these frameworks trying to tackle? I have made a diagram of what I see to be the core developments in client side technologies, and after you view this, I will talk about where I see Angular and Durandal fitting in (note that there are a myriad of other useful frameworks that do storage, pub/sub eventing, animation, data-binding, AMD pattern ala requireJS, and a slew of other things, but this represents what I believe is the focus on today’s client-side development).

Jan Hesse's insight:

http://ryankeeter.com/angularjs-vs.-durandaljs-part-2-on-n-%E2%80%93-data-binding

http://www.ryankeeter.com/angularjs-vs.-durandaljs%E2%80%93part-3-of-n%E2%80%93reputation

No comment yet.
Scoop.it!

Our take on Derby vs. Meteor - Derby blog

Our teams share a similar vision for a world where all applications are realtime and collaborative by default. We as well as a number of other other developers all had a revelation about a year and a half ago—the way that web apps are currently built makes it painfully difficult to create the best user experience, where data dynamically update everywhere.

Thanks to the awesome re-invention of JavaScript performance starting with V8 and the ability to easily create JavaScript servers with Node.js, lots of developers are excited about the notion of using JavaScript for both server and client development. But despite finally using the same language, few Node.js applications to date deliver on the amazing ability to share code. Even with a common language, there are still a lot of issues including very different latency and connection stability, separate ways of dealing with URLs on the server and in the browser, the existence of a DOM in the browser and not on the server, and direct access to a filesystem only on the server.

* GPL vs. MIT
* Meteor packages vs. npm
* Compatibility with other libraries
* MongoDB API vs. Racer methods
* Server rendering and shared routes
* Model-view data bindings
* DOM event handlers
* Fibers
* Wrapping it up

No comment yet.
Scoop.it!

Better JavaScript with Strict Mode and JSHint

With great flexibility comes great responsibility… and JavaScript is very flexible.  Too flexible, some might argue.  There are many “features” of JavaScript that result in code that is hard to read, dangerous or buggy to execute, and in some cases creates performance issues.  In 2008, Douglas Crockford wrote a fantastic book called “JavaScript: The Good Parts” that described the features he found problematic: global variables, the assignment of ‘this’ to the global object, misuse of eval, etc.  If you write JavaScript, it’s a must read.

Several of the “bad” features Crockford identified have been mitigated with “Strict Mode.”  This was added to version 5 of ECMAScript (the JavaScript standard; supported by most popular web browsers).  Strict mode throws exceptions or prevent behavior when “bad” features or common coding errors are evaluated.  A couple of examples…

No comment yet.
Scoop.it!

Web Application Starter Kit for .NET developers

Web Application Starter Kit for .NET developers | JavaScript for Line of Business Applications | Scoop.it

This a solution (project) template of a typical single-page web application built on top of the following technologies:

* ASP.NET Web API, ASP.NET Web Pages (Razor)
* AngularJS client side framework by Google
* SQL Server database project with SSDT
* Entity Framework 5 with Database First
* Real-time web functionality with SignalR
* Enterprise Library 6.0
* Windows Azure SDK
* NuGet with Package Restore

 

You can use it to bootstrap your web and cloud app projects and dev environment. The main advantabe of building your app on top of it - is that you'll be able to pull and merge updates at any time in the future by using Git functionality.

The starter kit contains multi-project solution structure, a set of 3rd party libraries, tools and a bunch of scripts all preconfigured for instant web development gratification. Just clone the repo, open Source/Application.sln and you are ready to develop and test your application.

No comment yet.
Scoop.it!

Accessors vs Dirty-checking in Javascript Frameworks

Accessors vs Dirty-checking in Javascript Frameworks | JavaScript for Line of Business Applications | Scoop.it

One of the many ways in which EmberJS, AngularJS, and BackboneJS differ is in how they treat their models. AngularJS uses dirty checking on Plain Old Javascript Objects (POJSO); whereas EmberJS and BackboneJS both use accessors (getters and setters) on wrapped objects.

We will be exploring the ways in which these two approaches differ, and the implications these differences have when it comes to choosing which Javascript framework we we should write our single page apps in.

Most Javascript frameworks for front end user interfaces used to build single page applications (SPAs) use MV* architectures, and a feature that most of them have in common is the ability for the View to update the Model, and for the Model to update the View.

For this to happen, there needs to be to be a means to “listen” for these changes, and then trigger some code to respond to that change. One call this “Two-way Data Binding”.

No comment yet.
Scoop.it!

JavaScript subclassing using Object.create

JavaScript subclassing using Object.create | JavaScript for Line of Business Applications | Scoop.it

The trickiness of this pattern can help us understand the impetus for one of JavaScript’s newer features, Object.create. When you first encounter this method, you might wonder why JavaScript needs another way to create objects, when it already has the object literal syntax and constructor functions? Where Object.create differs from those options is that lets you provide, as the first argument to the method, an object that will become the new object’s prototype.

No comment yet.
Scoop.it!

Promises in JavaScript

Writing code in an async programming framework like node.js becomes super complex and unbearably ugly super fast. You are dealing with synchronous and asynchronous functions and mixing them together can get really tricky. That is why we have Control Flow.

Basically, control flow libraries allow you to write non-blocking code that executes in an asynchronous fashion without writing too much glue or plumbing code. There is a wholesection on control-flow modules to help you unwind the sphagetti of callbacks that you will quickly land yourself into while dealing with async calls in node.js.

Control flow as a pattern can been implemented via several approaches and one of such approaches is called Promises.


No comment yet.
Scoop.it!

Uncovering the Native DOM API

Uncovering the Native DOM API | JavaScript for Line of Business Applications | Scoop.it

JavaScript libraries such as jQuery serve a great purpose in normalizing cross-browser behaviors in the DOM in such a way that it’s possible to use the same interface to interact with many different browsers. But they do so at a price. Part of that price, in the case of some developers, is having no idea what the heck the library is actually doing when we use it.

Heck, it works! Right? Well, no. You should know what’s happening behind the scenes, in order to better understand what you are doing. Otherwise, you would be just programming by coincidence.

In this article, I’ll explore some of the parts of the DOM API that are usually abstracted away behind a little neat interface in your library of choice, including Ajax, events and DOM querying.

* Meet: XMLHttpRequest
* Event Listeners
* Event Delegation
* Querying the DOM
* DOM Manipulation
* Conclusion

No comment yet.
Scoop.it!

Building an app with Ember.js and Go - Part 3

Building an app with Ember.js and Go - Part 3 | JavaScript for Line of Business Applications | Scoop.it

The first part of any Ember project is to get the basic up and running. Since this is a super basic example we are just going to wire up a Go server to serve our static assets.

Now that we have a basic http server we can setup our Ember environment.

I have included a script that will grab jQuery, Handlebars, and Ember for you. These are all the dependencies that you need to get the project up and running.

Now we can actually create our ember application. The canonical example name space is App, but you can use any name that you would like.

This line of code bootstraps your Ember application. It will automatically run once the page is loaded.

Let’s create our kittens endpoint. First we are going use the super excellent Gorilla web toolkit’s mux for routing. I prefer to have my api endpoint under an /api name space. This is not a requirement, but a personal preference.

Jan Hesse's insight:

previous parts:

http://nerdyworm.com/blog/2013/05/21/building-an-app-with-ember-dot-js-and-go/

http://nerdyworm.com/blog/2013/05/24/building-an-app-with-ember-dot-js-and-go-part-2/

more on Ember.js by the autor:

http://nerdyworm.com/blog/categories/ember/

No comment yet.
Scoop.it!

Generators vs Fibers

Generators vs Fibers | JavaScript for Line of Business Applications | Scoop.it

Both ES6 generators and node-fibers can be used to block a coroutine while waiting on some I/O without blocking the entire process.

This means that you can wait for an I/O result within your code but still have the performance benefits of the single-threaded, non-blocking I/O model you all know and love.

Both can do this for arbitrarily deep call stacks. The main difference between the capabilities of the two is how explicit the syntax is. It's the classic battle between wanting to be safe while wanting to be flexible.

* Generators - Safe, but Annoyingly Explicit* Fibers - Powerful, but Flexible
No comment yet.
Scoop.it!

How To Build a Testing Framework — Introduction To JavaScript Unit Testing

How To Build a Testing Framework — Introduction To JavaScript Unit Testing | JavaScript for Line of Business Applications | Scoop.it

You probably know that testing is good, but the first hurdle to overcome when trying to write unit tests for client-side code is the lack of any actual units; JavaScript code is written for each page of a website or each module of an application and is closely intermixed with back-end logic and related HTML. In the worst case, the code is completely mixed with HTML, as inline events handlers.

What is a unit anyway? In the best case, it is a pure function that you can deal with in some way — a function that always gives you the same result for a given input. This makes unit testing pretty easy, but most of the time you need to deal with side effects, which here means DOM manipulations. It’s still useful to figure out which units we can structure our code into and to build unit tests accordingly.

No comment yet.
Scoop.it!

Refactoring to Backbone.js

Refactoring to Backbone.js | JavaScript for Line of Business Applications | Scoop.it

Deciding mid-stride to adopt a JavaScript application framework exposes many difficult decisions. What should be targeted first? How does one deal with untested, legacy code? It can make transitions a scary, tedious process.

At Viget, we've found Backbone to be a great tool for bolstering existing code with greater structure and functionality. With an active community and a number of superset frameworks (such as Thorax and Marionette), it gives us flexible tools to tackle current problems with an outlet for more elegant solutions down the road.

We've started to trend towards a series of steps that help to translate code over in a safer, more testable way.

* PULL HTML CONSTRUCTION INTO A TEMPLATE
* BREAK OUT DATA PROCESSING
* FINISHING THINGS UP WITH BACKBONE.VIEWS

No comment yet.
Scoop.it!

Angular.js example application

Angular.js example application | JavaScript for Line of Business Applications | Scoop.it

This article is my first one for quite a while, there is a reason for that but I will not bore you all with that. Anyway I have written this article after a little time off. So what does it do, what is this article about?

I decided to spend a bit of time to learn a bit more about a popular web MVC framework by our friends at Google called Angular.js, which is a JavaScript MVC framework, which is a bit of departure for me from my usual XAML influenced world. It is however good to try things out to get an appreciation of how you would do things in different languages/environments (my old mentor Fredrik Bornander (AKA the Swede) told me that), so I decided to take Angular.js for a spin.

This article will talk about some of the fundamental ideas behind Angular.js, and shall then focus on the specifics of the demo application that I have created to go along with this article.

Before we get into the actual article I will just breifly (not too techie just yet, though I know you lot will want to see that, and it will come don't worry) talk about what the demo app does in plain terms, so you know how to drive the thing yourself when you download it.

No comment yet.
Scoop.it!

How git works

How git works | JavaScript for Line of Business Applications | Scoop.it

Given this natural hacker-reflex to probe and tinker, it is odd how little I knew about Git until recently. Perhaps my daily life is so reliant on Git not failing to do its job, that I don't want to poke around lest I find a flaw. Until now I have been content with kicking the tyres and going for a spin around the block, rather than dismantling that mysterious .git directory. Nevertheless, I recently became curious and dug in. I was thrilled to discover that Git is even more beautiful internally, than it is functional externally.

At heart a Git repository is a key-value object store where all objects are indexed by their SHA-1 hash value. All commits, files, tags and filesystem tree nodes are different types of objects living in this repository.

When an object is added to the repository it is hashed, and from then on it is referred to by its SHA-1 hash value. Effectively a Git repository is a large hash table with no provision made for hash collisions. Luckily, with SHA-1 the probability of hash collisions is so vanishingly small that it is nothing to be concerned about.

To see an example of some simple objects, initialise a super-simple git repository with the following commands...

No comment yet.