Skip to main content

3 posts tagged with "javascript"

View All Tags

· 6 min read
Pere Pages
Developer with bricks

Mixins are a concept in object-oriented programming where a class can include the properties and methods of another class without extending it. Essentially, it's a way to add functionality to a class from multiple sources.


Especially working with modern JavaScript or TypeScript, you might encounter mixins in legacy code or specific libraries but will likely use more contemporary patterns for code reuse and composition.

· 8 min read
Pere Pages


Both Result and Either types are considered monads in functional programming. They are commonly used for error handling and control flow in languages that support functional programming paradigms, such as Haskell, Scala, and even in TypeScript with certain libraries.

Both Result and Either are monads because they implement the monadic interface, specifically the bind (or flatMap, andThen) function, and satisfy the monad laws (Identity and Associativity).

These types are powerful abstractions for dealing with computations that might fail, providing a way to sequence operations while propagating errors in a clean, functional way.

· 4 min read
Pere Pages
Tree shake
Tree shaking

Tree shaking is a term used in the context of web development, particularly with JavaScript and modern front-end build tools, to describe the process of removing unused code from your final bundle. It's like shaking a tree to let the dead leaves (unused code) fall off, so you end up with a lighter, more efficient bundle that only includes the code that's actually used in your application.

This concept became particularly relevant with the rise of module bundlers like Webpack, Rollup, and tools like Parcel, which analyze your import and export statements to determine which parts of a module are used by your application. If a function, class, or variable from a module is never used, the bundler can exclude it from the output bundle, reducing the size of your application and improving load times for your users.