<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ace-2504</title>
    <description>The latest articles on DEV Community by Ace-2504 (@ace2504).</description>
    <link>https://dev.to/ace2504</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3565080%2F7da89d83-ca34-469a-ae5b-435de1ae7d3f.png</url>
      <title>DEV Community: Ace-2504</title>
      <link>https://dev.to/ace2504</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ace2504"/>
    <language>en</language>
    <item>
      <title>Turning Behaviour into Climate Accountability</title>
      <dc:creator>Ace-2504</dc:creator>
      <pubDate>Tue, 24 Feb 2026 18:57:22 +0000</pubDate>
      <link>https://dev.to/ace2504/turning-behaviour-into-climate-accountability-3pph</link>
      <guid>https://dev.to/ace2504/turning-behaviour-into-climate-accountability-3pph</guid>
      <description>&lt;p&gt;One winter morning in Delhi, the AQI crossed 460 — officially hazardous. Schools shut. Hospitals filled. Transport slowed. Offices continued. Every day, millions of environmental decisions are made. Whether to drive or take public transport. Whether to allow remote work. Whether to burn waste or compost. These choices influence emissions — yet we rarely measure the pollution that did not happen because of them.&lt;/p&gt;

&lt;p&gt;That is the missing piece.&lt;/p&gt;

&lt;p&gt;Most environmental systems measure what exists: current emissions, fuel consumption, air quality levels. They do not formally measure avoided emissions. Counterfactual attribution addresses this gap by comparing two clearly defined scenarios:&lt;/p&gt;

&lt;p&gt;Business-as-usual baseline — what would have happened&lt;br&gt;
Verified alternative — what actually occurred&lt;/p&gt;

&lt;p&gt;Impact = Baseline − Verified Alternative.&lt;/p&gt;

&lt;p&gt;A Practical Example: Urban Commuting&lt;br&gt;
Consider a professional living 14 km from work. A 28 km daily round trip in a petrol car (≈ 120 g CO₂/km) results in about 3.36 kg CO₂ per day. Across 240 working days, that equals approximately 806 kg CO₂ annually. That is the baseline.&lt;/p&gt;

&lt;p&gt;Now introduce two behavioural shifts:&lt;/p&gt;

&lt;p&gt;Work from home two days per week → avoids ~322 kg per year&lt;br&gt;
Shift to electric metro on remaining days (≈ 15 g CO₂/km) → saves ~423 kg&lt;/p&gt;

&lt;p&gt;Total avoided emissions ≈ 745 kg CO₂ Remaining footprint ≈ 61 kg&lt;/p&gt;

&lt;p&gt;That is a reduction of over 90%, derived from a measurable behavioural delta — not offsets, not assumptions.&lt;/p&gt;

&lt;p&gt;If the remaining 61 kg is neutralised through verified sequestration (e.g., monitored urban trees at ~10 kg per tree annually), the commuting footprint approaches net zero.&lt;/p&gt;

&lt;p&gt;Baseline → Reduction → Net Impact. Each step is quantifiable.&lt;/p&gt;

&lt;p&gt;Preventing Double Counting&lt;br&gt;
A critical issue emerges: duplication.&lt;/p&gt;

&lt;p&gt;If an employee reports work-from-home reductions, and their employer's HR department also reports the same reduction in ESG disclosures, total claimed impact exceeds actual impact.&lt;/p&gt;

&lt;p&gt;To prevent this, the framework introduces a non-duplication constraint.&lt;/p&gt;

&lt;p&gt;Let:&lt;/p&gt;

&lt;p&gt;Δ_total = Verified avoided emissions&lt;br&gt;
C_i = Claim attributed to entity i&lt;/p&gt;

&lt;p&gt;The system enforces:&lt;/p&gt;

&lt;p&gt;Σ Cᵢ ≤ Δ_total&lt;/p&gt;

&lt;p&gt;No combination of claims may exceed the verified delta.&lt;/p&gt;

&lt;p&gt;Each reduction event is assigned:&lt;/p&gt;

&lt;p&gt;A unique registry ID&lt;br&gt;
A defined ownership tag&lt;br&gt;
A claim status flag&lt;/p&gt;

&lt;p&gt;Work-from-home emissions may be attributed to the enabling institution, while individual dashboards reflect behavioural contribution — without generating duplicate claimable credits unless formally allocated.&lt;/p&gt;

&lt;p&gt;This ensures:&lt;/p&gt;

&lt;p&gt;Measurability&lt;br&gt;
Additionality&lt;br&gt;
Non-duplication&lt;br&gt;
Audit defensibility&lt;/p&gt;

&lt;p&gt;Without duplication control, avoided-emission accounting collapses under verification.&lt;/p&gt;

&lt;p&gt;Enterprise Implications&lt;br&gt;
Most sustainability reports rely on estimated participation and averaged emission factors. A verification-first counterfactual architecture instead:&lt;/p&gt;

&lt;p&gt;Establishes defined baselines&lt;br&gt;
Verifies behavioural change in a privacy-preserving manner&lt;br&gt;
Models avoided emissions at corridor level&lt;br&gt;
Applies attribution constraints&lt;br&gt;
Produces audit-ready metrics&lt;/p&gt;

&lt;p&gt;Under such a system, work-from-home is not merely HR flexibility. It becomes measurable climate infrastructure.&lt;/p&gt;

&lt;p&gt;The Broader Shift&lt;br&gt;
This logic applies anywhere a conservative baseline can be defined:&lt;/p&gt;

&lt;p&gt;Agricultural burn avoidance&lt;br&gt;
Household waste diversion&lt;br&gt;
Fuel switching in buildings&lt;br&gt;
Distributed renewable adoption&lt;br&gt;
Industrial efficiency upgrades&lt;/p&gt;

