<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Anti-Patterns on guy@secdev.uk</title>
    <link>https://www.secdev.uk/blog/tags/anti-patterns/</link>
    <description>Recent content in Anti-Patterns on guy@secdev.uk</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <copyright>Guy Dixon | guy@secdev.uk</copyright>
    <lastBuildDate>Wed, 11 Mar 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.secdev.uk/blog/tags/anti-patterns/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Rust Learning Guide - Anti-Patterns</title>
      <link>https://www.secdev.uk/blog/articles/rust_antipatterns/</link>
      <pubDate>Wed, 11 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://www.secdev.uk/blog/articles/rust_antipatterns/</guid>
      <description>&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;code&gt;antipatterns.rs&lt;/code&gt; module &lt;a href=&#34;https://github.com/guyadixon/RustLearning/blob/main/src/antipatterns.rs&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&#xA;    Source Code File&#xA;&lt;/a&gt;&#xA; demonstrates 15 common Rust mistakes and their correct solutions. I put this together because I noticed the same patterns coming up, especially from developers (myself included) fighting the borrow checker instead of working with it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;anti-patterns-covered&#34;&gt;Anti-Patterns Covered&lt;/h2&gt;&#xA;&lt;h3 id=&#34;1-unnecessary-clone-everywhere&#34;&gt;1. &lt;strong&gt;Unnecessary .clone() Everywhere&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Cloning to avoid borrow checker&lt;/li&gt;&#xA;&lt;li&gt;✅ Use references (&amp;amp;T) instead&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;2-using-unwrap-in-production&#34;&gt;2. &lt;strong&gt;Using .unwrap() in Production&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Crashes program on error&lt;/li&gt;&#xA;&lt;li&gt;✅ Return Result&amp;lt;T, E&amp;gt; and handle gracefully&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;3-returning-references-to-local-variables&#34;&gt;3. &lt;strong&gt;Returning References to Local Variables&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Dangling references (won&amp;rsquo;t compile)&lt;/li&gt;&#xA;&lt;li&gt;✅ Return owned data or use &amp;lsquo;static lifetime&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;4-using-string-when-str-would-work&#34;&gt;4. &lt;strong&gt;Using String When &amp;amp;str Would Work&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Forces caller to own String&lt;/li&gt;&#xA;&lt;li&gt;✅ Accept &amp;amp;str - works with both&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;5-ignoring-compiler-warnings&#34;&gt;5. &lt;strong&gt;Ignoring Compiler Warnings&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Unused mut, unused variables&lt;/li&gt;&#xA;&lt;li&gt;✅ Listen to the compiler&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;6-using-indices-instead-of-iterators&#34;&gt;6. &lt;strong&gt;Using Indices Instead of Iterators&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ C-style loops can panic&lt;/li&gt;&#xA;&lt;li&gt;✅ Use iterators - safer and clearer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;7-manually-implementing-what-traits-provide&#34;&gt;7. &lt;strong&gt;Manually Implementing What Traits Provide&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Manual equality checks&lt;/li&gt;&#xA;&lt;li&gt;✅ #[derive(PartialEq, Debug, Clone)]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;8-using-vec-when-array-would-work&#34;&gt;8. &lt;strong&gt;Using Vec When Array Would Work&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Heap allocation for fixed-size data&lt;/li&gt;&#xA;&lt;li&gt;✅ Use arrays [T; N] for stack allocation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;9-nested-matchif-let-instead-of-combinators&#34;&gt;9. &lt;strong&gt;Nested match/if let Instead of Combinators&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Deeply nested matching&lt;/li&gt;&#xA;&lt;li&gt;✅ Use .map(), .filter(), .and_then()&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;10-using-mutex-when-not-needed&#34;&gt;10. &lt;strong&gt;Using Mutex When Not Needed&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Mutex in single-threaded code&lt;/li&gt;&#xA;&lt;li&gt;✅ Just use regular variables&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;11-collecting-iterator-just-to-iterate-again&#34;&gt;11. &lt;strong&gt;Collecting Iterator Just to Iterate Again&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Unnecessary intermediate collection&lt;/li&gt;&#xA;&lt;li&gt;✅ Chain iterators directly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;12-using-deref-coercion-as-inheritance&#34;&gt;12. &lt;strong&gt;Using Deref Coercion as Inheritance&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Simulating inheritance with Deref&lt;/li&gt;&#xA;&lt;li&gt;✅ Use composition explicitly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;13-panicking-in-library-code&#34;&gt;13. &lt;strong&gt;Panicking in Library Code&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ panic!() crashes caller&amp;rsquo;s program&lt;/li&gt;&#xA;&lt;li&gt;✅ Return Result and let caller decide&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;14-using-format-when-to_&#34;&gt;14. &lt;strong&gt;Using format! When to_string() Works&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Overkill for simple conversions&lt;/li&gt;&#xA;&lt;li&gt;✅ Use .to_string() for clarity&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;15-implementing-default-manually&#34;&gt;15. &lt;strong&gt;Implementing Default Manually&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;❌ Manual new() constructor&lt;/li&gt;&#xA;&lt;li&gt;✅ Implement Default trait&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;key-principle&#34;&gt;Key Principle&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Work WITH Rust&amp;rsquo;s ownership system, not against it.&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Anti-Patterns That Kill Teams</title>
      <link>https://www.secdev.uk/blog/leadership/3.10-the-anti-patterns-that-kill-teams/</link>
      <pubDate>Mon, 23 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://www.secdev.uk/blog/leadership/3.10-the-anti-patterns-that-kill-teams/</guid>
      <description>&lt;p&gt;Most team dysfunction isn&amp;rsquo;t unique. It follows recognisable patterns that repeat across organisations, industries, and decades. The good news is that if you can name the pattern, you&amp;rsquo;re halfway to fixing it. The bad news is that most leaders don&amp;rsquo;t recognise the patterns until the damage is well advanced.&lt;/p&gt;&#xA;&lt;p&gt;Osmani catalogues these anti-patterns extensively, and I&amp;rsquo;ve encountered most of them across my career. Here are the ones that I&amp;rsquo;ve seen do the most damage, organised by where they originate.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
