<?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>Forem: Ayman Atif</title>
    <description>The latest articles on Forem by Ayman Atif (@a95yman).</description>
    <link>https://forem.com/a95yman</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%2F3887349%2F44f7eb73-8509-408e-94a4-f2d98502a27d.jpg</url>
      <title>Forem: Ayman Atif</title>
      <link>https://forem.com/a95yman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/a95yman"/>
    <language>en</language>
    <item>
      <title>3 LINQ Mistakes That Hurt Backend API Performance in .NET</title>
      <dc:creator>Ayman Atif</dc:creator>
      <pubDate>Mon, 27 Apr 2026 17:24:31 +0000</pubDate>
      <link>https://forem.com/a95yman/3-linq-mistakes-that-hurt-backend-api-performance-in-net-415k</link>
      <guid>https://forem.com/a95yman/3-linq-mistakes-that-hurt-backend-api-performance-in-net-415k</guid>
      <description>&lt;p&gt;LINQ looks clean and harmless in C#.&lt;/p&gt;

&lt;p&gt;But in real backend APIs, small mistakes can quietly turn into serious performance issues.&lt;/p&gt;

&lt;p&gt;Here are 3 I’ve seen (and made) while working with .NET and Entity Framework:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Loading entire tables into memory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A common mistake is doing this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var orders = dbContext.Orders.ToList();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var recent = orders.Where(o =&amp;gt; o.CreatedAt &amp;gt; DateTime.UtcNow.AddDays(-7));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This pulls everything into memory first, then filters in C#.&lt;/p&gt;

&lt;p&gt;The problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;unnecessary memory usage&lt;/li&gt;
&lt;li&gt;slow processing on large datasets&lt;/li&gt;
&lt;li&gt;wasted database optimization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fix:&lt;/p&gt;

&lt;p&gt;Let the database do the work:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var recent = dbContext.Orders&lt;br&gt;
    .Where(o =&amp;gt; o.CreatedAt &amp;gt; DateTime.UtcNow.AddDays(-7))&lt;br&gt;
    .ToList();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Hidden multiple database calls&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LINQ queries can be deceptively reused:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var query = dbContext.Orders.Where(o =&amp;gt; o.Total &amp;gt; 100);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var count = query.Count();&lt;/code&gt;&lt;br&gt;
&lt;code&gt;var list = query.ToList();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This can result in multiple database executions depending on how it's used.&lt;/p&gt;

&lt;p&gt;Fix:&lt;/p&gt;

