Skip to main content

Deploying SPAs on Github Pages: Solving direct url challenges

· 4 min read
Pere Pages
Software Engineer
Developer using github pages

Deploying single-page applications (SPAs) on platforms like GitHub Pages presents unique challenges, especially when it comes to handling direct URL access. In this post, we delve into the intricacies of setting up a Preact SPA on GitHub Pages, exploring solutions to common routing issues and discussing the broader implications for various SPA technologies.

Monads: Either or Result

· 7 min read
Pere Pages
Software Engineer

functional

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.

Tree shaking, an example with barrels

· 4 min read
Pere Pages
Software Engineer
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.

Shells and Terminals

· 14 min read
Pere Pages
Software Engineer
Server Side Rendering

A shell is a command-line interpreter that provides a user interface for the Unix/Linux operating system. The shell interprets the commands you enter in the terminal and tells the operating system to execute them.

Analogy

Think of the terminal as a movie theater and the shell as the movie being played. The theater (terminal) provides the environment and tools (screen, seats, speakers) to experience the movie, while the movie (shell) is the actual content or the interpreter that you interact with.

My view on Pair Programming

· 4 min read
Pere Pages
Software Engineer

pair programming

Pair programming is a collaborative strategy that has gained traction in the software development world. It involves two developers working together on a single task, with one taking the lead and the other providing support. This approach is not just about sharing the workload; it's about leveraging the collective expertise to drive efficiency and quality.

My Perspective

In this article, I'll share my perspective on pair programming, exploring the key stages and strategies that underpin this collaborative approach.

  1. Task Allocation and Leadership
  2. Acceptance Criteria
  3. Exploration through Proof of Concepts (PoCs)
  4. Convergence and Decision-making
  5. Refactoring and Continuous Delivery
  6. Repeat

React.FC type

· 2 min read
Pere Pages
Software Engineer
functional component type

The usage of React.FC or React.FunctionComponent has been a subject of debate within the React community. Both approaches—using it or not—have their pros and cons.

Do not use React.FC

IMHO, do not use React.FC or React.FunctionComponent in your codebase, only if you know you are using children props.

Architecture Decision Records (ADRs)

· 4 min read
Pere Pages
Software Engineer

ADR

In the context of software development, "ADR" stands for "Architectural Decision Record." An ADR document is a way to capture and document important architectural decisions made during the development process of a software project.

An architectural decision refers to a significant choice related to the software's architecture, design, or implementation. This could include decisions about the overall system structure, the selection of technologies, the integration of different components, or the handling of specific design challenges.