React License

Yesterday, I wrote a private note on my organization Slack channel educating people on React license. We use React in few of our projects.

Everyone please read this as it is important to understand what you get into when you decide to use React or any of the Facebook’s open source project. All open source projects uses some form of license like Apache, MIT, BSD, etc.

Facebook uses BSD license along with the patent clause. BSD license is a very open license, that allow you to do anything with React. The culprit here is patent clause. The use of patent clause means following:

If you file a patent claim against Facebook or React, then your React patent clause will be revoked automatically. Facebook will in return counter claim that you violated Facebook’s patent clause so you are doomed now.

On the surface this doesn’t mean much to us as most of us are not in the capacity to sue Facebook.

But devil is in the details, Patent clause give Facebook the power to held any organization hostage that uses Facebook open source projects. To get the point through. Let’s take an hypothetical example that Facebook decided to offer a tool that infringes your company’s IP. Facebook can force your company to allow them to use your patent for free. Otherwise, your license will be revoked and you might have to rewrite the application as it uses React. As we all know rewrites are very costly so an organization might be forced to accept Facebook request.

Apache foundation and WordPress has decided not to use React in future. They are planning to move to some other open source project.

Couple of hours later, Facebook made a press release stating Facebook has decided to relicense React and few other projects. This is great news for the community but this will be applicable from React version 16. React 16 is rewrite of React from scratch. Also, majority of other Facebook open source project have the patent clause. It would be interesting to see if Facebook relicense other projects as well or not.

The decision to relicense React came after backlash from the community. I think the biggest influencer in this decision is WordPress deciding not to use React in their project.

Matt Mullenweg from WordPress wrote in his blog,

the Gutenberg team is going to take a step back and rewrite Gutenberg using a different library. It will likely delay Gutenberg at least a few weeks, and may push the release into next year.

Thank you WordPress. You forced Facebook to make this change.

Advertisements

Building an Angular 4 Drag And Drop Application in 15 Minutes

Last week, I had to build an application that required drag and drop functionality. This made me learn about couple of third party Angular 4 drag-and-drop APIs. The popular options in Angular 2+ world are ng2-dragula and ng2-dnd. I found ng2-dnd more extensible and feature rich so I used it in my application. In today’s blog, we will learn how to add drag-and-drop functionality to a todo application. We will use Addy Osmani Angular 4 todomvc application as the starting point. This post does not cover basics of how to build Angular 4 applications. There are many good references on the web that can teach you building Angular 4 applications from scratch.

Continue reading “Building an Angular 4 Drag And Drop Application in 15 Minutes”

Finatra Tutorial: Building Scalable Services The Twitter Way

Finatra is an open-source project by Twitter that can be used to build REST APIs in Scala programming language. Finatra builds on top of Twitter’s Scala stack — twitter-server, finagle, and twitter-util.

  1. Finagle: It can be used to construct high performance servers.
  2. Twitter Server: It defines a template from which servers at Twitter are built. It uses finagle underneath.
  3. Twitter-Util: A bunch of idiomatic, small, general purpose tools for Scala.
    Continue reading “Finatra Tutorial: Building Scalable Services The Twitter Way”

How to Rename and Change Boolean column to Integer in PostgreSQL

Today, I faced a situation where I had to change a column type from Boolean to Integer. Also, I wanted to rename the column. Let’s suppose, we have tasks table that has a boolean column done. I want to rename done to status and change all false values to 0 and all true values to 1. To do that, you have to run following SQL query using PostgreSQL client.

ALTER TABLE tasks ALTER done SET DEFAULT null;
ALTER TABLE tasks
ALTER done TYPE INTEGER
USING
CASE
WHEN f THEN 0 ELSE 1
END;
ALTER TABLE tasks RENAME done TO status;

Angular 4 Karma Loading CSS in Unit Testing

Today, while writing unit test for one of my Angular 4 application I wanted to load bootstrap css. My components uses Bootstrap for styling. The problem is when test run they don’t load CSS so they are not rendered correctly during unit tests. Angular 4 relies on Karma as test runner for unit tests. To load your external CSS file like bootstrap, you have to add files option to karma.conf.js. After making the change, run your test cases again.

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    singleRun: false,
    files: [
      "node_modules/bootstrap/bootstrap.min.css",
      "node_modules/jquery/dist/jquery.min.js"
    ]
  });
};

Software Development 101: Validate your assumptions

In my last assignment, I was asked to mentor a software development team as part of the Dojo program. I am not a big believer in Training initiatives, but because Dojo program has a different format I decided to take up the assignment. The Dojo program involves working on a real project with the team, helping them embrace good software development practices, solving team’s real problems, and finally delivering a quality software. In this post, I want to talk about a lesson that I had shared with the team — the lesson which I named it as Validate your assumptions. Continue reading “Software Development 101: Validate your assumptions”