&lt;p&gt;Materialize once:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var list = dbContext.Orders&lt;br&gt;
    .Where(o =&amp;gt; o.Total &amp;gt; 100)&lt;br&gt;
    .ToList();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var count = list.Count;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Fetching more data than needed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another common issue:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var orders = dbContext.Orders.ToList();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var result = orders.Select(o =&amp;gt; new&lt;br&gt;
{&lt;br&gt;
    o.Id,&lt;br&gt;
    o.CustomerName&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You are still loading full rows from the database even though you only need 2 fields.&lt;/p&gt;

&lt;p&gt;Fix:&lt;/p&gt;

&lt;p&gt;Project early:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var result = dbContext.Orders&lt;br&gt;
    .Select(o =&amp;gt; new&lt;br&gt;
    {&lt;br&gt;
        o.Id,&lt;br&gt;
        o.CustomerName&lt;br&gt;
    })&lt;br&gt;
    .ToList();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Key idea&lt;/p&gt;

&lt;p&gt;LINQ itself is not the problem.&lt;/p&gt;

&lt;p&gt;The real issue is where the execution happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in memory&lt;/li&gt;
&lt;li&gt;or in the database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In backend systems, that difference matters a lot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closing thought&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most performance issues in APIs are not “big architecture problems”.&lt;/p&gt;

&lt;p&gt;They start with small LINQ decisions like these.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/9Vm5R6pPMqE"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>database</category>
      <category>performance</category>
      <category>api</category>
    </item>
    <item>
      <title>I stopped rebuilding the same .NET backend every project (here’s what changed)</title>
      <dc:creator>Ayman Atif</dc:creator>
      <pubDate>Sun, 26 Apr 2026 13:20:29 +0000</pubDate>
      <link>https://forem.com/a95yman/i-stopped-rebuilding-the-same-net-backend-every-project-heres-what-changed-13e9</link>
      <guid>https://forem.com/a95yman/i-stopped-rebuilding-the-same-net-backend-every-project-heres-what-changed-13e9</guid>
      <description>&lt;p&gt;A couple of years ago, every new .NET project I started looked exactly the same.&lt;/p&gt;

&lt;p&gt;The first few days were always the same routine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;set up JWT auth&lt;/li&gt;
&lt;li&gt;add roles&lt;/li&gt;
&lt;li&gt;figure out refresh tokens&lt;/li&gt;
&lt;li&gt;recreate the folder structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It felt productive at the time.&lt;/p&gt;

&lt;p&gt;But looking back, it was just repetition.&lt;/p&gt;

&lt;p&gt;The worst part wasn't even the time I lost.&lt;/p&gt;

&lt;p&gt;It was the same small mistakes that kept coming back over and over:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;auth edge cases&lt;/li&gt;
&lt;li&gt;inconsistent structure across projects&lt;/li&gt;
&lt;li&gt;temporary decisions that somehow stayed forever&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every project started out messy before it even had a chance to become something good.&lt;/p&gt;

&lt;p&gt;At some point, I just got tired of it.&lt;/p&gt;

&lt;p&gt;So instead of rebuilding everything from scratch again, I created a base system I could reuse on every project.&lt;/p&gt;

&lt;p&gt;A simple rule: if I have solved it once, I should not have to solve it again.&lt;/p&gt;

&lt;p&gt;I ended up with something like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a Clean Architecture structure auth already wired up with JWT, roles, and refresh tokens&lt;/li&gt;
&lt;li&gt;a predictable project layout&lt;/li&gt;
&lt;li&gt;no more "I will fix this later" parts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference was immediate.&lt;/p&gt;

&lt;p&gt;When I start a new project now, I do not touch the setup anymore. I go straight into building actual features.&lt;/p&gt;

&lt;p&gt;Another thing I noticed: a lot of these same patterns show up in interviews. Not the exact code, but the thinking behind it. How auth flows work. How you structure projects. How you avoid common mistakes.&lt;/p&gt;

&lt;p&gt;So I started documenting those patterns too.&lt;/p&gt;

&lt;p&gt;Now I basically have a starter system I use for everything. It is not perfect. But it is consistent, and that is what matters.&lt;/p&gt;

&lt;p&gt;If you are in that phase where every project starts from zero, try this: build your own base system once. It does not have to be fancy. Just something you can trust and reuse.&lt;/p&gt;

&lt;p&gt;I also turned mine into a small bundle, an API starter plus interview prep, since a few people asked for it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://yaman95.gumroad.com/l/full-dotnet-backend-system" rel="noopener noreferrer"&gt;https://yaman95.gumroad.com/l/full-dotnet-backend-system&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>softwareengineering</category>
      <category>webdev</category>
      <category>csharp</category>
    </item>
    <item>
      <title>I opened affiliates for my .NET interview guide (but here’s why I hesitated)</title>
      <dc:creator>Ayman Atif</dc:creator>
      <pubDate>Sat, 25 Apr 2026 17:50:23 +0000</pubDate>
      <link>https://forem.com/a95yman/i-opened-affiliates-for-my-net-interview-guide-but-heres-why-i-hesitated-51d</link>
      <guid>https://forem.com/a95yman/i-opened-affiliates-for-my-net-interview-guide-but-heres-why-i-hesitated-51d</guid>
      <description>&lt;p&gt;A few months ago, I kept seeing the same pattern in .NET interviews.&lt;/p&gt;

&lt;p&gt;Not “hard questions”…&lt;br&gt;
Just the same concepts, asked in slightly different ways.&lt;/p&gt;

&lt;p&gt;Things like:&lt;/p&gt;

&lt;p&gt;Thread &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;vs Task&lt;/li&gt;
&lt;li&gt;Async pitfalls&lt;/li&gt;
&lt;li&gt;Database performance questions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At some point, I stopped studying randomly and started tracking patterns.&lt;/p&gt;

&lt;p&gt;That’s what helped me pass interviews faster.&lt;/p&gt;

&lt;p&gt;So I turned it into a small guide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real questions I’ve personally faced&lt;/li&gt;
&lt;li&gt;The patterns behind them&lt;/li&gt;
&lt;li&gt;Simple explanations (not textbook stuff)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now here’s the part I wasn’t sure about:&lt;/p&gt;

&lt;p&gt;I opened an affiliate program for it.&lt;/p&gt;

&lt;p&gt;Not because I want “marketers”…&lt;br&gt;
But because I know some devs already create content around:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Interview prep&lt;/li&gt;
&lt;li&gt;Junior dev journeys&lt;/li&gt;
&lt;li&gt;Learning C# / .NET&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And this might actually help their audience.&lt;/p&gt;

&lt;p&gt;If you create content in that space, I’m happy to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give you full access to the guide&lt;/li&gt;
&lt;li&gt;Let you decide if it’s worth sharing&lt;/li&gt;
&lt;li&gt;And if you do, you can earn from it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Affiliate link:&lt;br&gt;
&lt;a href="https://yaman95.gumroad.com/affiliates" rel="noopener noreferrer"&gt;https://yaman95.gumroad.com/affiliates&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Either way, even if you’re not interested in affiliates:&lt;/p&gt;

&lt;p&gt;Curious... what’s one question you keep seeing in .NET interviews?&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why .NET interviews feel harder than they should</title>
      <dc:creator>Ayman Atif</dc:creator>
      <pubDate>Fri, 24 Apr 2026 14:19:20 +0000</pubDate>
      <link>https://forem.com/a95yman/why-net-interviews-feel-harder-than-they-should-4hbc</link>
      <guid>https://forem.com/a95yman/why-net-interviews-feel-harder-than-they-should-4hbc</guid>
      <description>&lt;p&gt;Most &lt;strong&gt;.NET interview&lt;/strong&gt; prep goes into learning concepts.&lt;/p&gt;

&lt;p&gt;But in actual interviews, I’ve noticed something else matters more.&lt;/p&gt;

&lt;p&gt;It’s not just what you know, it’s how you explain it.&lt;/p&gt;

&lt;p&gt;A lot of people run into the same issues:&lt;/p&gt;

&lt;p&gt;They start explaining too much at once, or they lose clarity halfway through their answer.&lt;/p&gt;

&lt;p&gt;And even simple questions like &lt;strong&gt;“what’s the difference between IEnumerable and IQueryable?”&lt;/strong&gt; end up sounding more complicated than they are.&lt;/p&gt;

&lt;p&gt;I think the better approach is actually pretty simple:&lt;/p&gt;

&lt;p&gt;Start with a clear, short answer first. Then add detail only if needed.&lt;/p&gt;

&lt;p&gt;Something like:&lt;br&gt;
&lt;strong&gt;“IEnumerable works in memory, IQueryable works with the database.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then expand from there if the interviewer wants more.&lt;/p&gt;

&lt;p&gt;It sounds small, but it changes how your answers come across a lot.&lt;/p&gt;

&lt;p&gt;At the end of the day, interviews are less about how much you know, and more about how clearly you can communicate it.&lt;/p&gt;

&lt;p&gt;If you're preparing for .NET interviews, this is something worth paying attention to.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>interview</category>
      <category>career</category>
    </item>
  </channel>
</rss>
