Tales from the Evil Empire

Bertrand Le Roy's blog

  • Many ways to relate Orchard things, part 1: database relations

    A long time ago, I wrote a documentation topic on how to implement 1-n and n-n relationships in Orchard using database relations. It was much needed at the time, as this was still a difficult topic. Between spotty mapping mechanisms for relationships, and specific Orchard conventions, it wasn’t something you could expect just anybody to figure out on their own. It is still the way to go under some conditions, but those conditions are arguably very uncommon, and there are now much better solutions for more common cases.

    In this series of posts, I’ll show one technique per post, with pros and cons, and use cases for each. Today, we begin with database-bound relationships.

  • Node dependency injection library extracted from DecentCMS

    There are quite a few DI libraries for Node, I know, and I evaluated many of them before building my own. It’s not that the others are bad, it’s just that I needed a few unique features that I couldn’t find together in a single library. My library, Decent Injection, is exactly what I needed for DecentCMS, because it was built as its foundation, with no other requirement than to be useful to me. My goal by extracting it as its own project is to help those users who have told me that they would like to use it in their own projects. Often, when building exactly the library you need, you end up with something that others will find useful too. It’s pretty cool when it happens.

  • CMS as a service with DecentCMS

    No web site should be a silo. A CMS should be great at organizing, syndicating, and presenting your content, but it should also communicate with arbitrary applications outside the CMS. In particular, mobile applications should be able to use the data from the CMS. In DecentCMS, you can enable the content-api feature to expose all content items as JSON documents.

    Content items are then available under two endpoints: src and shapes.

  • Querying DecentCMS, part 1: building an index

    DecentCMS’s search module provides the infrastructure to build and query search indexes, as well as a file-based implementation that is suitable for small sites. Querying in DecentCMS is based on a simple JavaScript API that is loosely based on the map/reduce pattern. The basic idea is that you first build an index, and then you can run queries on that index. The architecture ensures that querying can scale to very large content stores. It also enables querying to work in a unified way across heterogeneous storage mechanisms. Effectively, storage and querying are entirely separated.

  • Reducing friction

    Great libraries don’t just package useful functionality in a re-usable package, they do so while reducing friction. Low friction means that the answer to “hey, wouldn’t it be great if you could just do X?”, is “yes, it would, and you can.” Doing something simple is never complicated, and the way to do it is easily found, if not plainly obvious. Using such libraries is a joy, never a struggle. Of course, getting results like those is far from being easy, and requires smart designs and clean implementations. Most of all, it requires the library author to put himself in the shoes of his users.

  • The Orchard Way

    An order for an electric conversion of a vintage Porsche  just arrived at Greg’s workshop. He follows a script that will implement the transformation of the car.  He looks at the order, and sees that the customer bought the 70kWh battery. He picks up the right number of cells, and re-orders more to refill the stock. The batteries are secured in the trunk. Then, he removes the car’s engine, and disposes of it. He fits the electric motor in its place, and proceeds to route wires from the trunk to the engine’s compartment. The control system is then assembled. All these operations are done sequentially by Greg. In a few weeks, the car is ready.

    Meanwhile, a few kilometers away, another order for a brand new electric car arrives at Elon’s factory. It should be an obsidian black metallic all-wheel drive with a 85kWh battery, panoramic roof, silver cyclone wheels, black leather seats, carbon fiber décor, black alcantara headliner, autopilot, and subzero weather package. That’s a lot of little independent details.

  • Visual Studio Code first impressions

    This morning, Microsoft made a surprise announcement (or two): a new cross-platform code editor named Visual Studio Code. It runs on Mac, Linux, and of course Windows. It’s lean, fast, it has IntelliSense, supports multiple languages and dev platforms, has debugging and git built-in. You can get it from the following link:

    https://code.visualstudio.com/Download

    Linux and Mac, yes.