&lt;p&gt;For decades, climate systems focused on measuring what we emit.&lt;/p&gt;

&lt;p&gt;The next frontier is measuring what we prevent — without inflation, without duplication, and without ambiguity.&lt;/p&gt;

&lt;p&gt;Climate accountability will not be built on slogans.&lt;/p&gt;

&lt;p&gt;It will be built on baselines, constraints, and verifiable delta.&lt;/p&gt;

&lt;p&gt;Patent Filed, 2026. A technical paper detailing the verification-first MRV architecture, statistical bias bounds, and attribution constraints is under preparation.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>data</category>
      <category>datascience</category>
      <category>science</category>
    </item>
    <item>
      <title>How McKinsey Frameworks Fixed My Scattered API</title>
      <dc:creator>Ace-2504</dc:creator>
      <pubDate>Sun, 04 Jan 2026 15:51:33 +0000</pubDate>
      <link>https://dev.to/ace2504/how-structured-thinking-fixed-my-api-design-a-case-study-i1n</link>
      <guid>https://dev.to/ace2504/how-structured-thinking-fixed-my-api-design-a-case-study-i1n</guid>
      <description>&lt;p&gt;While building the backend for &lt;strong&gt;Ace Rentals&lt;/strong&gt;, I realized that my authorization logic, although functionally correct, felt increasingly fragile. Ownership checks were scattered across multiple routes, duplicated in several places, and easy to forget when adding new endpoints. Over time, this made the system harder to reason about and increased the risk of subtle security gaps.&lt;/p&gt;

&lt;p&gt;Rather than continuing with incremental fixes, I stepped back and redesigned authorization as a system-level concern using centralized middleware. This article explains how I identified the issue, how I reasoned about the redesign, how it was implemented, and what improved as a result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Previous Authorization Approach
&lt;/h2&gt;

&lt;p&gt;Authorization checks were implemented directly inside individual route handlers. Each protected endpoint contained its own logic to verify whether the current user was allowed to perform the requested action.&lt;/p&gt;

&lt;p&gt;While this approach worked initially, it introduced several challenges as the application grew:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The same ownership logic was copied across multiple routes
&lt;/li&gt;
&lt;li&gt;Route handlers mixed business logic with authorization concerns
&lt;/li&gt;
&lt;li&gt;Adding new endpoints required manual checks, increasing the chance of mistakes
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system did not fail outright, but correctness increasingly depended on careful and repetitive implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Identifying the Design Issue
&lt;/h2&gt;

&lt;p&gt;The problem was not a missing check or a faulty condition—it was a structural issue. Authorization was treated as an implementation detail instead of a rule enforced consistently by the architecture.&lt;/p&gt;

&lt;p&gt;This meant security relied on developer memory rather than system guarantees. As the number of routes increased, so did the effort required to maintain consistency and confidence in the design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design Analysis and Decision-Making
&lt;/h2&gt;

&lt;p&gt;To avoid patching individual routes, I analyzed the problem at a design level.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I used &lt;strong&gt;MECE-style analysis&lt;/strong&gt; to verify whether authorization was applied consistently across all relevant routes. This exposed gaps and overlap in enforcement.
&lt;/li&gt;
&lt;li&gt;I compared alternative approaches and found that &lt;strong&gt;centralized middleware&lt;/strong&gt; offered the best balance between reuse, clarity, and maintainability.
&lt;/li&gt;
&lt;li&gt;I set clear constraints for the refactor—no change in behavior, minimal surface area, and focused scope—to avoid unnecessary complexity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structured approach helped ensure the redesign addressed the root cause rather than its symptoms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authorization Redesign and Implementation
&lt;/h2&gt;

&lt;p&gt;Authorization was elevated to a system-level concern and implemented through middleware:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ownership checks were consolidated into a single, reusable middleware function
&lt;/li&gt;
&lt;li&gt;API endpoints were reorganized around resources rather than actions, improving clarity
&lt;/li&gt;
&lt;li&gt;Authorization was enforced early in the request pipeline, before any business logic executed
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this setup, routes automatically inherit authorization rules. Developers no longer need to remember to reapply checks when adding or modifying endpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observed Impact of the Redesign
&lt;/h2&gt;

&lt;p&gt;The redesign produced clear and measurable improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authorization logic now exists in one place instead of being duplicated
&lt;/li&gt;
&lt;li&gt;All protected routes enforce authorization consistently by default
&lt;/li&gt;
&lt;li&gt;Maintenance effort and regression risk were significantly reduced
&lt;/li&gt;
&lt;li&gt;Resource relationships are clearer through resource-based routing
&lt;/li&gt;
&lt;li&gt;Route handlers are simpler and focus only on business logic
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A qualitative review showed that core domain logic is stable. Remaining risk is isolated to shared authorization middleware, where it is explicit, visible, and easier to reason about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Learning
&lt;/h2&gt;

&lt;p&gt;Repeated logic is often a signal of a deeper design issue. Treating security as a structural concern—rather than a manual step—leads to systems that are easier to maintain, extend, and trust over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design Decisions and Learnings
&lt;/h2&gt;

&lt;p&gt;This article provides a high-level summary of the decisions and outcomes from redesigning authorization in Ace Rentals.&lt;/p&gt;

&lt;p&gt;For a deeper look into my &lt;strong&gt;learning experience&lt;/strong&gt;—including diagrams, structured reasoning, trade-offs, and implementation details—you can read the full write-up here:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://ace-2504.github.io/api-design-blog/" rel="noopener noreferrer"&gt;https://ace-2504.github.io/api-design-blog/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The full version documents the complete thought process and lessons learned while designing and refactoring the system.&lt;/p&gt;

</description>
      <category>api</category>
      <category>backend</category>
      <category>systemdesign</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
