<?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 De Nada on Medium]]></title>
        <description><![CDATA[Stories by De Nada on Medium]]></description>
        <link>https://medium.com/@bits_and_giggles?source=rss-54118d14c831------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Wc_aFKix4H3TJI1y4LmZEA@2x.jpeg</url>
            <title>Stories by De Nada on Medium</title>
            <link>https://medium.com/@bits_and_giggles?source=rss-54118d14c831------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 12:09:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bits_and_giggles/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[Seven Books That’ll Make Code Review Less Insufferable]]></title>
            <link>https://medium.com/womenintechnology/seven-books-thatll-make-code-review-less-insufferable-d5d4ad4f80c7?source=rss-54118d14c831------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d4ad4f80c7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[De Nada]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 11:48:05 GMT</pubDate>
            <atom:updated>2026-07-21T11:48:05.636Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*dE4XQOGxHMz2WC_bA6F8tw@2x.jpeg" /><figcaption>make code reviews fun again.</figcaption></figure><h3>Check these out if you want to be promoted from “It Compiles, Ship It” Into A Trusted Software Engineer</h3><p>Picture a pretty average Tuesday. You just pushed a PR. It compiles. It passes the (three) unit tests you wrote. You feel good about yourself. Then a senior engineer leaves a comment: “this will break under contention, also what’s your <em>std::vector</em> doing in that hot loop?” Naturally you realize that those were indeed great catches then quietly spend the next hour googling things you probably should already know.</p><p>If that gave you a little flashback, that was a good company!</p><p>This is the reading list that actually gets you out of that loop. Not by making you memorize more syntax, but by changing how you think about code in the first place. Each book below kind of solves a piece of that Tuesday.</p><p>Stacked together they form something like a path from “it compiles” to “it’s correct, it’s fast, and someone else can maintain it if I left the company.”</p><h3>1. Effective Modern C++ by Scott Meyers</h3><p>This is where most of the pain starts, so it’s a good place to begin. Remember writing <em>std::move(x)</em> and then casually using x again three lines later, and it technically still compiled but something felt a bit wrong?</p><p>Meyers explains exactly why that’s a problem. Honestly the chapter on universal references alone will make you stop writing <em>template&lt;typename T&gt; void f(T&amp;&amp; t)</em> like it’s some kind of magic spell, and actually understand what’s going on. This book is what turns “modern C++” from a line on your resume into something you can defend out loud in a code review.</p><h3>2. C++ Concurrency in Action by Anthony Williams</h3><p>Once move semantics stop scaring you, concurrency is usually the next thing that bites, which conveniently is also exactly what was wrong with that Tuesday PR.</p><p>The author walks you through building a thread safe queue with condition variables, and then humbles you a bit by showing how a lock free stack using <em>std::atomic</em> and compare and swap can quietly break in ways that only show up on ARM hardware at 3am in production.</p><p>This is the book that finally explains why “it works on my machine” was never actually an argument.</p><h3>3. C++ Software Design by Klaus Iglberger</h3><p>Now that your code is correct and thread safe, it’s time to look at the architecture, which if you’re anything like most of us is a tower of abstract base classes held together by hope and old habits.</p><p>The Book’s whole vibe is basically “please stop using inheritance for everything.” He takes a classic shape hierarchy with a virtual draw() method and rebuilds it using type erasure and <em>std::variant</em> based visitors, and the before and after is genuinely a little humbling.</p><p>There’s also a Strategy pattern done with <em>std::function</em> instead of an interface hierarchy that will make you rethink every class IShape { virtual void draw() = 0; } you’ve ever written.</p><h3>4. C++ High Performance by Björn Andrist and Viktor Sehr</h3><p>With a cleaner design in place, the question shifts from “is it correct” to “is it actually fast,” which is usually where vibes based debugging takes over (“I think it’s the loop, maybe?”).</p><p>This book trades vibes for evidence. There’s a section comparing array of structs versus struct of arrays for a particle simulation, and the performance difference is enough to make you stare at your screen and quietly question every <em>std::vector&lt;Particle&gt;</em> you’ve ever written. It also covers profiling properly, so “where’s the bottleneck” turns into something you measure instead of guess.</p><h3>5. Designing Data Intensive Applications by Martin Kleppmann</h3><p>Okay, your code is fast and well designed, great, now scale it across three data centers without it falling over.</p><p>This is the book for the moment someone asks “but how does this handle a regional outage?” and you realize “just add more servers” isn’t really an answer.</p><p>It breaks down replication, partitioning, and consistency models with real world examples, including why your database’s “strong consistency” guarantee quietly stops meaning what you think the moment a second region gets involved. The chapter on consensus algorithms is probably the first time “just use Raft” will actually mean something to you.</p><h3>6. Working Effectively with Legacy Code by Michael Feathers</h3><p>Here’s the twist. Most of your career probably won’t be building shiny new systems or Systems that use a spotlessly clean code base. You’ll be inheriting someone else’s code, written before most of these books saw daylight.</p><p>This book introduces the idea of a “seam,” basically a spot where you can change behavior without touching the code directly, and the “characterization test,” a test that documents what the code currently does, bugs and all, before you go near it.</p><p>This is the difference between “I refactored this” and “I refactored this and nothing works now”</p><h3>7. A Tour of C++ by Bjarne and Stroustrup</h3><p>And finally, after fixing memory issues, concurrency bugs, bad architecture, performance problems, distributed systems naivety, and someone else’s decade old mess, it’s worth circling back to the language itself. Chances are you skipped a few chapters somewhere along the way. Stroustrup’s tour covers the stuff everyone forgets exists, like ranges and coroutines. The coroutine example, a generator using co_yield, will either delight you or feel like a personal callout if you’ve ever complained that “C++ doesn’t need Python style generators.”</p><h3>Congratulations Your PR Can Now Be Merged</h3><p>That Tuesday PR comment, the one about contention and the vector in the hot loop, doesn’t have to ruin your week anymore. Work through these seven, roughly in this order, and the next time someone leaves that kind of comment, it’ll be YOU.</p><p>Which, honestly, is a real promotion in itself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d4ad4f80c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/womenintechnology/seven-books-thatll-make-code-review-less-insufferable-d5d4ad4f80c7">Seven Books That’ll Make Code Review Less Insufferable</a> was originally published in <a href="https://medium.com/womenintechnology">Women in Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Memory Ordering in C++: Memory Ordering Patterns]]></title>
            <link>https://medium.com/womenintechnology/demystifying-memory-ordering-in-c-memory-ordering-patterns-5ca1602d4006?source=rss-54118d14c831------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ca1602d4006</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cplusplus]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[De Nada]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 14:08:28 GMT</pubDate>
            <atom:updated>2026-07-26T21:19:46.643Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*c-ujFIYv3Z0fa1ldj6Agfg@2x.jpeg" /><figcaption>Your code doesn’t necessarily get executed in the order you wrote it.</figcaption></figure><h4>This article gives you three patterns that could handle 90% of the Memory ordering decisions you’ll face in production code. Master these, and you’ll stop guessing.</h4><p>In the previous article, we covered the foundations: why compilers and CPUs reorder your code, what data races actually are, and the six memory orderings C++ gives you to fight back.</p><p>The key insight: release says <em>&quot;I&#39;m done writing, publish everything before this point,&quot;</em> and acquire says <em>&quot;I&#39;m about to read, make sure I see everything published.&quot;</em> Together, they create a synchronizes-with relationship that makes concurrent code predictable.</p><p>Now let’s put that knowledge to work.</p><h3>The Only 3 Patterns You Need</h3><p>Stop memorizing rules. Learn these three patterns.</p><p>Most real-world concurrency code falls into these three patterns. Master them and you’ll handle 95% of memory ordering decisions correctly.</p><h4>Pattern 1: Producer-Consumer (release + acquire)</h4><p>This is the most common pattern. One thread produces data, another consumes it. The producer usesrelease to “<strong>publish</strong>” the data; the consumer uses acquire to “<strong>subscribe</strong>.”</p><pre>#include &lt;atomic&gt;<br>#include &lt;thread&gt;<br>#include &lt;cassert&gt;<br><br>std::atomic&lt;bool&gt; data_ready{false};<br>int payload = 0;<br><br>void producer() {<br>    payload = 42;                                    // Prepare data<br>    data_ready.store(true, std::memory_order_release); // Publish<br>}<br><br>void consumer() {<br>    while (!data_ready.load(std::memory_order_acquire)) {} // Wait<br>    assert(payload == 42);  // Guaranteed<br>}<br><br>int main() {<br>    std::thread t1(producer);<br>    std::thread t2(consumer);<br>    t1.join();<br>    t2.join();<br>}</pre><p><strong>Why it works:</strong><br>- release prevents thedata = 42write from moving <strong>after</strong> the store to ready<br>- acquire prevents the assert from moving <strong>before</strong> the load fromready<br>- Together, they create a <strong>synchronizes-with</strong> relationship</p><h4>Pattern 2: Reference Counting (Relaxed + Acq_Rel)</h4><p>Smart pointers likestd::shared_ptruse this pattern. Incrementing the count can be relaxed (no ordering needed), but decrementing requires acq_relto ensure all prior accesses complete before deletion.</p><pre>#include &lt;atomic&gt;<br>class RefCounted {<br>  std::atomic&lt;int&gt; ref_count{1};<br> <br>  public:<br>   void add_ref() {<br>     // relaxed: we don&#39;t care about ordering, just the count<br>     ref_count.fetch_add(1, std::memory_order_relaxed);<br>   }<br>   <br>   void release() {<br>     // acq_rel: acquire to see all writes before this,<br>     // release to publish our writes before delete<br>     if (ref_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {<br>       delete this;<br>     }<br>   }<br>};</pre><p><strong>Why </strong><strong>acq_rel on decrement:</strong><br>- <strong>Acquire</strong>: ensures we see all memory writes made by other threads before they released their references<br>- <strong>Release:</strong> ensures our writes are visible before we potentially delete the object</p><h4>Pattern 3: Spinlock (Acquire + Release)</h4><p>A simple lock implementation uses acquire when locking (to see protected data) and release when unlocking (to publish our modifications).</p><pre>#include &lt;atomic&gt;<br>class Spinlock {<br>   std::atomic&lt;bool&gt; locked{false};<br>   <br>  public:<br>   void lock() {<br>     while (locked.exchange(true, std::memory_order_acquire))<br>     ; // spin until we get the lock<br>   }<br>   <br>   void unlock() {<br>     locked.store(false, std::memory_order_release);<br>   }<br>};<br><br>// Usage<br>Spinlock mutex;<br>int shared_data = 0;<br>void critical_section() {<br> mutex.lock();<br> shared_data++; // protected by acquire/release<br> mutex.unlock();<br>}</pre><p><strong>The synchronization chain:</strong><br>1. Thread A calls unlock() with release → publishes all writes<br>2. Thread B calls lock() with acquire → sees all of Thread A’s writes<br>3. This mirrors how std::mutex works internally</p><h4>Real Code: Lock-Free Single-Producer Single-Consumer Queue</h4><p>Let’s apply these patterns to build something useful: a lock-free queue where one thread pushes and one thread pops.</p><pre>#include &lt;atomic&gt;<br>#include &lt;array&gt;<br>#include &lt;optional&gt;<br><br>template&lt;typename T, size_t Capacity&gt;<br>class SPSCQueue {<br> std::array&lt;T, Capacity&gt; buffer;<br> std::atomic&lt;size_t&gt; head{0}; // consumer reads from here<br> std::atomic&lt;size_t&gt; tail{0}; // producer writes here<br> <br>public:<br> bool push(const T&amp; value) {<br>   const size_t current_tail = tail.load(std::memory_order_relaxed);<br>   const size_t next_tail = (current_tail + 1) % Capacity;<br>   <br>   // Check if full<br>   if (next_tail == head.load(std::memory_order_acquire)) {<br>     return false; // queue full<br>   }<br>   <br>   buffer[current_tail] = value; // write the data<br>   tail.store(next_tail, std::memory_order_release); // publish<br>   return true;<br> }<br> <br> std::optional&lt;T&gt; pop() {<br>   const size_t current_head = head.load(std::memory_order_relaxed);<br>   <br>   // Check if empty<br>   if (current_head == tail.load(std::memory_order_acquire)) {<br>     return std::nullopt; // queue empty<br>   }<br>   <br>   T value = buffer[current_head]; // read the data<br>   head.store((current_head + 1) % Capacity, std::memory_order_release);<br>   return value;<br> }<br>};</pre><p><strong>Memory ordering breakdown:</strong></p><pre>| Operation          | Order   | Why                             |<br>| - - - - - - - - - -| - - - - | - - - - - - - - - - - - - - - - |<br>| tail.load in push  | relaxed | Only this thread modifies tail  |<br>| head.load in push  | acquire | Need to see consumer&#39;s progress |<br>| tail.store in push | release | Publish the written data        |<br>| head.load in pop   | relaxed | Only this thread modifies head  |<br>| tail.load in pop   | acquire | Need to see producer&#39;s data     |<br>| head.store in pop  | release | Allow producer to reuse slot    |</pre><h3>Performance: Does Memory Ordering Matter?</h3><p>Yes, especially on weakly-ordered architectures (ARM, POWER). Here’s a comparison:</p><pre>#include &lt;atomic&gt;<br>#include &lt;chrono&gt;<br>#include &lt;iostream&gt;<br>std::atomic&lt;int&gt; counter{0};<br>void benchmark_seq_cst(int iterations) {<br> for (int i = 0; i &lt; iterations; ++i) {<br>   counter.fetch_add(1, std::memory_order_seq_cst);<br> }<br>}<br>void benchmark_relaxed(int iterations) {<br> for (int i = 0; i &lt; iterations; ++i) {<br>   counter.fetch_add(1, std::memory_order_relaxed);<br> }<br>}<br>// Typical results on ARM (nanoseconds per operation):<br>// seq_cst: ~40–80 ns<br>// relaxed: ~5–15 ns<br>//<br>// On x86 the difference is smaller (~20% vs 5–10x on ARM)</pre><p><strong>When the difference matters:</strong><br>- Hot loops with millions of atomic operations<br>- Embedded systems with strict latency requirements<br>- High-frequency trading, game engines, database internals</p><h4>When to Just Use seq_cst</h4><p>Despite everything above, memory_order_seq_cst is the right choice when:</p><p>1. You’re not sure, correctness beats performance<br>2. Code is not performance-critical, most code isn’t<br>3. Multiple atomics interact, reasoning about weaker orderings becomes error-prone<br>4. Debugging, seq_cst failures are easier to reproduce</p><pre>// This is FINE for most code<br>std::atomic&lt;int&gt; counter{0};<br>counter.fetch_add(1); // defaults to seq_cst</pre><h4>Decision Flowchart</h4><pre>Is this atomic used for synchronization with other data?<br>│<br>├─ NO → Use memory_order_relaxed<br>│ (pure counters, statistics)<br>│<br>└─ YES → Do you need to see other thread’s writes?<br> │<br> ├─ YES (consumer/reader) → memory_order_acquire<br> │<br> └─ NO → Do other threads need to see YOUR writes?<br> │<br> ├─ YES (producer/writer) → memory_order_release<br> │<br> └─ BOTH → memory_order_acq_rel<br> (reference counting, CAS loops)</pre><h4>Summary</h4><pre>| Pattern            | Producer         | Consumer       | Use Case                         |<br>| - - - - -          | - - - - -        | - - - - -      | - - - - -                        |<br>| Producer-Consumer  | release          | acquire        | Flags, queues, one-way signaling |<br>| Reference Counting | relaxed (inc)    | acq_rel (dec)  | shared_ptr, custom RAII          |<br>| Spinlock           | release (unlock) | acquire (lock) | Mutexes, critical sections       |</pre><p><strong>The takeaway:</strong> Start with seq_cst, profile, then apply these three patterns where needed. Memory ordering bugs are subtle and devastating optimize only with understanding.</p><h3>Three patterns. That’s it.</h3><ul><li>Producer-Consumer: release to publish, acquire to consume</li><li>Reference Counting: relaxed to increment, acq_rel to decrement</li><li>Spinlock: acquire to lock, release to unlock</li></ul><p>Start with seq_cst it&#39;s correct, it&#39;s readable, and it&#39;s what your teammates expect. Then profile. If atomics show up in your hot path, apply these patterns with precision.</p><p>Memory ordering bugs are subtle, non-deterministic, and architecture-dependent. They’ll work on your x86 laptop and explode on ARM in production. The patterns above aren’t just performance tricks, they’re <em>provably correct</em> when applied right.</p><p>Understand them. Use them deliberately. And when in doubt, seq_cst is still your friend.</p><h3>Further Reading</h3><p>From <strong>C++ Concurrency in Action</strong> by Anthony Williams:</p><p>- <strong>Chapter 5</strong> (entire): The definitive reference on the C++ memory model<br>- <strong>Section 5.2: </strong>Atomic operations and types<br>- <strong>Section 5.3: </strong>Synchronization and ordering constraints<br>- <strong>Section 7.2: </strong>Lock-free data structures in practice<br>- <strong>Appendix D: </strong>C++ thread library reference (quick lookup)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ca1602d4006" width="1" height="1" alt=""><hr><p><a href="https://medium.com/womenintechnology/demystifying-memory-ordering-in-c-memory-ordering-patterns-5ca1602d4006">Demystifying Memory Ordering in C++: Memory Ordering Patterns</a> was originally published in <a href="https://medium.com/womenintechnology">Women in Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Memory Ordering in C++]]></title>
            <link>https://medium.com/womenintechnology/demystifying-memory-ordering-in-c-4cb2b6aaeae8?source=rss-54118d14c831------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cb2b6aaeae8</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[lock-free-programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cplusplus]]></category>
            <dc:creator><![CDATA[De Nada]]></dc:creator>
            <pubDate>Tue, 07 Jul 2026 10:35:36 GMT</pubDate>
            <atom:updated>2026-07-07T10:35:36.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*c-ujFIYv3Z0fa1ldj6Agfg@2x.jpeg" /><figcaption>Your code doesn’t necessarily get executed in the order you wrote it.</figcaption></figure><h3>Demystifying Memory Ordering in C++: I<strong>naugural</strong></h3><h4><strong><em>If you’ve ever wondered why your lock-free queue is slower than a mutex, you will have a better view on things </em>by the end of this article<em>.</em></strong></h4><p>As a System Programming Language, C++ is all about being as <strong><em>“close to the machine”</em></strong> as possible, so close that there would be no need for lower level languages specially when it comes to Memory Manipulation and in a way that is C++’s super power!</p><h3>Memory Model Basics</h3><p>Starting with the basic definitions we have two main aspect categories both of which are interrelated: <br>- structural aspects <em>[related to how things are laid out in memory locations]. </em><br>- concurrency aspects <em>[related to multiple threading].</em></p><p>If multiple threads try to access separate memory locations there is really no problem here. Big problems arise when threads access the same memory location without synchronization, and at least one access is a write, that causes what is commonly known as a data race which puts you in one of the nastiest corners of C++ <strong>Undefined Behaviors.</strong></p><p>Every C++ developer knows std::atomic is a go-to fix for these issues. But most treat <strong>Memory Ordering</strong> like black magic, defaulting to std::memory_order_seq_cst and hoping for the best. This approach works, but it may be silently killing your performance.</p><p>There’s a reason lock-free legends use acquire, release, and relaxed and it’s not just to show off. In this article we will deep dive, breaking down the six memory orderings and exposing the three patterns that cover 90% of real-world concurrency to show you exactly when you can drop the safety rails without falling off.</p><h3>C++ Memory Ordering: What acquire and release Actually Mean</h3><p>Here’s a confession: most C++ developers (myself included, not long ago) slap std::memory_order_seq_cst on every other atomic operation and hope for the best. It works. It’s safe. But it’s also leaving performance on the table and more importantly, it means you don’t actually understand what’s happening under the hood.</p><p>This article will change that. By the end, you’ll know exactly when to use each memory order, why acquire and release form the most important pattern, and how to reason about concurrent code without guesswork.</p><p>Prerequisites: Basic familiarity with std::atomic and std::thread.</p><h3>Why Memory Ordering Exists!</h3><p>Your C++ code doesn’t run the way you wrote it!</p><p>Both the compiler and the CPU reorder operations to enhance performance. This is fine in single-threaded code the “as-if” rule guarantees observable behavior stays the same. But in multithreaded code? Reordering creates chaos.</p><pre>// Thread 1<br>data = 42;<br>ready = true;<br><br>// Thread 2<br>if (ready)<br>    std::cout &lt;&lt; data;  // Could print 0!</pre><p>Without memory ordering, Thread 2 might see ready == true before it sees data == 42. The CPU or compiler could have reordered the stores in Thread 1, or the loads in Thread 2.</p><h3>The C++ Memory Orders From Weakest to Strongest</h3><p>C++ gives you six memory orders. Here they are, ranked by strength:</p><pre>Order   Strength  Use Case<br>relaxed Weakest   Counters, statistics<br>consume Weak      (Avoid poorly supported)<br>acquire Medium    Reading shared state<br>release Medium    Publishing shared state<br>acq_rel Strong    Read-modify-write operations<br>seq_cst Strongest Default, full ordering</pre><h4>memory_order_relaxed</h4><p>No synchronization. No ordering guarantees. Only atomicity is guaranteed.</p><pre>std::atomic&lt;int&gt; counter{0};<br><br>void increment() {<br>    // Safe: atomic increment, but no ordering with other operations<br>    counter.fetch_add(1, std::memory_order_relaxed);<br>}<br><br>int get_count() {<br>    return counter.load(std::memory_order_relaxed);<br>}</pre><p>When to use: Statistics, counters, progress indicators anything where you don’t need to synchronize other data with this value.</p><h4>memory_order_consume</h4><p>Skip this one. It’s designed for dependency chains but no major compiler implements it correctly. They all promote it to acquire. The C++ committee is reworking it.</p><h4>memory_order_acquire and memory_order_release</h4><p>This is the most important pair. Master this and you’ve mastered 90% of practical memory ordering.</p><p>Release: “I’m done writing. Publish everything before this point.”<br>Acquire: “I’m about to read. Make sure I see everything published.”</p><pre>std::atomic&lt;bool&gt; ready{false};<br>int data = 0;  // non-atomic!<br><br>// Thread 1 (Producer)<br>void producer() {<br>    data = 42;                                    // A<br>    ready.store(true, std::memory_order_release); // B: release barrier<br>}<br><br>// Thread 2 (Consumer)<br>void consumer() {<br>    while (!ready.load(std::memory_order_acquire)) {} // C: acquire barrier<br>    assert(data == 42);  // D: guaranteed to see 42!<br>}</pre><h4>What happens:</h4><ul><li>The release at B ensures A happens-before B</li><li>The acquire at C synchronizes with the release at B</li><li>Therefore, A happens-before D</li><li>data == 42 is guaranteed</li></ul><h4>Visual:</h4><pre>Thread 1:                 Thread 2:<br>  data = 42       <br>       │          │<br>                  │<br>  ready = true ───┼──► ready == true<br>    (release)     │       (acquire)<br>                  │          │<br>                  └──────────<br>                         data == 42 </pre><h4>memory_order_acq_rel</h4><p>Combines acquire and release. Use for read-modify-write operations that both consume and publish.</p><pre>std::atomic&lt;int&gt; ref_count{1};<br><br>void release_reference() {<br>    // Acquire: see all writes before we potentially delete<br>    // Release: our &quot;I&#39;m done&quot; is visible to others<br>    if (ref_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {<br>        delete resource;<br>    }<br>}</pre><h4>memory_order_seq_cst</h4><p>Sequential consistency. The default. All threads see all seq_cst operations in the same global order.</p><pre>std::atomic&lt;bool&gt; x{false};<br>std::atomic&lt;bool&gt; y{false};<br>std::atomic&lt;int&gt; z{0};<br><br>void write_x() { x.store(true, std::memory_order_seq_cst); }<br>void write_y() { y.store(true, std::memory_order_seq_cst); }<br><br>void read_x_then_y() {<br>    while (!x.load(std::memory_order_seq_cst)) {}<br>    if (y.load(std::memory_order_seq_cst)) ++z;<br>}<br><br>void read_y_then_x() {<br>    while (!y.load(std::memory_order_seq_cst)) {}<br>    if (x.load(std::memory_order_seq_cst)) ++z;<br>}<br><br>// After all threads complete: z &gt; 0 is GUARANTEED<br>// At least one reader sees both flags as true</pre><p>Cost: Global synchronization is expensive. On x86 it’s not terrible, but on ARM/PowerPC it can be significant.</p><h3>What’s Next</h3><p>You now understand the six memory orderings and the guarantees each provides from relaxed (just atomicity) to seq_cst (global ordering). You know why your code doesn’t run the way you wrote it, and you’ve seen the release/acquire handshake that forms the backbone of most synchronization.</p><p>But knowing the tools isn’t the same as knowing when to use them.</p><p><strong>In the upcoming article</strong>, we’ll move from theory to practice. I’ll show you the three patterns that cover 90% of real-world concurrency: producer-consumer, reference counting, and spinlocks. We’ll build a lock-free queue, benchmark the performance difference between orderings, and give you a decision flowchart you can actually use.</p><p>Because understanding memory ordering isn’t about memorizing rules it’s about recognizing patterns.</p><blockquote>Reference: This article draws from Chapter 5 of “C++ Concurrency in Action” by Anthony Williams (2nd Edition), specifically sections 5.2 and 5.3. If you want the full deep-dive:</blockquote><blockquote>- <strong>Chapter 5</strong> (entire): The definitive reference on the C++ memory model<br>- <strong>Section 5.2: </strong>Atomic operations and types<br>- <strong>Section 5.3: </strong>Synchronization and ordering constraints</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cb2b6aaeae8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/womenintechnology/demystifying-memory-ordering-in-c-4cb2b6aaeae8">Demystifying Memory Ordering in C++</a> was originally published in <a href="https://medium.com/womenintechnology">Women in Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t comment your code]]></title>
            <link>https://medium.com/womenintechnology/dont-comment-your-code-3c66c6b97693?source=rss-54118d14c831------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c66c6b97693</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[De Nada]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 15:04:36 GMT</pubDate>
            <atom:updated>2026-06-15T15:04:36.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*8D8VNlgdoJOGqSrltfJFoA.png" /></figure><blockquote>#Your First Developer Instinct Is To Disagree But Hear Me Out..</blockquote><h4>I’m not saying comments are all bad. If used properly comments are very powerful but they aren’t the answer to your mess, in fact they might make another mess.</h4><p>A code could brilliantly solve a critical problem using a well-crafted algorithm, utilizing a famous design pattern or exploiting from a revolutionary feature of a programming language, while depending on providing comments each step of the way and yet be a mystery to the team of developers maintaining it. **Why?!**<br>Some developers tend to focus more on writing time-wasting comments than on refactoring the code itself.</p><h4>**Here are some comments your team is better off without:**</h4><h3>##Redundant Comments</h3><p><strong>Comments should be adding value or describing an original logic,</strong> not translating syntax. if the code was well written it won’t need this extra comment to narrate each line’s job.</p><p>You can clearly see here that the comment is so uncalled for especially with all the descriptive naming.</p><pre>```<br> // The processor delay for this component.<br> protected int processorDelay = -1;</pre><h3>##Misleading Comments</h3><p><strong>The road to hell is paved with good intentions.</strong> The author can put an inaccurate comment for all the right reasons, yet that would cost a poor programmer an expensive debugging session.</p><p>For example the method here does not return when `this.closed` becomes `true`. It only returns if `this.closed` is `true`; otherwise, it waits for a blind time-out and then throws an exception if it is still not closed. The difference is astounding!</p><pre>// Returns when this.closed is true. Throws an exception on timeout is reached.<br>public synchronized void waitForClose(final long timeoutMillis) throws Exception<br>{<br> if(!closed){<br> wait(timeoutMillis);<br> if(!closed)<br> throw new Exception(&quot;MockResponseSender could not be closed&quot;);<br> }<br>}</pre><h3>##Mandated Comments</h3><p><strong>Some mandatory comments might not be that useful afterall.</strong> Comments should not be just clutter.</p><p>javadocs here are just clutter.</p><pre>/**<br> * @param title The title of the CD<br> * @param author The author of the CD<br> */<br> public void addCD(String title, String author) {<br> CD cd = new CD();<br> cd.title = title;<br> cd.author = author;<br> cdList.add(cd);<br> }</pre><h3>##Noise Comments</h3><p><strong>Comments should provide new information otherwise they are just noise that we learn to ignore.</strong> If you ignore a comment it means that it shouldn’t have been there in the first place.</p><p>Not only did this author write an unnecessary comment but he also forgot to add the catch body and left a mumbling comment with no context.</p><pre>try<br>{<br> // Continue normal flow<br> doSomething();<br>}<br>catch(Exception e1)<br>{<br> // Give me a break!<br>}</pre><h3>##Function or variable substitution comments</h3><p><strong>A complex code line doesn’t need a comment,</strong> what it needs is to be refactored or broken to smaller components.</p><p>Consider the following:</p><pre>// does the module from the global list &lt;mod&gt; depend on the<br>// subsystem we are part of?<br>if (smodule.getDependSubsystems().contains(subSysMod.getSubSystem())) { }</pre><p>How about rephrasing it as follows instead?</p><pre>ArrayList moduleDependees = smodule.getDependSubsystems();<br>String ourSubSystem = subSysMod.getSubSystem();<br>if (moduleDependees.contains(ourSubSystem)) { }</pre><h3>##Position Marker Comments</h3><p><strong>Marking a particular position with a comment is rarely useful;</strong> it makes sense to gather certain functions together beneath a banner But I don’t see how useful that is for each function, in general they actually may be _just clutter._</p><p>Admit it you did this ;)</p><pre>// Actions //////////////////////////////////</pre><h3>##Attribution Comments</h3><p><strong>There is no need to pollute the code with little bylines.</strong> There are so many source control tools that are very good at remembering who added what, when Git blame is after all of us..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*ioTnw_w3dlf7CgWO2us8yQ.png" /></figure><p>unless you’re using older source control tools that doesn’t have a blame functionality then you have bigger issues to worry about.</p><h3>##Commented-out Code</h3><p><strong>Commented out sections aren’t too important to delete</strong>, Actually most source code control systems remember the code for us. We don’t need to be hoarding useless pieces of inactive code anymore.</p><p>Remember the first time you found out you’re clingy?</p><pre>InputStreamResponse response = new InputStreamResponse();<br>response.setBody(formatter.getResultStream(), formatter.getByteCount());<br>// InputStream resultsStream = formatter.getResultStream();<br>// StreamReader reader = new StreamReader(resultsStream);<br>// response.setContent(reader.read(formatter.getByteCount()));</pre><h3>##Non-local Comments</h3><p><strong>Comments should describe the code it appears near to. </strong>There should be an obvious connection between the code and the comments.</p><p>Don’t offer irrelevant or system wide information in the context of a local comment. The place for Interesting historical discussions or irrelevant descriptions of details is not comments.</p><blockquote>Important<br>This article is not an invite to ditch comments. Comments are powerful tools, just use them wisely and invest in their quality, Also never forget that refactoring the code is key.</blockquote><blockquote>#####References<br>This article is based on **Clean Code: A Handbook of Agile Software Craftsmanship** by **Robert C. Martin**, the book is highly recommended to read, such an amazing book that will add a lot to you.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c66c6b97693" width="1" height="1" alt=""><hr><p><a href="https://medium.com/womenintechnology/dont-comment-your-code-3c66c6b97693">Don’t comment your code</a> was originally published in <a href="https://medium.com/womenintechnology">Women in Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Women in Tech: The Assumption Bias]]></title>
            <link>https://medium.com/womenintechnology/women-in-tech-the-jaw-dropping-assumptions-19225f254f8f?source=rss-54118d14c831------2</link>
            <guid isPermaLink="false">https://medium.com/p/19225f254f8f</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[De Nada]]></dc:creator>
            <pubDate>Fri, 05 Jun 2026 15:23:46 GMT</pubDate>
            <atom:updated>2026-07-07T10:54:44.104Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*RXzzm-QStgeef22iVxkuuA@2x.jpeg" /><figcaption>Women in Tech come in all shades</figcaption></figure><h4>“Women in STEM” isn’t a western export, by the end of this you may agree.</h4><p>As someone who once believed it myself, growing up in North Africa and choosing a career path in a male-dominated field like Engineering, I was the angry feminist in every room. I looked west and saw liberation. At home I saw a cage. It took working and later living between both worlds to understand that I had been misled.</p><p>I started noticing the language of women’s freedom being used in justifications for violence against civilian populations and something inside me shifted. The story being told about women like me, where we come from, how much we suffer, how badly we need saving, was never really about us. It was a narrative with other uses.</p><p>In that narrative, women from several parts of the world are never the engineers, doctors, scientists or mathematicians they actually are. They are only ever the portrait someone else painted, the oppressed, the voiceless, the perpetually waiting-to-be-saved. A flat image, held up to justify a story that was never really about them.</p><h3>The Myth of the Monolith</h3><p>The foundation that narrative rests on is that the Arab world, the Muslim world, the African world and even the Global South are a single entity, oppressive by nature, uniform in its failures, comprehensible from a distance. They aren’t.</p><p>That umbrella covers tens of countries, hundreds of distinct cultures and billions of people. No two countries share the same culture. No two cultures produce the same experience for women.</p><p>Treating an entire region as a single data point serves a narrative more than it serves people inside it, in a way it’s collective punishment, and whether that is rhetorical, social or political, it is not analysis. It is a tool, and tools have purposes.</p><p>The purpose, in this case, is rarely the liberation of women.</p><h3>The Jaw Drops</h3><p>I look different, and I’m reminded of that regularly, particularly when I casually mention that back home I was used to seeing more women in Tech. The response without fail is stunned disbelief.</p><p>I have learned to move past that reaction. But I wanted to name it for what it is because it isn’t just innocent surprise. It is the visible expression of an assumption so deeply held that women who look like me, from places like mine, do not belong in technical fields, and certainly not in numbers.</p><p>That doesn’t register as an assumption anymore. It just reads as common sense. It shouldn’t be.</p><h3>Ducks in a row</h3><p>The reality is that several North African countries have maintained significantly high female enrollment in STEM and Medical fields in universities, sometimes exceeding Western European figures, according to data from the <strong><em>UNESCO Institute for Statistics (UIS)</em></strong> and <strong><em>the World Bank Gender Statistics database</em></strong>. For instance, UNESCO research highlights that women make up an impressive 58% of STEM graduates in Algeria and 55% in Tunisia, while Egypt follows closely with 47.2% to 50% of its science and technology degrees awarded to women.</p><p>The contrast with Western Europe is striking and underreported. According to OECD and Eurostat education tracking, women account for an average of only 31% to 33.5% of total STEM graduates across Europe, dropping down significantly to just 13% in Spain and 15% in Belgium for digital and tech-focused majors specifically.</p><p>Enrollment numbers are only one part of the picture but they complicate a story that often goes unexamined.</p><h3>Getting a foot at the door</h3><p>The high numbers in most North African countries are shaped by a set of interconnected socioeconomic factors. Chief among them is the perception that STEM and Medical fields are the clearest path to stable, high-paying jobs. Pursuing these fields is a highly rational economic strategy for financial independence, rather than a choice dictated by abstract gender theories.</p><p>STEM and Medical fields are also culturally viewed as prestigious, safe and respectable career paths for women within the region, so pursuing them is actually more encouraged rather than merely tolerated.</p><p>The cultural framing shapes professional expectations in ways that are easy to miss from the outside, in this context a serious woman is a credible woman. Intensity signals high drive and isn’t a liability. If a woman in a professional setting looks too serious, it means she has work to do and isn’t interested in performing approachability for the comfort of the room.</p><p>Which is why I was genuinely caught off guard when I learned about the<em> “you need to smile more”</em> school and the norms that travel with it in some western professional cultures, The expectation that a woman must perform warmth and approachability, regardless of the task at hand, is a form of conditioning that quietly excludes a lot of women from spaces that require exactly the kind of focused, no-nonsense energy that gets things done. Under that framework, a woman is either too cold or too emotional, too serious or not serious enough. It is a standard designed to make her always lose.</p><h3>Knowing history but choosing to ignore it</h3><p>What really bothers me about the jaw-dropping is that it’s historically well known that women from that region did not wait for permission. as queens, saints and scientists who practiced medicine even at times when that was grounds for a witch hunt. They were even idolized for centuries.</p><p>Women from my region always showed up and built a presence not because the culture was without its barriers, but because they forced their way through them anyway, loudly and unapologetically. We were always here.</p><p>The jaw-dropping is not flattering. It is a window into exactly the kind of assumption this piece is dismantling.</p><h3>We were never the portrait</h3><p>The portrait was never commissioned by the women inside it. It was painted from a distance, by people with other things to say, and hung in rooms it was always meant to serve, where the subjects were never invited.</p><p>The women I come from did not wait for the frame to change. They showed up to educational programs when they were stared at, held their ground when they were told to make themselves smaller, built careers and legacies on both sides of borders that only ever mattered to the people drawing them. They were not absent from history waiting to be written in. They were already the story.</p><p>I am still learning how to see the world clearly. But I am using my own eyes now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19225f254f8f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/womenintechnology/women-in-tech-the-jaw-dropping-assumptions-19225f254f8f">Women in Tech: The Assumption Bias</a> was originally published in <a href="https://medium.com/womenintechnology">Women in Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>