Categories
Frontend JavaScript React

React Fiber: Rewriting the Core Without Breaking Everything

React is undergoing a complete core rewrite called Fiber, and most developers won't notice. That's the point. Facebook is replacing React's reconciliation algorithm—the diff engine that makes React fast—without changing the public API. This is a remarkable engineering feat and a lesson in managing large-scale architectural changes.

What Is Fiber?

Fiber is a complete rewrite of React's core algorithm. The current version (React 15) does reconciliation synchronously—when state changes, React computes the entire component tree diff in one uninterruptible block. If that takes 100ms, the main thread is blocked for 100ms. No user input, no animations, nothing.

Fiber breaks reconciliation into chunks. React can pause diff work, check if there's higher priority work (like user input), handle that, then resume diffing. The result: smoother user experiences, especially on slower devices.

Categories
Backend JavaScript Node.js

Node.js 8: async/await Goes Native

Node.js 8 is shipping with full async/await support natively, no Babel required. This is the culmination of a multi-year journey from callback hell through Promises to finally having sane async code. But shipping async/await doesn't mean Node.js codebases suddenly become clean—migration is the hard part.

What's New

Node.js 8 includes V8 5.8, which supports async/await from ES2017. You can write this code without any build step:

const fs = require('fs-promise');

async function readConfig() {
  try {
    const data = await fs.readFile('config.json', 'utf8');
    return JSON.parse(data);
  } catch (error) {
    console.error('Failed to read config:', error);
    throw error;
  }
}

async function main() {
  const config = await readConfig();
  console.log('Config loaded:', config);
}

main().catch(console.error);

This is dramatically cleaner than callbacks or even raw Promises. The code reads top-to-bottom, errors propagate naturally, and debugging actually works.

Categories
CSS Frontend Web Development

CSS Grid Is Finally Ready (And It’s About Time)

CSS Grid just shipped in Chrome, Firefox, and Safari within weeks of each other. After years of spec work and browser implementation, we finally have a proper layout system for the web. No more floats-as-layout. No more clearfix hacks. No more flexbox contortions.

This should be a huge moment. But here's the uncomfortable truth: most developers won't use Grid for months or years, because unlearning decades of CSS hacks is harder than learning Grid itself.

What Grid Actually Does

CSS Grid lets you define two-dimensional layouts—rows and columns—explicitly. Place items in specific grid cells, span multiple cells, create gaps, and it just works.

.container {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  height: 100vh;
}

.header {
  grid-column: 1 / -1; /* span all columns */
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
}

.main {
  grid-column: 2;
  grid-row: 2;
}

This is what we should have had in 1998. Instead, we've spent 20 years stacking hacks on hacks because CSS wasn't designed for application layouts.

Categories
JavaScript Performance WebAssembly

WebAssembly MVP Ships: Native Speed in the Browser

WebAssembly (WASM) is shipping in Chrome, Firefox, and Edge. Safari support is coming. For the first time, we can run compiled languages in the browser at near-native speed. This is a huge technical achievement, but the practical implications are still unclear.

What Is WebAssembly?

WebAssembly is a binary instruction format that browsers can execute. Write code in C, C++, or Rust, compile to .wasm, and run it in the browser. No plugins, no VMs—it's baked into the browser alongside JavaScript.

// Load and instantiate WebAssembly
fetch('module.wasm')
  .then(response => response.arrayBuffer())
  .then(bytes => WebAssembly.instantiate(bytes))
  .then(results => {
    const exports = results.instance.exports;
    // Call WASM functions from JavaScript
    const result = exports.add(5, 3);
    console.log(result); // 8
  });

The performance wins are real. Benchmarks show 10-800x speedups over JavaScript for compute-heavy tasks. Parsing and compiling WASM is faster than JavaScript because the binary format is optimized for quick validation.

Categories
JavaScript npm Package Management

npm 5: Lockfiles Finally Arrive

npm 5 is shipping with package-lock.json, and the irony isn't lost on anyone. After Yarn forced npm's hand by introducing lockfiles in October 2016, npm is finally catching up. This is competition working exactly as intended—but it also exposes some uncomfortable truths about JavaScript dependencies.

What Changed

npm 5 introduces package-lock.json which locks down the entire dependency tree. Run npm install on any machine with the lockfile, and you get identical versions of every package, including transitive dependencies. This matches what Yarn's yarn.lock has been doing since launch.

{
  "name": "my-app",
  "version": "1.0.0",
  "lockfileVersion": 1,
  "dependencies": {
    "lodash": {
      "version": "4.17.4",
      "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
      "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
    }
  }
}

The performance improvements are also significant. npm 5 is noticeably faster than npm 4, though still not quite matching Yarn's speed.

Categories
JavaScript Web Development Year in Review

JavaScript in 2016: The Consolidation Year

Last year's prediction was that 2016 would focus on consolidation over innovation. Looking back, that's exactly what happened. React solidified position, Angular 2 shipped, tooling matured, and new frameworks emerged without fragmenting ecosystem completely.

2016 wasn't "everything changed again." It was "things settled."

Framework Landscape Solidified

Categories
Async Programming JavaScript RxJS

Observables: The Async Evolution Beyond Promises

Observables are at Stage 1 in TC39's standardization process, meaning they might become part of JavaScript eventually. RxJS implements them now, and Angular 2 adopted them for HTTP and events. The question is whether Observables are genuinely better than Promises or just more complex.

After using RxJS with Angular 2, I think the answer is: both.

What Observables Are

Categories
JavaScript Package Management Tooling

Yarn: npm Has Competition

Facebook and Google released Yarn yesterday—a new package manager that uses npm's registry but promises faster, more reliable, more secure installations. The collaboration between tech giants and focus on npm's pain points suggests npm has serious problems.

Whether Yarn succeeds depends on execution and whether developers tolerate another package manager.

What Yarn Fixes

Categories
Angular Frameworks JavaScript

Angular 2 Finally Ships

Angular 2.0 shipped this week, two years after announcement. The wait was long, the changes are total, and the reception is mixed. Google rebuilt Angular from scratch—TypeScript, component-based, completely different API. Whether this was right decision depends on who you ask.

What's certain: the two-year rewrite gave React enormous opportunity.

What Took So Long

Categories
Mobile PWA Web Development

Progressive Web Apps: Real World Results

Progressive Web Apps launched as concept a year ago. Now we have case studies: Flipkart (India), AliExpress (China), Washington Post (US) all report significant metric improvements after building PWAs. The data suggests PWAs work—but the adoption pattern is interesting.

PWAs are succeeding most where app stores create most friction.

The Results Are In