<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Floris van den Berg on Medium]]></title>
        <description><![CDATA[Stories by Floris van den Berg on Medium]]></description>
        <link>https://medium.com/@noescom1977?source=rss-7975f81f3585------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P_FnuWlzad2l_5GsWp2pOA.png</url>
            <title>Stories by Floris van den Berg on Medium</title>
            <link>https://medium.com/@noescom1977?source=rss-7975f81f3585------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:18:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@noescom1977/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Didn’t Build a Better Doctrine. I Asked a Different Question.]]></title>
            <link>https://medium.com/@noescom1977/i-didnt-build-a-better-doctrine-i-asked-a-different-question-3e267f6bd69a?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e267f6bd69a</guid>
            <category><![CDATA[object-relational-mapping]]></category>
            <category><![CDATA[php-development]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[orm]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 11:53:49 GMT</pubDate>
            <atom:updated>2026-08-06T13:44:36.504Z</atom:updated>
            <content:encoded><![CDATA[<p>When people first see ObjectQuel, one of the first questions they ask is:<em>“How does it compare to Doctrine?”</em></p><p>It’s a fair question. Doctrine is one of the most mature and respected ORMs in the PHP ecosystem. It has been battle-tested for years, implements the Data Mapper pattern well, and has influenced countless PHP applications — including my own.</p><h3>So why did I build ObjectQuel?</h3><p>When I began designing ObjectQuel, I wasn’t trying to solve object-relational mapping. Doctrine already does that very well. The realization that drove ObjectQuel was this: object queries shouldn’t look like SQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8JwXH8e_8dmPT0mKJxO_6w.png" /></figure><p>Nearly every ORM introduces its own query language: HQL, JPQL or DQL. Although their syntax differs, they all inherit the same relational mindset. Even when you’re working with objects, you’re still thinking about joins, aliases, and relational operations.</p><p>After years of building production applications, I wanted a query engine that allowed me to think in terms of my domain model instead of relational operations. ObjectQuel grew out of that conviction and has been the query engine behind the software I’ve built ever since.</p><h3>Two Different Ways of Thinking</h3><p>To me, the biggest difference between Doctrine and ObjectQuel isn’t syntax. It’s the mental model.</p><p>When writing a Doctrine query, the question is often: <strong><em>How do I join these tables? </em></strong>When writing an ObjectQuel query, the question becomes: <strong><em>Which objects am I interested in?</em></strong></p><p>That may sound like a subtle distinction, but I believe it changes how you approach querying entirely.</p><p>Consider a simple example.</p><p>Doctrine:</p><pre>$qb-&gt;select(&#39;p&#39;)<br>   -&gt;from(Product::class, &#39;p&#39;)<br>   -&gt;leftJoin(&#39;p.categories&#39;, &#39;c&#39;)<br>   -&gt;where(&#39;c.name = :category&#39;)<br>   -&gt;andWhere(&#39;p.price &lt; :price&#39;);</pre><p>The developer explicitly constructs a join.</p><p>ObjectQuel:</p><pre>range of p is Product<br>range of c is Category via p.categories<br>retrieve (p)<br>where c.name = :category and p.price &lt; :price</pre><p>There is no request to perform a JOIN.</p><p>Instead, the query simply states that Category objects are reachable through p.categories. The query engine determines how that relationship should be executed against the underlying datastore.</p><h3>Why QUEL?</h3><p>One question I’ve received is why ObjectQuel is based on QUEL rather than SQL.</p><p>The answer is simple: I think QUEL is a better foundation for an object-oriented query language than SQL.</p><p>While modern query languages such as DQL, HQL and JPQL all inherit SQL’s relational mindset, QUEL starts from a different perspective. Rather than centering the language around joins and relational operations, it focuses on describing the objects you want to retrieve and the relationships between them.</p><p>ObjectQuel implements QUEL as its foundation, extending the language where necessary to support modern object-oriented concepts and capabilities. I believe its underlying ideas provide a better basis for querying object models than SQL-derived languages.</p><p><strong>SQL speaks in relations. ObjectQuel speaks in objects.</strong></p><p>SQL is an excellent language for querying relational databases. But a developer writing business logic shouldn’t have to think in relational terms simply because the underlying storage happens to be relational.</p><h3>A Language, Not Just a Query Builder</h3><p>Most ORMs provide a query builder. Query builders are useful, but fundamentally they’re APIs for constructing queries.</p><p>ObjectQuel starts from a different premise. The query language is the primary abstraction.</p><p>Like a compiler, ObjectQuel parses the query into an abstract syntax tree. Because the engine owns the query model, it can optimize, rewrite and decompose queries independently of the underlying datastore. Those transformations happen before any SQL is generated, allowing the same query to be executed efficiently against different storage technologies.</p><p>SQL is simply one possible execution target — not the language you’re programming against.</p><h3>Different Goals</h3><p>It’s tempting to compare ObjectQuel and Doctrine feature by feature.</p><p>That’s not the comparison I find most interesting.</p><p>Doctrine focuses on mapping objects to relational storage.</p><p>ObjectQuel focuses on expressing queries in terms of the domain model.</p><p>Those goals overlap, but they lead to different abstractions. Rather than translating domain concepts into relational ones, ObjectQuel treats querying as part of the domain model itself.</p><h3>Closing Thoughts</h3><p>Doctrine has had an enormous influence on PHP development, and many of the architectural ideas behind ObjectQuel are compatible with the principles Doctrine helped popularize.</p><p>Where I chose to diverge is in the query language.</p><p>I don’t believe developers should have to think about joins when they’re working with objects. I believe they should describe the objects they’re looking for and let the query engine determine how to retrieve them efficiently.</p><p>I didn’t build ObjectQuel because I thought Doctrine needed replacing.</p><p>I built ObjectQuel because I believe object-oriented software deserves an object-oriented query language.</p><p>→ <strong>Website</strong>: <a href="https://objectquel.com/">objectquel.com</a><br> → <strong>GitHub</strong>: <a href="https://github.com/quellabs/objectquel">github.com/quellabs/objectquel</a><br> → <strong>Packagist</strong>: composer require quellabs/objectquel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e267f6bd69a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WakaPAC vs. Alpine.js: Two Answers to the Same No-Build-Step Problem]]></title>
            <link>https://medium.com/@noescom1977/wakapac-vs-alpine-js-two-answers-to-the-same-no-build-step-problem-f403bdf4f2ef?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/f403bdf4f2ef</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-library]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[reactivity]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 20:48:53 GMT</pubDate>
            <atom:updated>2026-07-20T20:53:41.358Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Both drop in with a script tag. Both skip the bundler. They disagree about what the unit of behavior is.</em></p><p>Alpine.js and WakaPAC exist for the same reason: a server-rendered page needs some reactive behavior, and pulling in React plus a build pipeline to toggle a dropdown is overkill. Both are one script tag, no npm install, no compiler. The architectures diverge on a single question, and everything else — plugins, SDK integration, observability, and component communication — is a consequence of the answer.</p><p><strong>Alpine asks: which element owns this behavior?</strong> <strong>WakaPAC asks: what message just arrived?</strong></p><h3>Element as the Unit</h3><p>x-data declares state on an element; @click, @input, x-model declare what happens to it, on the elements where those things happen. The element is the unit — behavior is written and read at the point where it applies:</p><pre>&lt;div x-data=&quot;{ query: &#39;&#39;, results: [] }&quot;&gt;<br>    &lt;input x-model.debounce.400ms=&quot;query&quot;<br>        @input=&quot;results = await (await fetch(&#39;/search?q=&#39; + query)).json()&quot;&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sy7ciW4f4TVTLIRnKWdpJA.png" /></figure><p>One modifier does the whole debounce. For a component this size, that’s genuinely less code than WakaPAC needs.</p><h3>Message as the Unit</h3><p>WakaPAC’s equivalent — a timer and two message cases — is longer for this exact component:</p><pre>// query stays in sync via data-pac-bind=&quot;value:query&quot; on the input —<br>// msgProc only has to react to it, not capture it<br>wakaPAC(&#39;#search&#39;, {<br>    query: &#39;&#39;,<br>    results: [],<br><br>    msgProc(event) {<br>        switch (event.message) {<br>            case wakaPAC.MSG_INPUT:<br>                wakaPAC.killTimer(this.pacId, this._debounce);<br>                this._debounce = wakaPAC.setTimer(this.pacId, 400);<br>                break;<br><br>            case wakaPAC.MSG_TIMER:<br>                this.fetchResults();<br>                break;<br>        }<br>    }<br>});</pre><p>Line count isn’t the interesting difference. Alpine handles behavior where it originates. WakaPAC handles every source of behavior through the same dispatch point — a click, a keystroke, and a timer firing all arrive as messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVcAVZfyh4uU3zddwE--nA.png" /></figure><p>Everything in WakaPAC starts with one decision: every interaction becomes a message. Once you make that decision, many problems stop needing their own abstractions. Plugins emit messages. Components send messages. Timers generate messages. Middleware intercepts messages. The Spy panel observes messages. They’re all different ways of producing, transforming, or observing the same thing. They aren’t separate architectural ideas — they’re all consequences of that one decision.</p><h3>Where It Shows Up: A Third-Party SDK</h3><p>Alpine’s version of “not everything is an x- attribute&quot; is a plain JS function feeding x-data, wired up in x-init. Wrapping a YouTube player means writing onStateChange and onReady callbacks by hand, each one setting the reactive properties Alpine will re-render from:</p><pre>init() {<br>    this.yt = new YT.Player(&#39;video-el&#39;, {<br>        events: { onStateChange: e =&gt; this.playing = e.data === YT.PlayerState.PLAYING }<br>    });<br>}</pre><p>Reasonable, and it works — but it’s glue written fresh for this SDK, sitting outside the attribute vocabulary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uL_Mq2GUmpCx-EWN6_aVYA.png" /></figure><p>WakaPAC’s SDK plugin (see <a href="https://medium.com/@noescom1977/wakapacs-execution-pipeline-why-third-party-sdks-finally-feel-native-12cb1e29b5f2">WakaPAC’s Execution Pipeline</a>) doesn’t just forward YouTube’s callback — it translates YouTube’s own numeric player states into the same messages any other video source would emit:</p><pre>case wakaPAC.MSG_VIDEO_PLAY:<br>    this.playing = true;<br>    break;<br><br>case wakaPAC.MSG_VIDEO_PAUSE:<br>    this.playing = false;<br>    break;</pre><p>It’s the same switch a click already goes through, and MSG_VIDEO_PLAY isn&#39;t YouTube-specific vocabulary — it&#39;s the same message a &lt;video&gt; element or a different provider&#39;s plugin would send. The plugin isn&#39;t a special mechanism bolted on for SDKs — it&#39;s the message model doing what it already does, pointed at an external event source.</p><h3>Talking Between Components</h3><p>Once a component already reacts to everything through messages, another component talking to it needs nothing new. A custom message is just a number in the same space as a click — defined off wakaPAC.MSG_USER, the reserved range for exactly this:</p><pre>const MSG_CART_UPDATED = wakaPAC.MSG_USER + 1;<br>wakaPAC.sendMessage(&#39;header-badge&#39;, MSG_CART_UPDATED, this.items.length, 0);</pre><p>The header badge handles MSG_CART_UPDATED in the same msgProc already handling its own clicks — this.count = event.wParam, one more case. Component communication doesn&#39;t introduce a new abstraction because messages were already the abstraction.</p><h3>Observability as a Consequence, Not a Feature</h3><p>Because every message passes through one pipeline before reaching msgProc, that pipeline supports hooks that see everything, without any cooperation from component code. The Spy panel I wrote about in <a href="https://medium.com/@noescom1977/both-sides-of-the-conversation-2f81cb9dfe40">Both Sides of the Conversation</a> shows every message any component received, in order, decoded, with zero added console.log calls — the observation point already existed before anyone needed one.</p><p>Alpine has no equivalent, for the same reason it has no central dispatch: there’s no single place events flow through, so there’s nothing for a hook to attach to. Ordinary DOM tools debug an Alpine app fine — they just don’t get that stream as a side effect of the architecture.</p><h3>The One Gap That Isn’t Architectural</h3><p>Alpine has years of production use behind it. WakaPAC, built by one person, doesn’t yet. That’s the honest gap — fewer years of things going wrong in production and getting fixed, not a missing capability.</p><h3>When to Reach for Which</h3><p>A page of independent widgets — a dropdown, a modal, a tab strip that don’t need to know about each other — is Alpine’s case, with less code and a shallower learning curve. WakaPAC’s model starts paying for itself once a component has to reconcile more than one kind of event, once components need to coordinate instead of manage themselves in isolation, or once something external — an SDK, a socket — needs to stop being a special case. The question isn’t whether your application is “simple” or “complex.” It’s whether your components spend their time reacting to independent elements, or reconciling many different event sources that all affect the same state.</p><p><strong>WakaPAC is open source and available at</strong> <a href="https://wakapac.com/"><strong>wakapac.com</strong></a><strong>.</strong></p><p><em>Floris van den Berg is a PHP consultant and the author of WakaPAC, Canvas, and ObjectQuel — a full-stack toolset for modernizing legacy web applications.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f403bdf4f2ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Both Sides of the Conversation]]></title>
            <link>https://medium.com/@noescom1977/both-sides-of-the-conversation-2f81cb9dfe40?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f81cb9dfe40</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[php-developers]]></category>
            <category><![CDATA[php-frameworks]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 15:38:21 GMT</pubDate>
            <atom:updated>2026-06-02T15:46:11.268Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Your PHP framework and your JavaScript library have been talking to each other this whole time. Now you can finally listen in.</em></p><p>Here’s something that’s bothered me for years.</p><p>You open a backend inspector and you get a beautiful window into your application’s server-side life. Every SQL query, its execution time, its parameters. Every route that matched. Every service that was instantiated. The backend is completely legible.</p><p>Then you close that panel and open the browser console. Scattered console.log calls. A component that&#39;s misbehaving but you&#39;re not sure whether the problem is the state, the binding, or the handler that was supposed to fire but apparently didn&#39;t. The frontend is opaque.</p><p>This bothers me because the backend and frontend aren’t actually separate conversations. They’re two halves of the same one. The user clicks a button — that’s a WakaPAC message. That message triggers a fetch — that’s a PHP route. That route runs a query — that’s a SQL execution. One interaction, three layers, and until now you could only see one of them clearly.</p><p>The WakaPAC Spy panel changes that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBuDPEskFYnk6zOQ0ZD1cA.png" /></figure><h3>The Inspector as a Shared Window</h3><p>Canvas ships with a developer inspector — a debug bar embedded at the bottom of your pages during development. You’ve seen the concept before. What makes Canvas’s version different is that it’s panel-based and extensible. Database queries live in one tab. Request and session data in another. And now, with the WakaPAC Spy panel, your JavaScript message traffic lives in a third.</p><p>The same bar. The same window. One interaction — and you can trace it from the click that WakaPAC received all the way through to the SQL query that eventually ran.</p><p>That’s not just convenient. It changes how you think about debugging. When a user reports that clicking “Submit” sometimes doesn’t do anything, you’re no longer guessing which layer the problem lives in. You open the Spy tab, reproduce the click, and immediately see what WakaPAC processed. Did the message arrive? Did it arrive at the right container? Did it land on the right target element? You know in five seconds what would previously have taken twenty minutes of console.log archaeology.</p><h3>What the Spy Panel Actually Shows</h3><p>WakaPAC routes all events through a central dispatch pipeline before they reach any component’s msgProc. That pipeline supports message hooks — observers that see every event before delivery. The Spy panel is exactly that: a hook installed at init time that captures, decodes, and displays the message stream in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFKrNOlXoMAgvc9xyqAnDw.png" /></figure><p>It never interferes. A spy hook always calls through — it observes, never swallows. Your application behaves identically whether the panel is open or not.</p><p>If you’ve ever used the Win32 Event Viewer, the Spy panel will feel immediately familiar: a live, filterable stream of structured events, each with a source, a type, and decoded details. The same idea, applied to WakaPAC’s message pipeline.</p><p>What you see in the table is designed to be readable at a glance:</p><ul><li><strong>Container</strong> — which PAC component received the message, by its pac-id</li><li><strong>Message</strong> — the symbolic name and hex code. MSG_LBUTTONDOWN (0x0201), not 513</li><li><strong>Target</strong> — the specific DOM element that originated the event. button.submit-btn, label.loom-field-label, div.waka-file-header — the actual element inside your component where the interaction started</li><li><strong>Details</strong> — decoded wParam and lParam. Mouse events show coordinates and button state. Key events show the key name and modifiers. Gesture events show the pattern name, direction sequence, and duration. Timer events show the timer ID. You read the row and understand what happened; no hex translation required.</li></ul><p>Write a msgProc handler, interact with the page, and immediately see exactly which messages arrived, in which order, with which data. Not because you added logging — because the spy was already watching.</p><h3>Live Mode and Recording Mode</h3><p>The panel runs in two modes because different debugging problems need different tools.</p><p><strong>Live mode</strong> maintains a ring buffer of the last twelve messages. It’s always on, always updating. You don’t need to do anything — just glance at the tab and you see what WakaPAC last processed. Good for ambient awareness while you’re developing: does the component I just wired up actually receive the messages I think it does?</p><p><strong>Recording mode</strong> is for the harder problem: the interaction that doesn’t reproduce cleanly while you’re watching for it. Press Record, interact with the UI, press Stop. The capture buffer fills without eviction — every message from start to stop is preserved, and the list freezes when you stop so nothing scrolls away while you’re reading. A count badge on the Recording tab shows how many events were captured, pulsing red while the session is active.</p><p>The real power of Recording mode is that you can hand a sequence to someone else. “Here are the 23 messages that fired when the form submitted incorrectly” is a much more useful bug report than “sometimes the button doesn’t work.”</p><h3>Filtering the Noise</h3><p>Not every message is equally interesting. MSG_MOUSEMOVE fires dozens of times per second. MSG_TIMER fires on a fixed interval. If both appear in the live view, they bury the events you actually care about.</p><p>The filter bar lets you toggle message categories on and off: Mouse, Move, Wheel, Key, Focus, Timer, Drag, Input, Size, Gesture. Move and Timer are off by default. Everything else is on. Your filter configuration persists across page reloads via localStorage, so you set it once and it stays.</p><p>High-frequency messages that slip through — because you’ve turned Move back on to debug a drag operation — are further collapsed. Consecutive identical messages to the same container are merged into one row with a repeat counter. MSG_MOUSEMOVE x47 takes one row. The stream stays readable.</p><p>You can also filter by container using the dropdown in the toolbar. Switching it clears the buffers and resets the counter — a clean stream for the specific component you’re investigating.</p><h3>The Missing Half</h3><p>Backend inspectors have existed for decades. We’re very good at making PHP visible to developers. The frontend has always been the harder problem — event-driven, asynchronous, spread across DOM elements and component state and closure variables that don’t show up anywhere until something breaks.</p><p>WakaPAC’s message architecture makes the frontend observable in a way that addEventListener-based code simply isn&#39;t. Every event has a type, a container, a target, and structured parameters. The Spy panel exists because once you have that structure, surfacing it to the developer costs almost nothing — and the benefit is enormous.</p><p>Both sides of the conversation, in one window. The click that started in WakaPAC is the same interaction that ran your query. Now you can see both.</p><p><strong>Canvas</strong>: <a href="https://canvasphp.com/">canvasphp.com</a><br> <strong>WakaPAC</strong>: <a href="https://wakapac.com/">wakapac.com</a></p><p><em>Floris van den Berg is a PHP consultant and the author of WakaPAC, Canvas, and ObjectQuel — a full-stack toolset for modernizing legacy web applications.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f81cb9dfe40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet ObjectQuel: A Domain-Level Query Engine for PHP]]></title>
            <link>https://medium.com/@noescom1977/meet-objectquel-a-domain-level-query-engine-for-php-ebc4b5838668?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebc4b5838668</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[orm]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Sat, 02 May 2026 07:26:15 GMT</pubDate>
            <atom:updated>2026-05-02T07:31:11.706Z</atom:updated>
            <content:encoded><![CDATA[<p>SQL is a language for thinking about tables. But your application doesn’t think in tables — it thinks in orders, customers, products, and the relationships between them. That gap between how your domain is structured and how most ORMs force you to express queries is where a lot of unnecessary complexity lives. ObjectQuel was built to close that gap.</p><p>ObjectQuel is a domain-level query engine with integrated ORM capabilities for PHP. Not a query builder. Not SQL with class names sprinkled in. It has its own parser and execution engine, and it works directly against your entity model — joins, hydration, and relationship traversal are the engine’s problem, not yours.</p><h3>The Query Language: Think in Entities, Not Tables</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nfmsg1yUmdXlpvNhYk5FFw.png" /></figure><p>ObjectQuel is inspired by QUEL, the query language from UC Berkeley’s Ingres project — the academic precursor to SQL that never got its moment in the mainstream. The core idea is declarative: you say <em>what you’re working with</em> and <em>what you want back</em>, and the engine figures out the rest.</p><p>Every query has two required parts: a <strong>range definition</strong> that declares which entities you’re working with, and a <strong>retrieve</strong> clause that specifies what comes back.</p><pre>$results = $entityManager-&gt;executeQuery(&quot;<br>    range of p is App\Entity\ProductEntity<br>    retrieve (p) where p.price &lt; :maxPrice<br>    sort by p.name asc<br>&quot;, [&#39;maxPrice&#39; =&gt; 50.00]);</pre><p>What comes back isn’t a raw result set you need to map. It’s fully hydrated entity objects, ready to use. The engine owns the SQL; you own the domain.</p><h3>Relationship Traversal Without Join Conditions</h3><p>This is where things get interesting. In most ORMs, navigating a relationship in a query means writing join conditions manually — or reaching for a query builder that generates them for you. ObjectQuel has a via keyword that does this at the language level.</p><pre>$results = $entityManager-&gt;executeQuery(&quot;<br>    range of p is App\Entity\ProductEntity<br>    range of c is App\Entity\CategoryEntity via p.categories<br>    retrieve (p, c.name) where p.price &lt; :maxPrice<br>    sort by p.name asc<br>&quot;, [&#39;maxPrice&#39; =&gt; 50.00]);<br><br>foreach ($results as $row) {<br>    $product = $row[&#39;p&#39;];           // Fully mapped ProductEntity<br>    $categoryName = $row[&#39;c.name&#39;]; // Scalar projection — only what&#39;s needed<br>    echo $product-&gt;getName() . &#39; in &#39; . $categoryName;<br>}</pre><p>via p.categories tells the engine to follow the relationship defined on ProductEntity to CategoryEntity. No join conditions. No intermediate tables. The engine knows about your relationships at parse time and resolves everything from there. You can chain via across multiple hops, and you can mix full entity retrieval with scalar projections in the same query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5L3qwjT0QOk-iIPoQALhg.png" /></figure><h3>Hybrid Queries: Database Entities and JSON Sources in One Statement</h3><p>This one tends to raise eyebrows: ObjectQuel can query a JSON file and a relational database table <em>in the same statement</em>, returning results as if they came from a single unified source.</p><pre>$results = $entityManager-&gt;executeQuery(&quot;<br>    range of order is App\Entity\OrderEntity<br>    range of product is json_source(&#39;external/product_catalog.json&#39;)<br>    retrieve (order, product.name, product.manufacturer)<br>    where order.productSku = product.sku<br>      and order.status = :status<br>    sort by order.orderDate desc<br>&quot;, [&#39;status&#39; =&gt; &#39;pending&#39;]);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9P7Xafr8nOZj8eGBkeZ7g.png" /></figure><p>The practical use cases are real: cached API responses, configuration-driven data, external catalog feeds that you don’t want to import into your database. You can also pre-filter the JSON with JSONPath expressions before ObjectQuel processes it, which keeps memory usage manageable on larger files.</p><p>ObjectQuel handles source resolution transparently. Your query stays uniform regardless of where the data lives.</p><h3>Built-In Full-Text Search with Relevance Scoring</h3><p>Full-text search is a first-class feature of the query language, not an afterthought bolted on through a LIKE clause. The search() function integrates directly into the where clause and uses MySQL full-text indexes when they&#39;re available — falling back to LIKE statements when they&#39;re not, with identical result semantics either way.</p><pre>$results = $entityManager-&gt;executeQuery(&quot;<br>    range of p is App\Entity\ProductEntity<br>    retrieve (p, search_score(p.name, p.description, :term) as score)<br>    where search(p.name, p.description, :term)<br>    sort by score desc<br>&quot;, [&#39;term&#39; =&gt; &#39;bluetooth speaker&#39;]);</pre><p>You can combine search() with any other filter condition, traverse relationships, and use boolean operators (+word required, -word excluded) in the search term. The search_score() function returns the numeric relevance value — useful for ranking results or exposing it as a field in your response.</p><h3>Clean Entities, Serious Architecture</h3><p>Underneath the query language is a Data Mapper ORM. Entities are plain PHP classes with no base class requirements, no magic methods, and no persistence knowledge. ProductEntity doesn&#39;t know what database it lives in. It doesn&#39;t know when it gets saved. That&#39;s the EntityManager&#39;s responsibility.</p><pre>$product = new ProductEntity();<br>$product-&gt;setName(&#39;Wireless Mouse&#39;);<br>$product-&gt;setPrice(29.99);<br><br>$entityManager-&gt;persist($product);<br>$entityManager-&gt;flush();</pre><p>This matters for legacy modernization especially. You can introduce ObjectQuel into an existing codebase incrementally — the Sculpt CLI handles reverse engineering from existing tables, entity generation, and schema migrations. You don’t need to commit to a full rewrite to start using it.</p><h3>Who Is This For?</h3><p>ObjectQuel targets PHP developers who’ve outgrown raw SQL for complex domain queries but find DQL too verbose and query builders too leaky. It’s particularly well-suited for legacy modernization projects where you want to layer a proper domain model over an existing schema without abandoning what’s already there.</p><p>It’s open source, MIT licensed, and currently at v1.1.2.</p><p>→ <strong>Website</strong>: <a href="https://objectquel.com/">objectquel.com</a><br> → <strong>GitHub</strong>: <a href="https://github.com/quellabs/objectquel">github.com/quellabs/objectquel</a><br> → <strong>Packagist</strong>: composer require quellabs/objectquel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebc4b5838668" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WakaPAC Speaks DirectX: Blitting Sprites and Playing Sound Effects Like It’s 1996]]></title>
            <link>https://medium.com/@noescom1977/wakapac-speaks-directx-blitting-sprites-and-playing-sound-effects-like-its-1996-37f6e089696f?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/37f6e089696f</guid>
            <category><![CDATA[reactivity]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 18:30:38 GMT</pubDate>
            <atom:updated>2026-04-29T18:30:38.784Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How borrowing two Win32 multimedia APIs turns the browser into a capable 2D game and rich-media platform — without a build step</em></p><p>In my <a href="https://medium.com/@noescom1977/wakapacs-execution-pipeline-why-third-party-sdks-finally-feel-native-12cb1e29b5f2">previous post</a>, I showed how WakaPAC’s plugin layer normalizes third-party SDKs — YouTube, CKEditor, TinyMCE — into the same msgProc pipeline used for keyboard input and mouse capture. The pattern was simple: translate external events into WakaPAC messages and treat everything as a first-class citizen of the event loop.</p><p>This post takes that idea somewhere different: two new plugins that don’t wrap an existing SDK at all, but instead model themselves directly on the Win32 multimedia subsystem. WakaDDraw does for graphics what msgProc did for events. WakaDSound does the same for audio. Together they turn WakaPAC into something you wouldn&#39;t normally expect from a no-build-step browser library: a complete 2D game and rich-media runtime.</p><h3>The Mental Model Problem</h3><p>Modern web development gives you the Canvas 2D API and the Web Audio API. Both are capable. Neither gives you a mental model.</p><p>With Canvas, you’re responsible for everything: clearing the screen, tracking what changed, deciding what to redraw, managing your rendering loop. There’s no concept of a sprite, no dirty rect tracking, no z-order. You build all of that from scratch, every project, or you pull in a game library with its own idiom and lifecycle requirements.</p><p>Web Audio is similar. The graph-based API is powerful but low-level. You wire nodes together, manage source lifetimes (AudioBufferSourceNode is single-use — a fact that bites everyone at least once), handle browser autoplay restrictions, deal with the difference between short sound effects and long music streams. It’s all doable. It’s also all ceremony that has nothing to do with your actual problem.</p><p>DirectX solved this in 1995. DirectDraw gave you surfaces and a blitter. DirectSound gave you static buffers for sound effects and streaming buffers for music. The conceptual model was clear, and it mapped directly onto what games actually need.</p><p>WakaDDraw and WakaDSound port that model to the browser.</p><h3>WakaDDraw: Surfaces and a Blitter</h3><p>The complete mental model for WakaDDraw is: everything is a surface. The component’s &lt;canvas&gt; element is the onscreen primary surface. Sprites, backgrounds, tilesets — all offscreen surfaces. You draw into offscreen surfaces once, then blit them onto the primary as fast as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LnXdg7-oFIBgYcZdppPLLQ.png" /></figure><pre>wakaPAC.use(wakaDDraw);<br><br>wakaPAC(&#39;game&#39;, {<br>    async init() {<br>        this.primary = wakaDDraw.getSurface(this.pacId);<br>        this.hero    = await wakaDDraw.loadSurface(&#39;/sprites/hero.png&#39;);<br><br>        this._timer = wakaPAC.setTimer(this.pacId, 16);<br>        this._x = 100;<br>    },<br><br>    msgProc(event) {<br>        if (event.message === wakaPAC.MSG_TIMER) {<br>            wakaDDraw.clearSurface(this.primary, &#39;#1a2a3a&#39;);<br>            wakaDDraw.bltFast(this.primary, this._x, 80, this.hero);<br>            this._x += 1;<br>        }<br>    }<br>});</pre><p>loadSurface() fetches the image, creates an offscreen surface sized to it, blits the pixels in, and returns a handle. PNG alpha is preserved automatically. bltFast() composites it onto the primary using standard alpha blending — no per-pixel CPU loop. The underscore-prefixed _timer and _x are non-reactive bookkeeping properties that won&#39;t cause DOM rerenders.</p><p>That’s the low-level blitter. It’s direct, it’s explicit, and it’s exactly the pattern you’d use in real DirectDraw.</p><h3>Color Keys and Legacy Assets</h3><p>Real DirectDraw heavily used color keying — designating one color (magenta #ff00ff being the classic choice) as transparent. Pixels matching the key were skipped by the blitter. It was how sprite transparency worked before alpha channels became common.</p><p>WakaDDraw supports this, but inverts where the work happens. DirectDraw’s hardware blitter compared each pixel against the key color live on every blt — essentially free in dedicated blitter hardware. On Canvas 2D, a per-pixel CPU loop on every frame would be expensive. So WakaDDraw bakes the transparency in once at load time:</p><pre>// PNG with native alpha — the default, no opts needed<br>this.hero = await wakaDDraw.loadSurface(&#39;/sprites/hero.png&#39;);<br><br>// Legacy sprite sheet using magenta as fake transparency<br>this.enemy = await wakaDDraw.loadSurface(&#39;/sprites/enemy.png&#39;, { colorKey: &#39;#ff00ff&#39; });</pre><p>applyColorKey() sets all matching pixels to alpha=0 once. Every blt after that is standard GPU-accelerated compositing. Legacy assets get the color key behavior they expect; modern PNGs with native alpha need no special treatment.</p><h3>The Scene System: Dirty Rects and Z-Order</h3><p>The blitter is the right tool when you’re drawing everything from scratch every frame — clear, blit, done. But once you have more than a handful of sprites, that approach wastes work. Most sprites don’t move on most frames. Clearing and recompositing the entire canvas to move one character a few pixels is exactly the kind of unnecessary work that made early game engines invest heavily in dirty rect tracking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDLsb0i1xtCQlFsvvt-l_g.png" /></figure><p>WakaDDraw’s scene system solves this the same way DirectDraw scene managers did: it maintains a z-sorted sprite list and a list of damaged regions. When a sprite moves, only the rectangle it vacated and the rectangle it now occupies are marked dirty. On sceneRender(), those regions are repainted from scratch — background color first, then all sprites that intersect each dirty rect composited in z-order — and nothing else is touched. Fifty sprites on screen, one moving: fifty minus one cost nothing that frame.</p><p>The z-order matters too. In a bare blitter loop you have to manually control draw order, which means manually tracking what sits in front of what. The scene system handles it — pass a z-value when creating a sprite and it stays sorted correctly, even if you change z at runtime.</p><pre>async init() {<br>    this.primary     = wakaDDraw.getSurface(this.pacId);<br>    this.heroSurface = await wakaDDraw.loadSurface(&#39;/sprites/hero.png&#39;);<br><br>    this.scene = wakaDDraw.sceneCreate({ background: &#39;#1a2a3a&#39; });<br>    this.hero  = wakaDDraw.createSprite(this.heroSurface, null, 1); // z=1, draws on top<br>    this.hero.moveTo(100, 80);<br><br>    wakaDDraw.sceneAddSprite(this.scene, this.hero);<br>    wakaDDraw.sceneInvalidate(this.scene, this.primary);<br><br>    this._timer = wakaPAC.setTimer(this.pacId, 16);<br>},<br><br>msgProc(event) {<br>    if (event.message === wakaPAC.MSG_TIMER) {<br>        this.hero.moveTo(this.hero.x + 1, this.hero.y);<br>        wakaDDraw.sceneRender(this.scene, this.primary);<br>    }<br>}</pre><p>One thing worth calling out: sceneInvalidate() after setup is not optional. The scene starts with an empty dirty list, which means the first sceneRender() call is a no-op — nothing is marked dirty yet, so nothing gets drawn. You&#39;d stare at a blank canvas wondering what went wrong. Call sceneInvalidate() once after adding your initial sprites and the first frame renders correctly.</p><p>If dirty rect fragmentation gets extreme — more than 64 non-overlapping rects in a single frame — the system falls back to a full redraw for that frame rather than letting the rectangle subtraction algorithm become a bottleneck. In practice this threshold is high enough that you’ll never hit it in normal use.</p><h3>Tilemaps</h3><p>A tilemap is the standard way to represent a large 2D world without storing a separate surface for every possible screen position. The idea is simple: you have a tile sheet — a single image containing all your tile graphics arranged in a uniform grid — and a map array that records which tile goes where. The map can represent a world thousands of tiles across using almost no memory, because it stores indices, not pixels.</p><p>WakaDDraw’s tilemap renderer takes a tile sheet surface, tile dimensions, a Uint16Array of indices, and the map size in tiles. You then call drawTo() with a scroll offset and a destination offscreen surface, and it renders only the tiles that fall within the visible window. That destination surface can then be used as a z=0 background sprite in the scene system, with your character sprites composited on top through the normal dirty rect pipeline.</p><pre>const mapData = new Uint16Array(64 * 64);<br>// fill in tile indices — 0 is the first tile on the sheet, no reserved empty slot<br>mapData[14 * 64 + 20] = 2; // place tile index 2 at column 20, row 14<br><br>const tileSheet = await wakaDDraw.loadSurface(&#39;/sprites/tiles.png&#39;);<br>const map = wakaDDraw.createTilemap(tileSheet, 16, 16, mapData, 64, 64);<br><br>const tileSurface = wakaDDraw.createSurface(320, 240);<br>map.drawTo(tileSurface, this.scrollX, this.scrollY);<br><br>const tileSprite = wakaDDraw.createSprite(tileSurface, null, 0); // z=0, behind everything<br>wakaDDraw.sceneAddSprite(this.scene, tileSprite);</pre><p>The key discipline here is that drawTo() redraws the entire destination surface, so you only call it when the scroll position actually changes. On frames where nothing scrolls, the tile surface is unchanged and the scene system treats it like any other stationary sprite — free. When the player does move and you call drawTo(), you then invalidate the scene so the compositor picks up the updated pixels.</p><h3>WakaDSound: Buffers and Streams</h3><p>WakaDSound maps onto two DirectSound concepts that have obvious browser equivalents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPm_TWSaioQ2umZt8161sQ.png" /></figure><p><strong>Static buffers</strong> are the equivalent of DirectSound’s IDirectSoundBuffer with preloaded data: the entire audio file is decoded into memory on load, so play() is immediate. Use them for sound effects — things that need to fire on keypress with zero perceivable latency and that might play multiple times in rapid succession.</p><p><strong>Streaming buffers</strong> are for music and ambience: long-form audio that shouldn’t occupy a chunk of memory equal to the file size.</p><pre>async init() {<br>    this.snd   = await wakaDSound.loadBuffer(&#39;/sfx/click.wav&#39;);<br>    this.music = await wakaDSound.loadStream(&#39;/music/theme.ogg&#39;, { loop: true });<br>    wakaDSound.play(this.music);<br>},<br><br>msgProc(event) {<br>    if (event.message === wakaPAC.MSG_LCLICK) {<br>        wakaDSound.play(this.snd);<br>    }<br>}</pre><p>One handle, one playback slot. Calling play() on an already-playing handle is a no-op. No need to manage multiple source nodes for an effect that might fire while it&#39;s still playing — that&#39;s the design intent, and it matches the most common use case.</p><h3>The AudioBufferSourceNode Problem</h3><p>This is worth a mention because it trips up almost everyone who writes Web Audio code from scratch. AudioBufferSourceNode is single-use in the Web Audio API: once you call start(), you can never start it again. If you want to replay a sound, you have to create a new source node. Most tutorials omit this.</p><p>WakaDSound hides it completely. On every play() call for a static buffer, a fresh AudioBufferSourceNode is created internally while the gain and pan nodes are kept alive across plays. The decoded audio data — the expensive part — is reused. You never see any of this.</p><p>For streams, there’s a different problem: resuming a paused MediaElementAudioSourceNode produces an audible click in some browsers. WakaDSound avoids this by replacing the underlying HTMLAudioElement with a fresh one on each play() call, loaded from the same URL, while keeping the gain node in place. Again, completely invisible from the outside.</p><h3>Messages</h3><p>Like everything in WakaPAC, WakaDSound integrates into msgProc. Playback events arrive as messages, not callbacks:</p><pre>msgProc(event) {<br>    switch (event.message) {<br>        case WakaDSound.MSG_BUFFER_STARTED:<br>            // A sound effect started playing<br>            break;<br><br>        case WakaDSound.MSG_STREAM_STOPPED:<br>            // Music track ended — queue the next track<br>            wakaDSound.play(this.nextTrack);<br>            break;<br><br>        case WakaDSound.MSG_STREAM_BUFFERING:<br>            this.showBufferingIndicator = true;<br>            break;<br><br>        case WakaDSound.MSG_STREAM_READY:<br>            this.showBufferingIndicator = false;<br>            break;<br>    }<br>}</pre><p>Global messages (buffer loaded, stream failed) go to all components. Per-handle messages (started, stopped, buffering) go only to the component that owns the handle — determined by scanning the abstraction root for a property holding that handle reference. This means handles need to be top-level properties of the abstraction, not nested in sub-objects.</p><h3>Volume, Pan, and 3D Positional Audio</h3><p>setVolume() and setPan() work as you&#39;d expect. For 2D games that want spatial audio — sound effects panning based on where they occur on screen — WakaDSound has a full 3D positional audio system built on the Web Audio API&#39;s PannerNode with HRTF processing:</p><pre>const explosion = await wakaDSound.loadBuffer(&#39;/sfx/explosion.wav&#39;, { positional: true });<br>wakaDSound.play(explosion);<br>wakaDSound.setPosition(explosion, spriteX - viewportCenterX, 0, -10);<br>wakaDSound.setListenerPosition(0, 0, 0);<br>wakaDSound.setListenerOrientation(0, 0, -1);</pre><p>For a 2D game, position everything on the XZ plane with the listener at the origin facing -Z. The engine calculates panning and attenuation automatically.</p><h3>The Analyser</h3><p>For games with audio visualizers, or any UI that wants to react to music, there’s an analyser that delivers waveform data on every animation frame:</p><pre>const analyser = wakaDSound.createAnalyser(data =&gt; {<br>    // data is a Uint8Array of time-domain samples, called every frame<br>    this.drawWaveform(data);<br>});</pre><p>It captures all currently playing audio — buffers and streams simultaneously. The callback receives the same buffer every frame, pre-allocated to avoid garbage collection pressure. If you need the data beyond the callback, copy it explicitly.</p><h3>Why This Belongs in a Frontend Library</h3><p>WakaPAC’s central premise is that the Win32 mental model — message loops, window procedures, centralized input handling — translates well to the browser. msgProc was the first proof of that. WakaDDraw and WakaDSound are the natural continuation: if you&#39;re already thinking in terms of Win32 event dispatch, surfaces and blitters and sound buffers aren&#39;t a detour, they&#39;re the same idea applied to two more subsystems.</p><p>That said, neither plugin is only useful for games. The surface/blitter model is useful anywhere you have layered canvas content that updates independently — a real-time monitoring dashboard where only changed panels need to repaint, a pixel-level image annotation tool where the source image, annotation overlays, and cursor are separate layers, an interactive map where markers move over a static background. The buffer/stream model solves problems that come up in product demos, training content, interactive documentation.</p><p>The deeper point is consistency. You don’t switch mental models depending on whether you’re handling a keyboard shortcut, playing a sound effect, or compositing a sprite. It all flows through the same pipeline, with the same ownership rules and the same lifecycle discipline. That’s what made Win32 durable for 30 years of desktop development, and it’s what WakaPAC is trying to bring to the browser.</p><p>You need the same thing you needed in 1996: a clear mental model and an API that maps onto it.</p><p><strong>WakaPAC is open source and available at </strong><a href="https://wakapac.com/"><strong>wakapac.com</strong></a><strong>.</strong></p><p><em>Floris van den Berg is a PHP consultant and the author of WakaPAC, Canvas, and ObjectQuel — a full-stack toolset for modernizing legacy web applications.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37f6e089696f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WakaPAC’s Execution Pipeline: Why Third-Party SDKs Finally Feel Native]]></title>
            <link>https://medium.com/@noescom1977/wakapacs-execution-pipeline-why-third-party-sdks-finally-feel-native-12cb1e29b5f2?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/12cb1e29b5f2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 15:17:12 GMT</pubDate>
            <atom:updated>2026-04-16T05:31:50.533Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How a unified message model turns YouTube, Vimeo, CKEditor, and TinyMCE into first-class components</em></p><p>In my <a href="https://medium.com/@noescom1977/wakapac-the-reactive-javascript-library-that-learns-from-the-past-to-build-the-future-822151a375cf">first WakaPAC post</a>, I talked about borrowing the best ideas from Knockout.js, Vue, and React. In my <a href="https://medium.com/@noescom1977/wakapac-gets-a-window-procedure-desktop-grade-event-handling-in-the-browser-a7af062a79f6">second post</a>, I introduced msgProc — WakaPAC&#39;s Win32-style window procedure that routes all input through a single, stateful handler per component.</p><p>Those two articles were about the foundation. This one is about what happens when you build on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XA0iydqESTtlwt66kmqKA.png" /></figure><p>WakaPAC now includes a plugin layer that wraps third-party SDKs — YouTube, Vimeo, CKEditor, TinyMCE, the native &lt;video&gt; element, and others — and funnels their events through the same msgProc pipeline you already use for keyboard input and mouse capture. The result is third-party APIs that behave like native WakaPAC components, because from msgProc&#39;s perspective, they are.</p><h3>The Problem with Third-Party SDK Integration</h3><p>Let me describe a pattern you’ve probably lived through.</p><p>You’re building a page with a YouTube embed and a custom controls bar — progress slider, play button, a time display. The YouTube IFrame API has its own initialization lifecycle, its own event callbacks, and it communicates through postMessage and polling. Your controls bar has its own state, its own click handlers. Neither knows the other exists.</p><p>So you write glue code. A shared module, maybe a global. You wire the YouTube onStateChange callback to update a variable, and you wire your controls to call YT.player.seekTo(). You handle the timing problem where the player isn&#39;t ready when your component initializes. You set up a requestAnimationFrame loop to poll the current time for the progress bar.</p><p>It works, eventually. But the conceptual model is fractured. The YouTube SDK’s event model is completely separate from your component event model. Every third-party library you add is another integration to maintain on its own terms.</p><h3>One Execution Model</h3><p>WakaPAC’s plugin architecture solves this by doing one thing: translating each SDK’s native events into WakaPAC messages, and delivering them to msgProc like any other event.</p><p>Here’s what YouTube integration looks like:</p><pre>&lt;div id=&quot;player&quot; data-youtube-id=&quot;dQw4w9WgXcQ&quot;&gt;&lt;/div&gt;</pre><pre>wakaPAC.use(WakaYouTube);<br><br>wakaPAC(&#39;#player&#39;, {<br>    playing: false,<br>    buffering: false,<br><br>    msgProc(event) {<br>        switch (event.message) {<br>            case WakaYouTube.MSG_VIDEO_LOADED:<br>                WakaYouTube.play(this.pacId);<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_PLAY:<br>                this.playing = true;<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_PAUSE:<br>            case WakaYouTube.MSG_VIDEO_ENDED:<br>                this.playing = false;<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_WAITING:<br>                this.buffering = true;<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_CANPLAY:<br>                this.buffering = false;<br>                break;<br>        }<br>    }<br>});</pre><p>No callback registration. No polling. No lifecycle timing issues — MSG_VIDEO_LOADED tells you exactly when the player is ready for commands. The IFrame API script is injected automatically on first use; you don&#39;t manage it.</p><p>The wParam and lParam convention from Win32 carries over. MSG_VIDEO_TIMEUPDATE puts the current position in milliseconds into wParam for cheap integer comparisons, with full sub-second precision in event.detail.currentTime if you need it. MSG_VIDEO_ERROR puts the YouTube error code in wParam so you can switch on it directly, without digging into the event detail object.</p><p>The YouTube player and a keyboard shortcut handler and a drag operation live in the same dispatch table, handled by the same function, with the same mental model.</p><h3>A Custom Video Player in 40 Lines</h3><p>Here’s where the execution model pays off. A YouTube player component and a separate controls component communicate through WakaPAC’s inter-component messaging:</p><pre>// The player — just handles playback events<br>wakaPAC(&#39;#player&#39;, {<br>    duration: 0,<br><br>    msgProc(event) {<br>        switch (event.message) {<br>            case WakaYouTube.MSG_VIDEO_LOADED:<br>                this.duration = event.detail.duration;<br>                <br>                wakaPAC.sendMessage(&#39;controls&#39;, WakaYouTube.MSG_VIDEO_LOADED, 0, 0, {<br>                    duration: event.detail.duration<br>                });<br><br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_TIMEUPDATE:<br>                wakaPAC.postMessage(&#39;controls&#39;, WakaYouTube.MSG_VIDEO_TIMEUPDATE,<br>                    event.wParam, 0);<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_PLAY:<br>            case WakaYouTube.MSG_VIDEO_PAUSE:<br>            case WakaYouTube.MSG_VIDEO_ENDED:<br>                wakaPAC.postMessage(&#39;controls&#39;, event.message, 0, 0);<br>                break;<br>        }<br>    }<br>});<br><br>// The controls bar — handles user input and reflects playback state<br>wakaPAC(&#39;#controls&#39;, {<br>    playing: false,<br>    progressMs: 0,<br>    duration: 0,<br><br>    computed: {<br>        progressPercent() {<br>            return this.duration &gt; 0<br>                ? (this.progressMs / (this.duration * 1000)) * 100<br>                : 0;<br>        }<br>    },<br><br>    togglePlay() {<br>        if (this.playing) {<br>            WakaYouTube.pause(&#39;player&#39;);<br>        } else {<br>            WakaYouTube.play(&#39;player&#39;);<br>        }<br>    },<br><br>    msgProc(event) {<br>        switch (event.message) {<br>            case WakaYouTube.MSG_VIDEO_LOADED:<br>                this.duration = event.detail.duration;<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_TIMEUPDATE:<br>                this.progressMs = event.wParam;<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_PLAY:<br>                this.playing = true;<br>                break;<br><br>            case WakaYouTube.MSG_VIDEO_PAUSE:<br>            case WakaYouTube.MSG_VIDEO_ENDED:<br>                this.playing = false;<br>                break;<br>        }<br>    }<br>});</pre><p>Two components, clearly separated by responsibility, communicating through the same message system used everywhere else in WakaPAC. The controls respond to messages — WakaVimeo and WakaVideo surface the same message constants, so the controls component works unchanged regardless of which video provider is behind the player.</p><p>That last point deserves emphasis. MSG_VIDEO_PLAY, MSG_VIDEO_PAUSE, MSG_VIDEO_TIMEUPDATE mean the same thing regardless of which plugin generates them. Your controls component is genuinely portable across video providers.</p><h3>Rich Text Editors Without the Friction</h3><p>The same pattern applies to rich text editors. CKEditor and TinyMCE have completely different JavaScript APIs, different initialization lifecycles, different event systems. WakaCKEditor and WakaTinyMCE normalize all of that away.</p><pre>wakaPAC.use(WakaCKEditor);<br><br>wakaPAC(&#39;#editor&#39;, {<br>    content: &#39;&#39;,<br>    wordCount: 0,<br>    dirty: false,<br><br>    msgProc(event) {<br>        switch (event.message) {<br>            case WakaCKEditor.MSG_EDITOR_READY:<br>                // Safe to interact with the editor from here<br>                WakaCKEditor.setValue(this.pacId, this.content);<br>                break;<br><br>            case wakaPAC.MSG_CHANGE:<br>                this.content = event.detail.value;<br>                this.dirty = true;<br>                break;<br>        }<br>    }<br>});</pre><p>The accelerator table from the previous article integrates naturally here:</p><pre>const CMD_SAVE = 101;<br><br>init() {<br>    wakaPAC.loadAcceleratorTable(this.pacId, [<br>        { key: &#39;Ctrl+S&#39;, cmdId: CMD_SAVE },<br>    ]);<br>},<br><br>msgProc(event) {<br>    switch (event.message) {<br>        case wakaPAC.MSG_ACCEL:<br>            if (event.wParam === CMD_SAVE &amp;&amp; this.dirty) {<br>                this.save();<br>            }<br><br>            break;<br><br>        case wakaPAC.MSG_CHANGE:<br>            this.content = event.detail.value;<br>            this.dirty = true;<br>            break;<br>    }<br>},<br><br>async save() {<br>    await fetch(&#39;/api/content&#39;, {<br>        method: &#39;POST&#39;,<br>        body: JSON.stringify({ html: this.content })<br>    });<br>    this.dirty = false;<br>}</pre><p>The keyboard shortcut and the editor change event coexist in the same dispatch table. That’s the point of the pipeline: everything comes through one place, and the place has no opinion about where the event came from.</p><h3>A Different Execution Model — That Connects to the Same Things</h3><p>The DOM event model is listener-centric. You attach a callback to a specific element for a specific event type, and it fires when that element is interacted with. It works, but it distributes your control flow across dozens of individual registrations.</p><p>WakaPAC’s execution model is message-centric. Everything — keyboard input, mouse events, timer ticks, plugin state changes, inter-component messages — flows into msgProc as a structured message with a consistent shape. Your component doesn&#39;t subscribe to events; it receives messages.</p><p>WakaPAC sits on top of the browser’s event system, just as Win32’s window procedure sat on top of the OS message loop. The pipeline is available when you need centralized control — for the editor that needs to intercept keystrokes before CKEditor sees them, for the video component that needs to coordinate across three related components, for the application that needs to log every user interaction for analytics.</p><p>What the plugin layer adds to this picture is a horizontal expansion. The message model that made msgProc powerful for native browser events is equally powerful for third-party SDK events. Normalizing them into the same pipeline is the practical payoff.</p><h3>Still One Script Tag</h3><pre>&lt;script src=&quot;wakapac.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;plugins/wakayoutube.min.js&quot;&gt;&lt;/script&gt;</pre><p>No build step, no bundler, no CLI. The same philosophy as the first post. The execution pipeline grew considerably more powerful — the entry point stayed the same.</p><p>WakaPAC is open source and available at <a href="https://wakapac.com/">wakapac.com</a>.</p><p><em>Floris van den Berg is a PHP consultant and the author of WakaPAC, Canvas, and ObjectQuel — a full-stack toolset for modernizing legacy web applications.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12cb1e29b5f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WakaPAC Gets a Window Procedure: Desktop-Grade Event Handling in the Browser]]></title>
            <link>https://medium.com/@noescom1977/wakapac-gets-a-window-procedure-desktop-grade-event-handling-in-the-browser-a7af062a79f6?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7af062a79f6</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 21:02:35 GMT</pubDate>
            <atom:updated>2026-03-18T21:02:35.122Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How borrowing a 30-year-old Win32 pattern solves problems that modern frameworks still struggle with</em></p><p>In my <a href="https://medium.com/@noescom1977/wakapac-the-reactive-javascript-library-that-learns-from-the-past-to-build-the-future-822151a375cf">first WakaPAC post</a>, I talked about learning from the past — taking the best ideas from Knockout.js, Vue, and React and combining them with the PAC architecture. Since then, WakaPAC has gained something that proves that philosophy goes deeper than just reactivity: a full Win32-style message processing pipeline called msgProc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85LrLVBi9sRhiElS14rz8w.png" /></figure><p>If you’ve ever written a Windows application, you’ll recognize the name immediately. If you haven’t, you’re about to see why desktop developers have been doing it this way for three decades.</p><h3>The Problem With Event Listeners</h3><p>Modern frontend development gives you addEventListener. You attach a handler to an element, and when something happens to that element, your handler runs. Simple. Clean. And completely inadequate for anything beyond basic interactions.</p><p>Here’s what happens when your requirements get real:</p><ul><li>You need <strong>Ctrl+S to save</strong> regardless of what’s focused inside your component</li><li>You need to <strong>track a drag operation</strong> that started on one element but where the cursor now floats somewhere outside it</li><li>You need to <strong>coordinate mousedown, mousemove, and mouseup</strong> as a stateful sequence, not three independent events</li><li>You need to <strong>block form submission</strong> while async validation is in flight</li><li>You need a <strong>60 FPS game loop</strong> that pauses when the component is hidden</li></ul><p>With addEventListener you end up with state scattered across closure variables, event listeners attached to document and remembered to be cleaned up, brittle sequencing logic, and a growing list of edge cases. You&#39;ve reinvented a message loop — poorly.</p><h3>Enter msgProc</h3><p>WakaPAC’s msgProc is the equivalent of a Win32 WndProc: a single function on your component that receives every event occurring within its container as a structured message, before standard bindings execute.</p><pre>wakaPAC(&#39;#my-editor&#39;, {<br>    msgProc(event) {<br>        switch (event.message) {<br>            case wakaPAC.MSG_KEYDOWN:<br>                if (event.wParam === wakaPAC.VK_S &amp;&amp; (event.lParam &amp; wakaPAC.KM_CONTROL)) {<br>                    this.save();<br>                    return false; // Stop processing<br>                }<br><br>                break;<br><br>           case wakaPAC.MSG_LBUTTONDBLCLK:<br>                this.openDetail();<br>                return false;<br><br>         case wakaPAC.MSG_TIMER:<br>                if (event.wParam === this.autosaveTimer) {<br>                    this.autosave();<br>                }<br>                break;<br>        }<br>    }<br>});</pre><p>The event structure is deliberately Win32-flavored:</p><ul><li><strong>message</strong> — what happened (MSG_KEYDOWN, MSG_MOUSEMOVE, MSG_TIMER, etc.)</li><li><strong>wParam</strong> — primary data (virtual key code, timer ID, character delta)</li><li><strong>lParam</strong> — secondary data (packed mouse coordinates, modifier flags)</li><li><strong>detail</strong> — richer structured data for events that need it</li></ul><p>Return false to consume the event and stop processing. Return nothing to let it fall through to standard data-pac-bind handlers. That&#39;s the entire contract.</p><h3>Mouse Capture: The Solution to Broken Drag Operations</h3><p>Here’s a failure mode every frontend developer has hit. You’re implementing a drag operation:</p><ol><li>User presses mouse button → start drag</li><li>User moves mouse → update position</li><li>Mouse leaves the element boundary → <strong>mousemove stops firing</strong></li><li>User releases mouse button outside your element → <strong>mouseup never arrives</strong></li><li>Your component is now stuck in a dragging state forever</li></ol><p>The Win32 answer to this has always been SetCapture(). WakaPAC implements it:</p><pre>msgProc(event) {<br>    if (event.message === wakaPAC.MSG_LBUTTONDOWN) {<br>        wakaPAC.setCapture(this.pacId);<br>        this._dragging = true;<br>        this._startX = wakaPAC.MAKEPOINTS(event.lParam).x;<br>        return false;<br>    }<br><br>    if (event.message === wakaPAC.MSG_MOUSEMOVE &amp;&amp; this._dragging) {<br>        const pos = wakaPAC.MAKEPOINTS(event.lParam);<br>        this.x += pos.x - this._startX;<br>        this._startX = pos.x;<br>        return false;<br>    }<br><br>   if (event.message === wakaPAC.MSG_LBUTTONUP) {<br>        wakaPAC.releaseCapture();<br>        this._dragging = false;<br>        return false;<br>    }<br><br>    // Capture lost unexpectedly (another component grabbed it)<br>    if (event.message === wakaPAC.MSG_CAPTURECHANGED) {<br>        this._dragging = false;<br>        this.resetDragState();<br>        return false;<br>    }<br>}</pre><p>While capture is active, <strong>all mouse events route to your container regardless of where the cursor is</strong>. The drag never breaks. MSG_CAPTURECHANGED handles the edge case where another component steals capture out from under you.</p><p>Note the underscore-prefixed properties — _dragging, _startX. In WakaPAC, underscore-prefixed properties don&#39;t trigger DOM reactivity. Drag state is internal bookkeeping, not UI state, so it shouldn&#39;t cause rerenders.</p><h3>Accelerator Tables</h3><p>One of the more satisfying features to port from Win32 was the accelerator table — a declarative keyboard shortcut registry that fires structured command IDs instead of raw key events:</p><pre>const CMD_SAVE  = 101;<br>const CMD_UNDO  = 102;<br>const CMD_REDO  = 103;<br>const CMD_FIND  = 104;<br><br>init() {<br>    wakaPAC.loadAcceleratorTable(this.pacId, [<br>        { key: &#39;Ctrl+S&#39;,       cmdId: CMD_SAVE },<br>        { key: &#39;Ctrl+Z&#39;,       cmdId: CMD_UNDO },<br>        { key: &#39;Ctrl+Shift+Z&#39;, cmdId: CMD_REDO },<br>        { key: &#39;Ctrl+F&#39;,       cmdId: CMD_FIND },<br>    ]);<br>},<br><br>msgProc(event) {<br>    if (event.message === wakaPAC.MSG_ACCEL) {<br>        switch (event.wParam) {<br>            case CMD_SAVE: this.save();           break;<br>            case CMD_UNDO: this.undo();           break;<br>            case CMD_REDO: this.redo();           break;<br>            case CMD_FIND: this.openFindDialog(); break;<br>        }<br>    }<br>},<br><br>destroy() {<br>    wakaPAC.destroyAcceleratorTable(this.pacId);<br>}</pre><p>The shortcut string format (&quot;Ctrl+Shift+Z&quot;) is human-readable, and getAcceleratorTable() returns the registered entries — which means you can build a keyboard shortcuts help dialog directly from the table you already maintain. No parallel data structure needed.</p><p>Accelerator tables also participate in WakaPAC’s container hierarchy: a parent container’s shortcuts fire for all its descendants. Define application-wide shortcuts once at the top level.</p><h3>Timers That Belong to Components</h3><p>setInterval in JavaScript is a footgun. It&#39;s global, it keeps firing after the component that created it is gone, and the ID is easy to lose. WakaPAC timers are scoped to a component and delivered as MSG_TIMER events:</p><pre>init() {<br>    this.clockTimer     = wakaPAC.setTimer(this.pacId, 1000);<br>    this.autosaveTimer  = wakaPAC.setTimer(this.pacId, 30000);<br>},<br><br>msgProc(event) {<br>    if (event.message === wakaPAC.MSG_TIMER) {<br>        switch (event.wParam) {<br>            case this.clockTimer:<br>                this.time = new Date().toLocaleTimeString();<br>                break;<br><br>            case this.autosaveTimer:<br>                if (this.isDirty) this.save();<br>                break;<br>        }<br>    }<br>},<br><br>destroy() {<br>    wakaPAC.killAllTimers(this.pacId);<br>}</pre><p>Multiple timers, distinguished by ID in event.wParam. They stop automatically when the component is destroyed, but explicit cleanup in destroy() is still good practice. No leaked intervals, no zombie callbacks.</p><h3>Mouse Gestures</h3><p>This one is pure fun. WakaPAC tracks right-button drags, converts them into directional sequences, and fires MSG_GESTURE when a registered pattern is recognized:</p><pre>// Register before initializing<br>wakaPAC.registerGesture(&#39;refresh&#39;, [&#39;U&#39;, &#39;D&#39;]); // Up then down<br>wakaPAC.registerGesture(&#39;undo&#39;,    [&#39;L&#39;, &#39;R&#39;]); // Left then right<br><br>// Handle in msgProc<br>msgProc(event) {<br>    if (event.message === wakaPAC.MSG_GESTURE) {<br>        switch (event.detail.pattern) {<br>            case &#39;left&#39;:    this.navigateBack();    return false;<br>            case &#39;right&#39;:   this.navigateForward(); return false;<br>            case &#39;refresh&#39;: this.reload();          return false;<br>        }<br>    }<br><br>    // Stationary right-click still fires MSG_RCLICK — gestures don&#39;t break context menus<br>    if (event.message === wakaPAC.MSG_RCLICK) {<br>        this.showContextMenu(wakaPAC.MAKEPOINTS(event.lParam));<br>        return false;<br>    }<br>}</pre><p>Built-in patterns cover the cardinal directions and common L-shapes. The recognition engine requires at least 30px of movement per segment and a 2-second window, so accidental gestures during normal use aren’t a problem.</p><h3>The Clipboard Pipeline</h3><p>MSG_COPY and MSG_PASTE fire before any DOM mutation — giving you a synchronous window to inspect, modify, or cancel clipboard operations:</p><pre>msgProc(event) {<br>    // Add attribution when text is copied<br>    if (event.message === wakaPAC.MSG_COPY) {<br>        event.detail.copyData = {<br>            &#39;text/plain&#39;: event.detail.selectedText + &#39;\n\nSource: &#39; + window.location.href,<br>        };<br>        return false;<br>    }<br><br>    // Block paste if content exceeds field limit<br>    if (event.message === wakaPAC.MSG_PASTE) {<br>        if (event.detail.text.length &gt; this.maxLength) {<br>            this.showError(&#39;Pasted content is too long&#39;);<br>            return false;<br>        }<br>    }<br>}</pre><p>MSG_PASTE also gives you full metadata for files on the clipboard — name, size, MIME type — before you commit to processing them.</p><h3>Message Hooks: Cross-Cutting Concerns</h3><p>Finally, for things that need to see everything — logging, telemetry, modal blocking — WakaPAC has message hooks:</p><pre>// Log all messages during development<br>const hhook = wakaPAC.installMessageHook((event, callNextHook) =&gt; {<br>    console.log(`[${event.pacId}] 0x${event.message.toString(16).toUpperCase()}`);<br>    callNextHook(); // Must call through, or message is swallowed<br>});<br><br>// Suppress mouse movement while a modal is open<br>function openModal() {<br>    modalHook = wakaPAC.installMessageHook((event, callNextHook) =&gt; {<br>        if (event.message === wakaPAC.MSG_MOUSEMOVE) return; // swallow<br>        callNextHook();<br>    });<br>}</pre><p>Hooks form a chain and run before any component’s msgProc. Each hook must explicitly call callNextHook to pass the message forward — omitting it silently blocks delivery. It&#39;s the same deliberate design as Win32&#39;s hook chain: powerful when you need it, impossible to trigger accidentally.</p><h3>Why Win32?</h3><p>There’s a reason Win32’s programming model survived 30+ years of desktop development. The window procedure pattern is not a historical accident — it’s a solution to a real architectural problem: <strong>how do you give a single component coherent, stateful control over a stream of events?</strong></p><p>Modern browser event systems scattered that control across dozens of individual listeners, closures, and cleanup callbacks. msgProc reassembles it. One function, all events, clear state ownership, explicit control flow.</p><p>The browser’s event model is powerful but chaotic. msgProc doesn&#39;t replace it — it provides a disciplined layer on top, the same way Win32&#39;s window procedure sat on top of the message loop without replacing it.</p><p>If you’re building anything beyond simple reactive forms — a rich text editor, a canvas-based tool, a drag-heavy UI, an application with complex keyboard handling — this is the part of WakaPAC worth taking seriously.</p><p><strong>WakaPAC is open source and available at wakapac.com.</strong></p><p><em>Floris van den Berg is a PHP consultant and the author of WakaPAC, Canvas, and ObjectQuel — a full-stack toolset for modernizing legacy web applications.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7af062a79f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WakaPAC: The Reactive JavaScript Library That Learns from the Past to Build the Future]]></title>
            <link>https://medium.com/@noescom1977/wakapac-the-reactive-javascript-library-that-learns-from-the-past-to-build-the-future-822151a375cf?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/822151a375cf</guid>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Mon, 04 Aug 2025 20:24:07 GMT</pubDate>
            <atom:updated>2025-08-04T21:02:59.714Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How combining the best ideas from Vue, React, and Knockout.js creates a modern development experience</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LN8-LZeFXwlbRzct" /></figure><p>Some of the best ideas in JavaScript come from libraries that solved real problems elegantly. Knockout.js gave us automatic reactivity that just worked. Vue showed us clean, intuitive templates. React taught us how to build scalable component hierarchies.</p><p>What if you could have all three approaches working together?</p><p><strong>WakaPAC</strong> is my love letter to these incredible libraries — especially Knockout.js — taking their best ideas and combining them with the PAC (Presentation-Abstraction-Control) architectural pattern to create something that feels both familiar and fresh.</p><h3>Learning from the Masters</h3><p><strong>WakaPAC</strong> stands on the shoulders of giants, taking the best ideas from three revolutionary libraries:</p><h3>Knockout.js: The Magic of Automatic Reactivity</h3><p>Knockout.js gets something fundamentally right that we’ve been trying to recreate ever since: <strong>automatic DOM updates</strong>. When you change an observable, the UI just updates. No setState(), no $forceUpdate(), no complex state management. The reactivity is magical.</p><pre>// The Knockout way - powerful but verbose<br>this.name(&#39;John&#39;); // Had to call observables as functions<br>this.items.push(newItem); // Arrays were special observableArrays</pre><p>But Knockout has a developer experience challenge: everything has to be wrapped in observables. WakaPAC keeps the automatic reactivity while letting you write natural JavaScript:</p><pre>// The WakaPAC way - natural and reactive<br>this.name = &#39;John&#39;; // Just assign like normal JavaScript<br>this.items.push(newItem); // Arrays just work</pre><h3>Vue: Clean, Intuitive Templates</h3><p>Vue showed us that templates don’t have to be verbose or magical. They can be clean, readable, and powerful:</p><pre>&lt;!-- Vue-inspired syntax that just makes sense --&gt;<br>&lt;p&gt;Hello {{fullName}}!&lt;/p&gt;<br>&lt;div data-pac-bind=&quot;visible:showDetails&quot;&gt;Details&lt;/div&gt;<br>&lt;button data-pac-bind=&quot;click:handleClick&quot;&gt;Click me&lt;/button&gt;</pre><h3>React: Component Hierarchy That Scales</h3><p>React taught us that applications are trees of components that need to communicate effectively. Parent-child relationships, unidirectional data flow, and clear component boundaries make complex applications manageable.</p><h3>The PAC Architecture Advantage</h3><p>WakaPAC isn’t just a mashup though — it introduces something unique: the <strong>PAC (Presentation-Abstraction-Control)</strong> architecture pattern.</p><p>Unlike MVC where models and views can talk directly (creating spaghetti code in complex apps), PAC uses a smart Control layer that:</p><ul><li><strong>Automatically syncs</strong> data changes to the DOM</li><li><strong>Handles events</strong> from the presentation layer</li><li><strong>Manages reactivity</strong> and computed properties</li><li><strong>Coordinates communication</strong> between components</li></ul><p>This creates more predictable data flow and easier debugging than traditional patterns.</p><pre>wakaPAC(&#39;#my-app&#39;, {<br>    // Abstraction: Your data and business logic<br>    firstName: &#39;John&#39;,<br>    lastName: &#39;Doe&#39;,<br>    count: 0,<br><br>    // Computed properties with automatic dependency tracking<br>    computed: {<br>        fullName() {<br>            return this.firstName + &#39; &#39; + this.lastName;<br>        }<br>    },<br><br>    // Methods that just work<br>    increment() {<br>        this.count++; // DOM updates automatically<br>    }<br>});</pre><h3>The Canvas Connection: Full-Stack Code Generation</h3><p>Here’s where things get really interesting. WakaPAC isn’t just another JavaScript library — it’s designed to work seamlessly with <strong>Canvas</strong>, my PHP framework, and <strong>ObjectQuel</strong>, my ORM. With the <strong>WakaPAC Abstraction Generator</strong>, the integration is very powerful.</p><h3>From Backend Entity to Frontend Component in Seconds</h3><p>Imagine this workflow:</p><ol><li><strong>Define your data model</strong> in ObjectQuel</li><li><strong>Generate WakaPAC abstractions</strong> with one command</li><li><strong>Build reactive frontends</strong> that stay perfectly in sync with your backend</li></ol><p>Here’s how it works in practice:</p><pre>// 1. Define your ObjectQuel entity<br>/**<br> * @Orm\Table(name=&quot;users&quot;)<br> */<br>class UserEntity {<br>    /**<br>     * @Orm\Column(name=&quot;id&quot;, type=&quot;integer&quot;, primary_key=true)<br>     * @Orm\PrimaryKeyStrategy(strategy=&quot;identity&quot;)<br>     */<br>    protected ?int $id = null;<br>    <br>    /**<br>     * @Orm\Column(name=&quot;first_name&quot;, type=&quot;string&quot;, limit=100)<br>     */<br>    protected string $firstName;<br>    <br>    /**<br>     * @Orm\Column(name=&quot;last_name&quot;, type=&quot;string&quot;, limit=100)<br>     */<br>    protected string $lastName;<br>    <br>    /**<br>     * @Orm\Column(name=&quot;email&quot;, type=&quot;string&quot;, limit=255)<br>     */<br>    protected string $email;<br>    <br>    /**<br>     * @Orm\Column(name=&quot;is_active&quot;, type=&quot;boolean&quot;)<br>     */<br>    protected bool $isActive;<br>    <br>    // Standard getters and setters...<br>}<br><br># 2. Generate the WakaPAC abstraction<br>php ./vendor/bin/sculpt make:pac-entity User<br><br>// 3. Auto-generated WakaPAC abstraction<br>const UserAbstraction = {<br>    // Properties with proper defaults<br>    firstName: &#39;&#39;,<br>    lastName: &#39;&#39;,<br>    email: &#39;&#39;,<br>    isActive: false,<br>    <br>    computed: {<br>        fullName() {<br>            return `${this.firstName} ${this.lastName}`.trim();<br>        }<br>    },<br>    <br>    // Complete CRUD operations generated automatically<br>    load(id) { /* GET /api/users/:id */ },<br>    save() { /* POST/PUT with change tracking */ },<br>    delete() { /* DELETE with cleanup */ },<br>    <br>    // Built-in utilities<br>    hasChanges() { /* Compare with original data */ },<br>    toFormData() { /* Type-safe conversion */ },<br>    reset() { /* Back to defaults */ }<br>};<br><br>// 4. Use it in your WakaPAC component<br>wakaPAC(&#39;#user-profile&#39;, UserAbstraction);</pre><h3>The Power of Full-Stack Code Generation</h3><p>This isn’t just convenience — it’s a fundamental shift in how full-stack development works:</p><ul><li><strong>Zero Boilerplate</strong>: Every CRUD operation, validation, and data transformation is auto-generated</li><li><strong>Type Safety</strong>: The generator understands your ObjectQuel column types and creates appropriate JavaScript handling</li><li><strong>Change Tracking</strong>: Built-in dirty checking so you know when data has changed</li><li><strong>Error Handling</strong>: Consistent error patterns across all generated abstractions</li><li><strong>Maintainability</strong>: When your entity changes, regenerate the abstraction and everything stays in sync</li></ul><p>This kind of full-stack code generation is what happens when you control both ends of the stack and design them to work together from day one.</p><h3>Performance That Matters</h3><p>Modern frameworks love to talk about performance, but WakaPAC delivers it differently:</p><ul><li><strong>No virtual DOM overhead</strong> — Direct DOM manipulation with intelligent batching</li><li><strong>Proxy-based reactivity</strong> for modern browsers, graceful fallback for older ones</li><li><strong>Automatic dependency tracking</strong> for computed properties</li><li><strong>Event delegation</strong> to minimize memory usage</li><li><strong>Batched updates</strong> using requestAnimationFrame</li></ul><p>The result? Applications that feel snappy because they <strong>are</strong> snappy.</p><h3>When to Choose WakaPAC</h3><p><strong>Choose WakaPAC when you want:</strong></p><p>✅ Zero build complexity — start building immediately<br>✅ Modern reactivity without mental overhead<br>✅ Performance by default<br>✅ Progressive enhancement of existing projects<br>✅ Component hierarchy without the complexity<br>✅ True simplicity that scales</p><p><strong>Consider other tools for:</strong></p><p>❌ Server-side rendering requirements<br>❌ Mobile app development<br>❌ Massive teams requiring extensive TypeScript tooling</p><h3>The Philosophy: Legacy-First Innovation</h3><p>Both Canvas and WakaPAC share a philosophy I call “legacy-first innovation.” Instead of forcing you to rewrite everything to adopt new patterns, they let you:</p><ol><li><strong>Start where you are</strong> — Drop into existing projects</li><li><strong>Migrate gradually</strong> — Wrap old code, add new features with modern patterns</li><li><strong>Keep what works</strong> — Don’t throw away battle-tested code</li><li><strong>Evolve naturally</strong> — Let your architecture improve over time</li></ol><p>This isn’t about being stuck in the past — it’s about having a practical path to the future.</p><h3>Try It Today</h3><p>WakaPAC is available now on GitHub, and getting started literally takes one line:</p><pre>&lt;script src=&quot;wakapac.js&quot;&gt;&lt;/script&gt;</pre><p><strong>Get started:</strong> <a href="https://github.com/quellabs/wakapac">https://github.com/quellabs/wakapac</a></p><h3>The Future of Simple</h3><p>I believe the future of web development isn’t about more complexity — it’s about more <strong>effective</strong> complexity. Tools that are powerful enough to build anything but simple enough that you can focus on what matters: your application, not your toolchain.</p><p>WakaPAC represents that future. It’s what happens when you take the best ideas from the past decade of frontend innovation and ask: “How can we make this simpler without making it less powerful?”</p><p>Building WakaPAC taught me that the answer isn’t about choosing between simplicity and power — it’s about designing them to work together from the ground up.</p><p><em>WakaPAC is open source and available under the MIT license. Try it today and rediscover the joy of simple, powerful web development.</em></p><p><em>If you’re interested in full-stack development that prioritizes simplicity and power, check out Canvas (PHP framework) and ObjectQuel (ORM) — the backend companions to WakaPAC that complete the development stack.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=822151a375cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Framework That Meets You Where You Are]]></title>
            <link>https://medium.com/@noescom1977/the-framework-that-meets-you-where-you-are-df8ec4ac287c?source=rss-7975f81f3585------2</link>
            <guid isPermaLink="false">https://medium.com/p/df8ec4ac287c</guid>
            <category><![CDATA[modernize-legacy-system]]></category>
            <category><![CDATA[php-development]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[framework]]></category>
            <dc:creator><![CDATA[Floris van den Berg]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 08:09:06 GMT</pubDate>
            <atom:updated>2025-07-22T08:27:02.336Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How Canvas PHP Framework Solves the Legacy Code Problem Everyone Pretends Doesn’t Exist</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQdCojdi0OjAA7Tc-2VJpA.png" /></figure><p>It’s Monday morning. Your boss walks over with that look — the one that means your perfectly planned sprint is about to get torpedo’d.</p><p>“The client wants to add real-time notifications to the user dashboard,” he says. “How long do you think that’ll take?”</p><p>You glance at your screen showing the users.php file you&#39;ve been debugging—a 400-line monster of procedural PHP that somehow runs the user management for a system processing millions in revenue. It&#39;s not pretty, but it works. It&#39;s been working for three years.</p><p>“Well,” you start, knowing where this is headed, “if we want to do it right, we should probably refactor the user system first. Maybe migrate to a proper framework. I’d estimate about six weeks to — “</p><p>“Six weeks?” The look intensifies. “Can’t you just… add it to what we have?”</p><p>And there it is. The eternal developer dilemma: build it right, or build it now.</p><h3>The Rewrite Trap</h3><p>Here’s the dirty secret of our industry: most of us aren’t building shiny new applications from scratch. We’re maintaining, extending, and somehow improving codebases that would make our computer science professors weep.</p><p>Yet every framework tutorial starts the same way: “Create a new project…”</p><p>As if we all have the luxury of clean slates.</p><p>The reality? You’ve got a PHP application that’s been running in production for years. It has quirks, technical debt, and architectural decisions that made sense in 2019 but feel questionable now. But it also has something invaluable: <strong>it works</strong>.</p><p>Rewriting is almost never the answer. It’s expensive, risky, and takes forever. But living with legacy code forever isn’t sustainable either.</p><p>What if there was a third option?</p><h3>Meeting You Where You Are</h3><p>That’s why I created Canvas, a PHP framework that does something I’ve never seen before: it actually acknowledges that most real development happens in existing codebases.</p><p>Here’s the key insight that drove Canvas’s design. You can add Canvas to any existing PHP application with just a few lines of code:</p><pre>&lt;?php<br>// public/index.php - your existing bootstrap file<br>use Quellabs\Canvas\Kernel;<br>use Symfony\Component\HttpFoundation\Request;<br><br>require_once __DIR__ . &#39;/../vendor/autoload.php&#39;;<br><br>$kernel = new Kernel([<br>    &#39;legacy_enabled&#39; =&gt; true,          <br>    &#39;legacy_path&#39; =&gt; __DIR__ . &#39;/../&#39;  <br>]);<br><br>$request = Request::createFromGlobals();<br>$response = $kernel-&gt;handle($request);<br>$response-&gt;send();</pre><p>That’s it. Your existing application now has Canvas superpowers, but everything continues to work exactly as before.</p><h3>The Magic of Intelligent Fallthrough</h3><p>Canvas uses what they call “intelligent fallthrough.” When a request comes in:</p><ol><li>Canvas first checks if you’ve defined a modern route for it</li><li>If not, it automatically looks for your existing PHP files</li><li>Your legacy code runs normally, but now has access to Canvas services</li></ol><p>So /users/profile might hit your old users/profile.php file, but that file can now use Canvas&#39;s ORM, caching, validation, and security features.</p><p>Let me show you what this looks like in practice.</p><h3>Zero-Disruption Enhancement</h3><p>Here’s that nightmare users.php file that&#39;s been running in production for years:</p><pre>&lt;?php<br>// Your existing file - works perfectly, stays exactly the same<br>$conn = new PDO(&quot;mysql:host=localhost;dbname=app&quot;, $user, $pass);<br><br>$sql = &quot;SELECT * FROM users WHERE active = 1 AND created_at &gt; ? ORDER BY created_at DESC LIMIT 10&quot;;<br>$stmt = $conn-&gt;prepare($sql);<br>$stmt-&gt;execute([date(&#39;Y-m-d&#39;, strtotime(&#39;-30 days&#39;))]);<br>$users = $stmt-&gt;fetchAll();<br><br>echo &quot;&lt;h1&gt;Recent Users&lt;/h1&gt;&quot;;<br><br>foreach ($users as $user) {<br>    echo &quot;&lt;div&gt;&quot;;<br>    echo &quot;&lt;h3&gt;&quot; . htmlspecialchars($user[&#39;name&#39;]) . &quot;&lt;/h3&gt;&quot;;<br>    echo &quot;&lt;p&gt;Joined: &quot; . $user[&#39;created_at&#39;] . &quot;&lt;/p&gt;&quot;;<br>    echo &quot;&lt;/div&gt;&quot;;<br>}</pre><p>After adding Canvas? <strong>This file can stay exactly as it is.</strong> It continues to work unchanged. But now you have the <em>option</em> to gradually modernize.</p><p>Maybe you start by just replacing the database code:</p><pre>&lt;?php<br>// Still the same file, but now with modern database access<br>$em = canvas(&#39;EntityManager&#39;);<br><br>$recentUsers = $em-&gt;executeQuery(&quot;<br>    range of u is App\\Entity\\User<br>    retrieve (u)<br>    where u.active = true and u.createdAt &gt; :since<br>    sort by u.createdAt desc<br>    window 0 using window_size 10<br>&quot;, [<br>    &#39;since&#39; =&gt; date(&#39;Y-m-d&#39;, strtotime(&#39;-30 days&#39;))<br>]);<br><br>// Everything else stays the same<br>echo &quot;&lt;h1&gt;Recent Users&lt;/h1&gt;&quot;;<br><br>foreach ($recentUsers as $user) {<br>    echo &quot;&lt;div&gt;&quot;;<br>    echo &quot;&lt;h3&gt;&quot; . htmlspecialchars($user-&gt;name) . &quot;&lt;/h3&gt;&quot;;<br>    echo &quot;&lt;p&gt;Joined: &quot; . $user-&gt;createdAt-&gt;format(&#39;Y-m-d&#39;) . &quot;&lt;/p&gt;&quot;;<br>    echo &quot;&lt;/div&gt;&quot;;<br>}</pre><p>The beauty? You can make this change on Tuesday, deploy it Wednesday, and if anything breaks, you just revert that one line. No massive rollbacks. No “the entire site is down” moments.</p><p>When you’re ready — maybe next month, maybe next quarter — you can modernize more. Or not. The file works either way.</p><h3>The Progressive Enhancement Strategy</h3><p>What makes Canvas brilliant is that it enables progressive enhancement of your codebase:</p><p><strong>Week 1</strong>: Add Canvas, start using the ORM in legacy files<br><strong>Week 2</strong>: Convert one legacy file to a proper Canvas controller<br><strong>Week 3</strong>: Add validation and security aspects<br><strong>Week 4</strong>: Implement caching and performance monitoring<br><strong>Week 5</strong>: Add that real-time notification feature your boss wanted</p><p>Each step adds value immediately. No big-bang rewrites. No “it’ll be ready in six weeks.” Just continuous improvement.</p><h3>Beyond Legacy: Modern Features That Don’t Suck</h3><p>Once you’re hooked on the legacy integration, Canvas has some genuinely impressive modern features:</p><p><strong>Annotation-based routing</strong> that keeps your routes next to your code:</p><pre>/**<br> * @Route(&quot;/posts/{id:int}&quot;)<br> * @InterceptWith(CacheAspect::class, ttl=3600)<br> */<br>public function show(int $id) {<br>    return $this-&gt;render(&#39;post.tpl&#39;, $this-&gt;em-&gt;find(Post::class, $id));<br>}</pre><p><strong>Aspect-oriented programming</strong> for clean separation of concerns:</p><pre>/**<br> * @InterceptWith(RequireAuthAspect::class)<br> * @InterceptWith(ValidateAspect::class, validator=PostValidation::class)<br> * @InterceptWith(CacheAspect::class, ttl=600)<br> */<br>public function createPost(Request $request) {<br>    // Your business logic here - aspects handle auth, validation, caching<br>}</pre><p><strong>A visual debugging interface</strong> that actually helps you understand what’s happening in your application — database queries, performance metrics, request data, all in a clean interface at the bottom of your pages during development.</p><h3>The “No Magic” Philosophy</h3><p>Here’s what I built into Canvas from day one: an explicit rejection of “magic.” Everything is traceable, explicit, and debuggable. There are no hidden conventions that bite you six months later. No black-box dependency resolution that leaves you wondering where objects come from. When something breaks, you can actually figure out why.</p><h3>The Real Business Case</h3><p>Let’s talk ROI. Traditional framework adoption looks like this:</p><ul><li><strong>Months 1–3</strong>: Planning and architecture</li><li><strong>Months 4–8</strong>: Rewriting existing functionality</li><li><strong>Months 9–12</strong>: Bug fixes and getting back to feature parity</li><li><strong>Month 13</strong>: Finally start adding new features</li></ul><p>Canvas adoption looks like this:</p><ul><li><strong>Day 1</strong>: Add Canvas to existing codebase</li><li><strong>Week 1</strong>: Start improving existing code with modern tools</li><li><strong>Month 1</strong>: Converting critical paths to Canvas controllers</li><li><strong>Month 2</strong>: Adding new features with full framework capabilities</li></ul><p>The difference is delivering value immediately instead of disappearing into a rewrite bunker for a year.</p><h3>The Framework That Gets It</h3><p>I’ve worked with a lot of frameworks over the years. Laravel, Symfony, Spring Boot — they’re all great for greenfield projects. But none of them acknowledged or solved the reality most of us actually live in. That’s why I created Canvas.</p><p>We’re not all building the next Instagram. Most of us are maintaining boring but critical business applications that can’t afford six-month rewrites but desperately need modernization.</p><p>Canvas meets you where you are. It doesn’t judge your legacy code or demand you throw it all away. It just makes it better, incrementally, sustainably.</p><p>And honestly? That might be the most important innovation in web frameworks in years.</p><p><em>Want to try Canvas in your own legacy codebase? Check out the </em><a href="https://github.com/quellabs/canvas"><em>getting started guide</em></a><em> and see how quickly you can start modernizing without rewriting.</em></p><p><strong>About the Author</strong>: I’ve been programming for 30+ years across multiple languages. Most recently at an e-commerce company, I faced the daily reality of modernizing legacy systems that couldn’t afford downtime. Canvas was born from those experiences — solving real problems that existing frameworks ignore.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df8ec4ac287c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>