Webpack build produces a bundle (app.js). The bundle contains scripts and styles. In this post, I will show how to analyze the bundle size.

Analyze bundle size

There is a command to produce build statistics in the form of JSON file.

webpack --profile --json > stats.json

There is an online analyse tool to analyze the build statistics. On uploading the JSON file, the analyse tool shows a dashboard.…

Read More

Good code is reusable, maintainable, scalable and performs well.

Reusability

There is a popular maxim:

When in hurry, copy-paste. And later refactor.

When we think reusability, we think about reusable components or reusable packages.Some sort of utility. Which can be reused all over. But reusability is much more than that. If two methods look similar, create another method. Call the third method for each of the two methods.…

Read More

Knockout is a UI framework for building single page apps. In Knockout, observable and observableArray are two basic functions. Observable enables two-way binding between the UI and the data in View Model.

ObservableArray stores a collection of View Models. When a View Model is added or removed from the array, the bindings are re-evaluated. And the UI is re-rendered. Most of the array operations are supported.…

Read More

Entity Framework is an ORM layer for .NET applications. Sometimes, we import data from a flat file. Technically, this boils down to: Delete all records from the table. And insert new records into the table.

Import data

Below is the first cut of code that I wrote. A logical use of Entity framework. But unexpectedly, yields very poor performance.

// delete data
foreach(Employee emp in context.Employees)
Read More