Immutable Array Operations in Typescript

In a previous blog post we explored how to perform immutable operations to update objects using Object.assign(). This time we are going to explore how to perform immutable operations on an array of objects which is a common pattern in Redux. If you wan’t to learn more about Redux, take a look at the excellent training course “Getting Started with Redux” by Dan Abramov, the creator of the library.

Continue reading “Immutable Array Operations in Typescript”

The Different Levels of Immutability in Javascript

Avoiding mutations in our code is becoming increasingly important in Javascript due to the principles of functional that makes our code easier to predict and to scale. This blog post can be considered a continuation of a previous one: The Limits of Object.assign().

Continue reading “The Different Levels of Immutability in Javascript”

Introduction to the Typescript Transpiler

Typescript is the new kid on the block, a newly attempt to bring order to the javascript chaos. ES6 is around the corner and is a fantastic step forward for frontend development (classes!) but it will take years to be fully implemented in all major browsers. That’s when Typescript comes to the rescue. Typescript goal is to be a superset of ES6 that, in addition to all the new stuff that the standard is defining, will add a static type system. Typescript has also a transpiler that converts our Typescript code (i.e. ES6 + types) to ES5 or ES3 javascript code so we can use it in today browsers.

Continue reading “Introduction to the Typescript Transpiler”

Abstract/Concrete Inheritance Model in AngularJS

In a previous post I showed how to create a “classic” inheritance model in AngularJS using directives. This time I will show another inheritance model: the abstract/concrete.

In OOP, an abstract class cannot be instantiated, it serves only to provide common properties and functionality to child classes. In Angular, we have to make an analogy and define that an abstract directive is one that does not have a template or a link function, only a controller. The template is provided by child directives.

Continue reading “Abstract/Concrete Inheritance Model in AngularJS”

Directive Inheritance in AngularJS

Inheritance is a powerful way to extend directives functionality and at the same time, improve code reuse. Lets see how it works in Angular with a simple example. The first step is to create a directive called “outer” which is going to be our top-level directive in our hierarchy.

Continue reading “Directive Inheritance in AngularJS”