blog podcast

On Complexity

I think that cognitive load, or rather the lack of, is the hard currency that determines how good of a developer you can be. Cognitive load is the arch enemy of focus. If you can minimize cognitive load you can optimize focus. If you are focused, you can solve any problem.

Now, what creates cognitive load? One of the things that creates cognitive load is complexity. Complexity is defined by John Ousterhoult in “A Philosophy of Software Design” as: “Complexity is anything related to the structure of a software system that makes it hard to understand and modify the system”. To be a good developer you should try to make sure to minimize complexity in the system that you are building. This is the point that John is making in his book (which I so far find very good), it is also my belief that this is one of the most important skills you can foster if you want to be a good software engineer.

Code of the Day

I finally made it, an algorithm that separates two polygons:

  separateFrom(other: Polygon, direction: Vector): Polygon {
    const thisBounds = this.getBounds();
    const otherBounds = other.getBounds();
    if (!thisBounds.overlap(otherBounds) && ! this.overlap(other)) {
      return this;

    const separateVector = thisBounds.separateFrom(otherBounds, direction);
    const thisMovedFar = this.transposeVector(separateVector);
    const distancesFromThisToOther = thisMovedFar.getPoints()
      .map(p => other.distanceToPerimiter(p, direction.reverse()));

    const distancesFromOtherToThis = other.getPoints()
      .map(p => thisMovedFar.distanceToPerimiter(p, direction));

    const allDistances = distancesFromOtherToThis
    .filter(distOpt => distOpt.nonEmpty())
    .map(distOpt => distOpt.get())

    const shortestDistance = allDistances[0];

    const transposeVector =

    return this.transposeVector(transposeVector);

Now, if the complexity here can be reduced or not is a question still open.