Simon Willison’s Weblog

Subscribe
Atom feed for design-patterns

16 posts tagged “design-patterns”

2025

Design Patterns for Securing LLM Agents against Prompt Injections

Visit Design Patterns for Securing LLM Agents against Prompt Injections

This new paper by 11 authors from organizations including IBM, Invariant Labs, ETH Zurich, Google and Microsoft is an excellent addition to the literature on prompt injection and LLM security.

[... 1,795 words]

Malleable software (via) New, delightful manifesto from Ink & Switch.

In this essay, we envision malleable software: tools that users can reshape with minimal friction to suit their unique needs. Modification becomes routine, not exceptional. Adaptation happens at the point of use, not through engineering teams at distant corporations.

This is a beautifully written essay. I love the early framing of a comparison with physical environments such as the workshop of a luthier:

A guitar maker sets up their workshop with their saws, hammers, chisels and files arranged just so. They can also build new tools as needed to achieve the best result—a wooden block as a support, or a pair of pliers sanded down into the right shape. […] In the physical world, the act of crafting our environments comes naturally, because physical reality is malleable.

Most software doesn’t have these qualities, or requires deep programming skills in order to make customizations. The authors propose “malleable software” as a new form of computing ecosystem to “give users agency as co-creators”.

They mention plugin systems as one potential path, but highlight their failings:

However, plugin systems still can only edit an app's behavior in specific authorized ways. If there's not a plugin surface available for a given customization, the user is out of luck. (In fact, most applications have no plugin API at all, because it's hard work to design a good one!)

There are other problems too. Going from installing plugins to making one is a chasm that's hard to cross. And each app has its own distinct plugin system, making it typically impossible to share plugins across different apps.

Does AI-assisted coding help? Yes, to a certain extent, but there are still barriers that we need to tear down:

We think these developments hold exciting potential, and represent a good reason to pursue malleable software at this moment. But at the same time, AI code generation alone does not address all the barriers to malleability. Even if we presume that every computer user could perfectly write and edit code, that still leaves open some big questions.

How can users tweak the existing tools they've installed, rather than just making new siloed applications? How can AI-generated tools compose with one another to build up larger workflows over shared data? And how can we let users take more direct, precise control over tweaking their software, without needing to resort to AI coding for even the tiniest change?

They describe three key design patterns: a gentle slope from user to creator (as seen in Excel and HyperCard), focusing on tools, not apps (a kitchen knife, not an avocado slicer) and encouraging communal creation.

I found this note inspiring when considering my own work on Datasette:

Many successful customizable systems such as spreadsheets, HyperCard, Flash, Notion, and Airtable follow a similar pattern: a media editor with optional programmability. When an environment offers document editing with familiar direct manipulation interactions, users can get a lot done without needing to write any code.

The remainder of the essay focuses on Ink & Switch's own prototypes in this area, including Patchwork, Potluck and Embark.

Honestly, this is one of those pieces that defies attempts to summarize it. It's worth carving out some quality time to spend with this.

# 11th June 2025, 7:21 pm / ai-assisted-programming, ink-and-switch, generative-ai, local-first, ai, llms, geoffrey-litt, design-patterns

2021

The Baked Data architectural pattern

Visit The Baked Data architectural pattern

I’ve been exploring an architectural pattern for publishing websites over the past few years that I call the “Baked Data” pattern. It provides many of the advantages of static site generators while avoiding most of their limitations. I think it deserves to be used more widely.

[... 1,896 words]

2018

Documentation unit tests

Or: Test-driven documentation.

[... 1,521 words]

2017

The denormalized query engine design pattern

Visit The denormalized query engine design pattern

I presented this talk at DjangoCon 2017 in Spokane, Washington. Below is the abstract, the slides and the YouTube video of the talk.

[... 356 words]

2010

What are the main weaknesses of Java as a programming language?

A cultural bias towards over-engineering. In my experience Java code often ends up a huge network of Factories and AbstractFactories and Visitors and XML configuration files and every design pattern you care to mention, dozens of classes many of which contain hardly any procedural code at all. A lot of Java projects are essentially impossible to navigate without an IDE.

[... 77 words]

2008

The Universal Design Pattern. Steve Yegge presents a small book on key/value pairs and prototypal inheritance. “I call it the Universal design pattern because it is (by far) the best known solution to the problem of designing open-ended systems, which in turn translates to long-lived systems.”

# 20th October 2008, 11:13 pm / steve-yegge, prototypes, keyvaluepairs, programming, design-patterns

2007

ActsAsUndoable. Lawrence Carvalho shows how robust undo functionality can be added to a JavaScript application through careful application of the Memento design pattern.

# 18th September 2007, 3:51 pm / actsasundoable, yui, javascript, undo, lawrence-carvalho, memento, design-patterns

factoryjoe: Design Patterns. Chris Messina’s collection of user interface design pattern screenshots, collated on Flickr.

# 10th April 2007, 11:22 am / flickr, chris-messina, design-patterns, ui

2006

Design patterns of 1972 (via) Patterns are signs of weakness in programming languages.

# 14th September 2006, 5:57 am / design-patterns

Yahoo! Design Pattern Library. Common UI design patterns for web applications.

# 14th February 2006, 1:12 am / design-patterns

2005

Why the term Ajax is useful

Software design patterns are useful mainly because they provide a shared vocabulary: rather than discussing the intimate details of a three layered application architecture, we say “MVC”. Rather than describing an object that tracks your progress while looping over a collection, we say “Iterator”.

[... 152 words]

Patterns of Intermediation. Design patterns for bookmarklets, greasemonkey and similar.

# 3rd April 2005, 7:16 pm / bookmarklets, design-patterns, greasemonkey

2003

Dating Design Patterns (via) Reusable solutions for a complex system

# 2nd December 2003, 8:54 pm / design-patterns

2002

phpPatterns

phpPatterns is a brand new site which advocates and documents the use of object oriented design patterns with PHP. It’s a great concept and the site already has some impressive content (although it could really do with a PHP references tutorial). The site is a project of Harry Fuecks, a regular contributor to SitePoint’s PHP forums.

Enterprise Application Architecture

Enterprise Application Architecture by Martin Fowler: A fantastic book on Object Oriented patterns and how they can be applied to large software projects. The book is available on the web as a work-in-progress and I can safely say I’ve never found an online resource that has taught me more about software design. Literally 24 hours after finding it my head is swimming with design patterns, domain models and relational database mapping techniques, and I’ve already started using some of the patterns in my latest project. A big thanks to Captain Proton on the SitePoint forums for pointing it out (and also for helping me understand PHP references a few days ago). I thoroughly recommend this to anyone who is serious about learning Object Oriented design, or indeed any OO-capable language.