Systems: The Purpose of a System is What It Does - Anil Dash

The most effective and broadly-understand articulation of this idea is the phrase, “the purpose of a system is what it does”, often abbreviated as POSIWID. The term comes to us from the field of cybernetics, and the work of Stafford Beer, but this is one of those wonderful areas where you really don’t have to read a lot of theory or study a lot of the literature to immediately get value out of the concept. (Though if you have time, do dig into the decades of research here; you’ll enjoy it!)

The system isn’t broken. It’s working exactly as it was designed to. What to change to the system. Change its desired outcome, its incentives to be successful. That where the correction is needed.

Our lack of affordable housing is mucking up the American dream | Vox

What we have right now in America is a society that is increasingly marrying European levels of stasis to American levels of social welfare policy, and that is the worst of both worlds. We’re not helping people go where the opportunities are and we don’t help them where they’re living either. And that strikes me as dangerous and unsustainable and also inhumane. And so it’s a real choice that America faces at this moment to decide which of those two models it wants to pursue.

Comparative Analysis of Stimulus and Turbo Frames in Modern Web Development

A pretty good rundown with resources from Perplexity DeepSearch.

The evolution of web development frameworks has introduced tools like Stimulus and Turbo Frames to address the growing demand for interactive, single-page application (SPA) experiences while maintaining the simplicity of traditional server-rendered architectures. This report examines the technical distinctions, use cases, and complementary roles of these two components within the Hotwire ecosystem, providing a comprehensive understanding of their unique capabilities and optimal application scenarios.


Foundational Concepts in Hotwire

Hotwire (HTML Over The Wire) represents a paradigm shift in web development by emphasizing server-rendered HTML delivery over client-side JavaScript execution. This approach combines three core technologies:

  1. Turbo: A suite of techniques for accelerating page navigation and partial updates
  2. Stimulus: A minimalist JavaScript framework for adding interactive behaviors
  3. Strada: Mobile-native bridge components (beyond this report’s scope)

Within this ecosystem, Turbo Frames and Stimulus address different layers of application interactivity. Turbo Frames focus on content replacement patterns through server interactions, while Stimulus enables client-side DOM manipulation without server roundtrips[2][4].


Turbo Frames: Targeted Content Replacement

Architectural Implementation

Turbo Frames implement partial page updates through <turbo-frame> HTML elements that create independent content contexts. These frames:

  • Capture navigation events within their boundaries
  • Automatically fetch updated content from the server
  • Replace only the matching frame element in the DOM[1][6]
<turbo-frame id="user_profile">
  <a href="/users/1/edit">Edit Profile</a>
</turbo-frame>

When clicked, Turbo intercepts the request, fetches /users/1/edit, extracts the matching <turbo-frame id="user_profile"> from the response, and swaps the existing frame content[3][6]. This occurs without full page reloads or custom JavaScript.

Key Characteristics

  1. Server-Driven Updates: Requires server responses containing valid frame HTML
  2. Scoped Interactions: Only affects content within matching frame boundaries
  3. Progressive Enhancement: Degrades gracefully to standard navigation when JavaScript is disabled[6][8]
  4. Lazy Loading: Supports deferred content loading via loading="lazy" attribute[6]

Common Use Cases

  • In-place form editing interfaces
  • Paginated content sections
  • Context-sensitive help systems
  • Multi-step wizard workflows[3][8]

Stimulus: Client-Side Interactivity Layer

Architectural Implementation

Stimulus employs a controller-based pattern where JavaScript classes attach to DOM elements via data-controller attributes:

<div data-controller="character-counter">
  <textarea data-character-counter-target="input"></textarea>
  <span data-character-counter-target="counter"></span>
</div>

Controllers implement lifecycle hooks and action handlers:

// character_counter_controller.js
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = ["input", "counter"]
  
  initialize() {
    this.updateCounter = this.updateCounter.bind(this)
  }

  connect() {
    this.inputTarget.addEventListener('input', this.updateCounter)
    this.updateCounter()
  }

  updateCounter() {
    this.counterTarget.textContent = 
      `${this.inputTarget.value.length}/500 characters`
  }
}

Key Characteristics

  1. DOM-Centric Design: Operates on existing HTML elements
  2. Declarative Binding: Uses HTML attributes for controller associations
  3. State Management: Maintains UI state client-side without server interaction
  4. Lifecycle Hooks: connect() and disconnect() for resource management[4][8]

Common Use Cases

  • Real-time input validation
  • Dynamic UI state management
  • Third-party library integration
  • Client-side calculations[8][10]

Comparative Analysis

Characteristic Turbo Frames Stimulus
Update Mechanism Server-rendered HTML replacement Client-side DOM manipulation
Network Dependency Requires server roundtrip Operates offline once loaded
State Management Server-controlled state Client-maintained state
Complexity Profile Simple HTML structure requirements JavaScript implementation needed
Accessibility Automatic focus management Manual ARIA attribute management
Performance Network latency impacts responsiveness Instant client-side feedback

Operational Synergies

  1. Frame Refresh Coordination: Stimulus controllers can trigger Turbo Frame reloads through this.element.reload()[7]
  2. Form Enhancement: Combine Turbo Frame form submission with Stimulus input validation[10]
  3. Lazy Loading Control: Use Stimulus to manage Turbo Frame visibility and loading states[6][8]

Implementation Patterns

Turbo Frame Best Practices

  1. Container Isolation: Keep frame contents semantically independent
  2. Error Handling: Implement server-side frame fallbacks for missing content
  3. Navigation Control: Use data-turbo-frame="_top" for full-page navigation breakouts[6][9]
# Rails controller frame response
def update
  respond_to do |format|
    format.turbo_stream { render turbo_stream: turbo_stream.update(@user) }
    format.html { redirect_to [@user](https://micro.blog/user) }
  end
end

Stimulus Implementation Guidelines

  1. Single Responsibility: Limit controllers to specific UI behaviors
  2. Event Delegation: Use data-action attributes instead of manual listeners
  3. State Encapsulation: Leverage data-* attributes for state persistence[4][8]
// dropdown_controller.js
export default class extends Controller {
  static targets = ["menu"]
  
  toggle() {
    this.menuTarget.hidden = !this.menuTarget.hidden
  }
}

Decision Framework

Prefer Turbo Frames When:

  • Implementing CRUD interfaces
  • Managing server-side state changes
  • Handling form submissions with server-rendered responses
  • Building paginated/lazy-loaded content[3][8]

Choose Stimulus For:

  • Client-side validation logic
  • UI state toggling (modals, accordions)
  • Real-time input feedback
  • Third-party library integration points[8][10]

Hybrid Approach Example: Search Interface

<turbo-frame id="search_results" data-controller="search">
  <form action="/search" data-search-target="form"
        data-action="search#submit">
    <input type="text" data-search-target="input">
    <div data-search-target="loading" hidden>Searching...</div>
  </form>
  
  <!-- Results populated via Turbo Frame -->
</turbo-frame>
// search_controller.js
export default class extends Controller {
  static targets = ["form", "input", "loading"]
  
  submit() {
    this.loadingTarget.hidden = false
    this.formTarget.requestSubmit()
  }
}

Performance Considerations

Turbo Frame Optimization

  1. Caching Strategies: Implement data-turbo-cache="false" for dynamic content
  2. Lazy Loading: Defer non-critical frame loading
  3. Partial Responses: Return minimal HTML fragments from servers[6][7]

Stimulus Performance

  1. Event Throttling: Use debounce for input handlers
  2. Memory Management: Clean up event listeners in disconnect()
  3. Code Splitting: Load non-critical controllers asynchronously[8][10]

Conclusion

Turbo Frames and Stimulus represent complementary approaches to modern web development within the Hotwire ecosystem. Turbo Frames excel at server-driven content updates through HTML fragment replacement, while Stimulus specializes in client-side interactivity through targeted JavaScript behaviors. The optimal implementation strategy involves:

  1. Starting with Turbo Frames for content replacement needs
  2. Layering Stimulus for client-side interactivity requirements
  3. Combining both approaches for complex interactive systems

Developers should prioritize Turbo Frames for server-side functionality and progressively enhance with Stimulus when client-side behaviors become necessary. This approach maintains the simplicity of server-rendered architectures while delivering SPA-like experiences through systematic, layered enhancement[8][9].

Sources [1] Turbo Streams: How They Work and Differ From Turbo Frames https://www.writesoftwarewell.com/understanding-hotwire-turbo-streams/ [2] What exactly is the difference between Turbo, Hotwire and Stimulus … https://www.reddit.com/r/rails/comments/1cnpe04/what_exactly_is_the_difference_between_turbo/ [3] Thinking in Hotwire: Progressive Enhancement | Boring Rails https://boringrails.com/articles/thinking-in-hotwire-progressive-enhancement/ [4] What is the difference between Turbo and Stimulus, and what … https://www.ducktypelabs.com/turbo-vs-stimulus/ [5] Hotwire with Turbo Frames, Turbo Streams, StimulusReflex … - Satchel https://satchel.works/@wclittle/full-stack-hello-world-tutorials-part-8 [6] Decompose with Turbo Frames - Turbo Handbook https://turbo.hotwired.dev/handbook/frames [7] Reload turboframe with Hotwire (Stimulus/Turbo/Rails) https://stackoverflow.com/questions/76096510/reload-turboframe-with-hotwire-stimulus-turbo-rails [8] Hotwire Decisions: When to use Turbo Frames, Turbo Streams, and … https://labzero.com/blog/hotwire-decisions-when-to-use-turbo-frames-turbo-streams-and-stimulus [9] Progressive enhancement philosophy and WHEN to add Hotwired? https://discuss.hotwired.dev/t/progressive-enhancement-philosophy-and-when-to-add-hotwired/4690 [10] Hotwire Modals in Ruby on Rails with Stimulus and Turbo Frames https://blog.appsignal.com/2024/02/21/hotwire-modals-in-ruby-on-rails-with-stimulus-and-turbo-frames.html [11] What is the rule of thumb for deciding whether to use turbo_frames … https://discuss.hotwired.dev/t/what-is-the-rule-of-thumb-for-deciding-whether-to-use-turbo-frames-or-stimulus/3295 [12] What is the rule of thumb for deciding whether to use turbo_frames … https://discuss.hotwired.dev/t/what-is-the-rule-of-thumb-for-deciding-whether-to-use-turbo-frames-or-stimulus/3295

Common factors link rise in pedestrian deaths—fixing them will be tough - Ars Technica

AAA’s study also points out how difficult it will be to fix some of the contributors to this problem. In many places, the built environment needs to be changed, but it’s expensive, and American society is just too accepting of traffic deaths to demand it happen. There are clashes between local and state governments—the latter often owns the arterial roads where these deaths are happening, leaving the cities powerless to take action themselves.

It’s a long slow path back from the car centric cities we’ve built. The time to start is now.

Once again, the only way forward is the Mac | Macworld

There’s absolutely nothing fundamental in the App Store concept that requires it to be the only pathway for software on the iPhone. But limiting things to the App Store gave Apple complete control of its new software platform, which in those early days was very much still under construction. I understand why Apple had that impulse, why it wanted to protect what it was building, and why it didn’t want the iPhone to be defined by software in any way that Apple didn’t agree with.

But over time, the inevitable happened: Apple used the exclusivity of the App Store and its total control over the platform to extract money through rent-seeking and to bar businesses from admitting that the web existed outside their apps. Perhaps worst of all, the App Store’s exclusivity allowed Apple to essentially treat app developers as Apple employees, forcing them to follow Apple’s guidelines and please Apple’s approval apparatus before their apps would be allowed to be seen by the public. Whole classes of apps were banned entirely, some publicly, some silently.

Enough said.

Emerging Patterns in Building GenAI Products

We then handle user requests by using the embedding model to create an embedding for the query. We use that embedding with a ANN similarity search on the vector store to retrieve matching fragments. Next we use the RAG prompt template to combine the results with the original query, and send the complete input to the LLM.

A nice quick rundown of RAG implementation.

On government efficiency - daverupert.com

Transportation. I don’t think individuals should plan and build their own highways. I’d like a government to do that. I also think every American owning their own car that sits parked 95% of the time is a waste of money and space, even if it does make the GDP chart go up. You need a big extra room to store cars at home and a downtown filled with concrete ramps to store cars at work. Or an enormous parking lot to store cars at the store. Is this not a form waste? There’s no way a train makes money and is a profitable business… but more trains equals less traffic. We know adding new ten million dollar a mile lanes to an already impossibly wide interstate creates more traffic, more road rage, and more traffic deaths. That is folly and an inefficiency governments can step in and solve.

100% agree with every word.

Dell is making everyone return to office, too | The Verge

Technically, Dell had already required its sales, manufacturing, and lab engineers to return to office. The email cites the “new speed, energy, and passion” from those teams as a reason for implementing it company-wide globally. For previously remote workers who don’t live near an office, Dell says they can continue to work remotely.

Image living an hour away from the office, and now spending 2 hours each day in the car simply traveling to and from the office. Doesn’t sound more productive.

Spaghetti code is a people problem | Go Make Things

If you want to stop spaghetti code, you’re better served investing in good documentation and developer discipline.

Nailed it.

Elon Musk admits Teslas will need new hardware for FSD | The Verge

“The truth is that we’re gonna have to upgrade people’s Hardware 3 computer for those who have bought Full Self Driving, and that is the honest answer,“ Musk said during yesterday’s earnings call, adding that it will be “absolutely painful and difficult.”

Ouch 🤕

Everything I know about Deno - entbit. by Niklas Metje

This guide is a living document, which means I’ll be updating it regularly with new content and examples. I’m here to help you learn and answer any questions you might have. So, let’s get started!

Marked for the future. A great resource.

How do you DRI your career in a bad market? – Accidentally in Code

  1. You’re not learning (and you want to be)
  2. You’re learning coping mechanisms rather than skills
  3. You feel morally conflicted about hiring
  4. Your job is affecting your confidence
  5. Your job is affecting you physically

That’s a pretty spot on list. I’d have to agree.

Apple will update iOS notification summaries after BBC headline mistake - Ars Technica

When contacted for a statement, an Apple spokesperson told Ars:

Apple Intelligence is designed to help users get everyday tasks done faster and more easily. This includes optional notification summaries, which provide users who choose to opt in a way to briefly view information from apps and tap into the full details whenever they choose. These are identified by a summarization icon, and the original content is a quick tap away. Apple Intelligence features are in beta and we are continuously making improvements with the help of user feedback. A software update in the coming weeks will further clarify when the text being displayed is summarization provided by Apple Intelligence. We encourage users to report a concern if they view an unexpected notification summary.

Gonna need a lot more than a subtle icon change to clean up this mess.

Using LLMs and Cursor to become a finisher

I have been very productive with my side projects, quickly building the tools or projects I need and deploying them for others to use—in other words, finishing the v1 of each project.

I’ve been using Cursor for several weeks now and can say I’ve been pretty productive.

Docker “Rosetta is only intended to run on Apple Silicon” on macOS Sequoia | Roman Zipp

Disable Docker x86_64/amd64 emulation

As a last step, try disabling the x86_64/amd64 emulation using Rosetta on Apple Silicon in your Docker Desktop General settings.

Google’s counteroffer to the government trying to break it up is unbundling Android apps - The Verge

For three years, its proposal would block Google from signing deals that link licenses for Chrome, Search, and its Android app store, Google Play, with placement or preinstallation of its other apps, including Chrome, Google Assistant, or the Gemini AI assistant.

It would also still allow Google to pay for default search placement in browsers but allow for multiple deals across different platforms or browsing modes and require the ability to revisit the deals at least once a year.

Not even the bare minimum.

Tailwind 4.0: a True “Mea Culpa” Moment | That HTML Blog

Here we are. The ships have turned around. React 19 can now play in a world where not all of your components are built with React, and Tailwind 4 can now play in a world where not all of your HTML markup is riddled with utility classes. This is unequivocally a good thing,

A path forward indeed.

Peak Design denies snitching on Luigi Mangione - The Verge

“We cannot associate a product serial number with a customer unless that customer has voluntarily registered their product on our site.” The statement goes on to say that the serial numbers on the V1 of the Everyday backpack “were not unique or identifying … We did not implement unique serial numbers until V2 iterations of our Everyday Backpack.”

I’m sorry. What? How on earth did we get here. 🤨

From where I left -

if you read the new Redis license, sure, it’s not BSD, but basically as long as you don’t sell Redis as a service, you can use it in very similar ways and with similar freedoms as before (what I mean is that you can still modify Redis, redistribute it, use Redis commercially, in your for-profit company, for free, and so forth). You can even still sell Redis as a service if you want, as long as you release all the orchestration systems under the same license (something that nobody would likely do, but this shows the copyleft approach of the license). The license language is almost the same as the AGPL, with changes regarding the SAAS stuff. So, not OSI approved? Yes, but I have issues calling the SSPL a closed license.

Totally fine. Never was quite sure why the community was so upset. Only businesses that sell Redis as a service should really care. 🤷‍♂️

I Would Not Take My Post-Assassination Meal At An Altoona McDonald’s, But I Guess I’m Built Different | Defector

Heretofore unimagined levels of operational preplanning! A pistol, a bicycle, and the wherewithal and intent to use them: Your high-end professional contract killer might possess any two of these, but all three? Now we are in the realm of speculation. Of fantasy. We are talking about some type of Ernst Stavro Blofeld type of guy. The hardest of hard targets.

Brilliant from start to finish.

Things you forgot (or never knew) because of React - Josh Collinsworth blog

React falls behind in terms of performance (and here I mean both bundle size and execution speed) by factors of 2 or more in many cases. (The bundle itself can be by 10x or more.) The latest run of the JS web frameworks benchmark places React’s performance, on average, at almost 50% slower than Solid, 25% slower than Vue, 40% slower than Svelte, and 35% slower than Preact. (Other frameworks weren’t available in this particular test.)

Woof. That’s slow. 🐢

Why Amazon, Disney, and others are pushing employees back to the office - The Verge

Here are some of the news stories, surveys, and studies we discussed in this episode, if you’d like to learn more:

A great list of articles and resources at the bottom of the article.

Feeling despair after Trump’s 2024 election win? Viktor Frankl can help. | Vox

He argued that human beings always have agency, even when we’re facing a horrible reality that it’s too late to undo. “When we are no longer able to change a situation,” he wrote, “we are challenged to change ourselves.”

Apple buys Pixelmator ↦

sixcolors.com/link/2024…

Apple put the Magic Mouse’s charging port on the bottom again - The Verge

Apple’s new USB-C-equipped Magic Mouse somehow still has the charging port on the bottom.

sad mouse

Just lazy.