<?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: Gabriel L</title>
    <description>The latest articles on DEV Community by Gabriel L (@galbedroid).</description>
    <link>https://dev.to/galbedroid</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235180%2F591bcf05-4264-40d2-963e-228f545f6122.png</url>
      <title>DEV Community: Gabriel L</title>
      <link>https://dev.to/galbedroid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/galbedroid"/>
    <language>en</language>
    <item>
      <title>Absolute Beginner Tips: Stop Returning Your Entire Entity</title>
      <dc:creator>Gabriel L</dc:creator>
      <pubDate>Wed, 25 Nov 2026 15:07:41 +0000</pubDate>
      <link>https://dev.to/galbedroid/absolute-beginner-tips-stop-returning-your-entire-entity-1lp6</link>
      <guid>https://dev.to/galbedroid/absolute-beginner-tips-stop-returning-your-entire-entity-1lp6</guid>
      <description>&lt;p&gt;We all did that in one of our first projects: returning the entire object. It was practical, easy, and straightforward.&lt;/p&gt;

&lt;p&gt;Until you reach a listing page.&lt;/p&gt;

&lt;p&gt;Suddenly, you have to send a huge box of data where 90% of it is useless. Sending the entire object is fine in some cases, but even then, you can trim it down a little if you think about what you actually need.&lt;/p&gt;

&lt;p&gt;In some cases, you don't even need to send a Model or a DTO. You can send just an integer to tell the frontend how many jobs are still pending or how many tasks have been completed.&lt;/p&gt;

&lt;p&gt;This makes communication between the server and client lighter.&lt;/p&gt;

&lt;p&gt;The main issue is usually lists. Sending an entire object for one or ten items might not cause any noticeable problems, but when you start dealing with hundreds or thousands of records, those unnecessary properties can become a problem.&lt;/p&gt;

&lt;p&gt;Everything boils down to one question: What do I want to show in this specific scenario?&lt;/p&gt;

&lt;p&gt;Here are a few examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Returning a smaller DTO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's say we have this Task model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Task&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="nc"&gt;Objectives&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;TaskStage&lt;/span&gt; &lt;span class="nc"&gt;Stage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;DateTime&lt;/span&gt; &lt;span class="nc"&gt;ToComplete&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nc"&gt;IsDeleted&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, it packs a lot of information. When displaying a list of tasks, the Objectives array might be one of the biggest sources of unnecessary data.&lt;/p&gt;

&lt;p&gt;So, let's trim it down:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReturnTaskForListDto&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;TaskStage&lt;/span&gt; &lt;span class="nc"&gt;Stage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;DateTime&lt;/span&gt; &lt;span class="nc"&gt;ToComplete&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, you don't need the Objectives array because you are only showing a list of tasks. You also don't need the Description or IsDeleted properties. After all, deleted tasks shouldn't even be part of this list.&lt;/p&gt;

&lt;p&gt;But what if you still want to give the user some information about the objectives?&lt;/p&gt;

&lt;p&gt;You can simply send an integer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReturnTaskForListDto&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;HowManyObjectives&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;TaskStage&lt;/span&gt; &lt;span class="nc"&gt;Stage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;DateTime&lt;/span&gt; &lt;span class="nc"&gt;ToComplete&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of sending the entire array, you only send the number of objectives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 2: Sometimes, you only need a number&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another example: what if you want to show the end user how many active tasks they have?&lt;/p&gt;

&lt;p&gt;Instead of sending the entire Model or even the DTO we created above, you can send just an integer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;howManyTasksActive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;IsDeleted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;howManyTasksActive&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There you go! Now you only need to send a single variable to the frontend.&lt;/p&gt;

&lt;p&gt;No need to send a whole collection of objects just to display a number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The idea is simple: don't send information just because it exists in your Model.&lt;/p&gt;

&lt;p&gt;Think about what the frontend actually needs in each scenario. Sometimes you need the entire object, sometimes a smaller DTO is enough, and sometimes a single integer does the job.&lt;/p&gt;

&lt;p&gt;This reduces unnecessary data transfer and keeps communication between your server and client more efficient.&lt;/p&gt;

&lt;p&gt;It's a small decision, but paying attention to these details is part of becoming a better developer.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Absolute Beginner Tips: DTOs Will Save You Time</title>
      <dc:creator>Gabriel L</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:44:25 +0000</pubDate>
      <link>https://dev.to/galbedroid/absolute-beginner-tips-dtos-will-save-you-time-182i</link>
      <guid>https://dev.to/galbedroid/absolute-beginner-tips-dtos-will-save-you-time-182i</guid>
      <description>&lt;p&gt;One thing I used to do in my first projects was using the base model to receive and send data.&lt;/p&gt;

&lt;p&gt;Of course, since my first projects were very small, I didn't really feel the need to use DTOs. However, one day, while studying this topic, I realized that using DTOs (Data Transfer Objects) is generally a better approach than using the base model directly.&lt;/p&gt;

&lt;p&gt;And there is more to it than just efficiency when working with DTOs.&lt;/p&gt;

&lt;p&gt;Some advantages are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance: One of the main benefits of DTOs is sending the right amount of data instead of the entire object. You can also combine them with specific database queries to avoid retrieving unnecessary information.&lt;/li&gt;
&lt;li&gt;Extra security: It is not a good idea to expose your base models directly to users. Doing so might expose information they shouldn't have access to and create security risks, especially when receiving data from external requests.&lt;/li&gt;
&lt;li&gt;Flexibility: You can have DTOs that aren't directly connected to any base model. They can exist just to send specific information that doesn't necessarily need an entire object behind it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples&lt;/p&gt;

&lt;p&gt;Let's imagine we have the following model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Question&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Guid&lt;/span&gt; &lt;span class="nc"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Topic&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Description&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;DateTime&lt;/span&gt; &lt;span class="nc"&gt;CreatedAt&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;DateTime&lt;/span&gt; &lt;span class="nc"&gt;UpdatedAt&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are some DTOs based on the model above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;//CreateQuestionDto&lt;/span&gt;

&lt;span class="c1"&gt;//There is no reason to receive the dates or the ID from the user when creating a question. The backend handles those values.&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CreateQuestionDto&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Topic&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Description&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;//ReturnQuestionDto&lt;/span&gt;

&lt;span class="c1"&gt;//This DTO contains the ID but doesn't include the dates, since they aren't necessary for this particular response.&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReturnQuestionDto&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Guid&lt;/span&gt; &lt;span class="nc"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Topic&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Description&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;//ReturnListQuestionDto&lt;/span&gt;

&lt;span class="c1"&gt;//This one is useful when returning a list of questions. Instead of sending all the information about every question, we can use a lightweight DTO containing only what is necessary for the list.&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReturnListQuestionDto&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Guid&lt;/span&gt; &lt;span class="nc"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Title&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Topic&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;//QuantityOfQuestionPerTopicDto&lt;/span&gt;

&lt;span class="c1"&gt;//This is an example of a DTO that isn't directly based on the Question model, its purpose is to return information about how many questions exist in each topic, without sending all the questions at once.&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;QuantityOfQuestionPerTopicDto&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Topic&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Quantity&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how each DTO has a different purpose, even though they are all related to the same Question model.&lt;/p&gt;

&lt;p&gt;These are just a few examples that can help you understand how to use DTOs in your projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AND ATTENTION:&lt;/strong&gt; Yes, AI can generate DTOs for you, but you still need to understand their structure so you can identify potential flaws and unnecessary properties. AI isn't perfect, and blindly accepting generated code can create problems.&lt;/p&gt;

&lt;p&gt;DTOs can also make frontend development easier because you don't need to accommodate unnecessary data or deal with properties that your components don't actually use.&lt;/p&gt;

&lt;p&gt;The main idea is simple: don't send the entire object just because you can. Send what your application actually needs.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Absolute Beginner Tips: CRUD Is a Template, Not the Law</title>
      <dc:creator>Gabriel L</dc:creator>
      <pubDate>Thu, 12 Nov 2026 15:54:55 +0000</pubDate>
      <link>https://dev.to/galbedroid/absolute-beginner-tips-crud-is-a-template-not-the-law-2g8o</link>
      <guid>https://dev.to/galbedroid/absolute-beginner-tips-crud-is-a-template-not-the-law-2g8o</guid>
      <description>&lt;p&gt;One of my biggest struggles when I first started developing projects for my portfolio was understanding that CRUD was a template, not a law. I remember starting my first dashboards using the same basic structure everywhere: GetAll, GetById, Create, Update, and Delete. And honestly, there is nothing wrong with that. It's a great starting point.&lt;/p&gt;

&lt;p&gt;However, as I progressed through my projects, I realized that not every endpoint needed to return an entire object. In one of my projects, I needed several additional GET endpoints, and some of them didn't need to return complete objects at all. They only needed to return a specific quantity, a count, or a small piece of information. This is where combining DTOs with more specific queries becomes really useful. Instead of retrieving an entire model from the database and sending all its information to the frontend, you can use a DTO to return only the data you actually need. This means less unnecessary data transfer, lighter responses, and potentially better performance.&lt;/p&gt;

&lt;p&gt;Another interesting case is the UPDATE operation. Updating an object doesn't always mean sending the entire model back and forth. Sometimes, you only need to update a specific part of it. You can create more specialized update operations instead of relying on one generic endpoint that handles every possible change. Yes, it takes a little more work to implement and maintain, but your application can benefit from more focused operations and less unnecessary processing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Practical Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's imagine a website where users can create posts. Each post can have two states: Draft and Published.&lt;/p&gt;

&lt;p&gt;You could start with something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Returns all posts without any filtering.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;getAllOfUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Returns all posts belonging to a specific user.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both methods work, but they return the entire Post model, even when the frontend doesn't need all that information.&lt;/p&gt;

&lt;p&gt;Instead, you can separate your endpoints based on what the frontend actually needs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;getAllOfUserDraftsForList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ListPostDto&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Returns lightweight DTOs containing only the necessary&lt;/span&gt;
    &lt;span class="c1"&gt;// information about the user's draft posts.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;getAllOfUserPublishedForList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ListPostDto&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Returns lightweight DTOs containing only the necessary&lt;/span&gt;
    &lt;span class="c1"&gt;// information about the user's published posts.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;getByIdOfUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;postId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ReturnPostDto&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Returns the post details needed when the user&lt;/span&gt;
    &lt;span class="c1"&gt;// wants to view or edit a specific post.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this approach, you have more control over the data flow. Your listing endpoints don't need to return the entire post content, metadata, and every other property. They only return what is necessary to display the list.&lt;/p&gt;

&lt;p&gt;When the user wants to see a specific post, you can provide a more complete DTO with all the information required for that operation. You can also optimize your database queries to retrieve only the columns you actually need instead of loading the entire entity every time.&lt;/p&gt;

&lt;p&gt;Of course, this doesn't mean you should create a different endpoint for every single situation. The idea is to understand what your frontend actually needs and design your API around those requirements.&lt;/p&gt;

&lt;p&gt;So, what's the lesson? Start with CRUD. It's a good template and gives you a solid foundation. But as your frontend evolves and your application becomes more complex, adapt your API to your actual needs. Don't be afraid to create specific endpoints, use DTOs, or rethink how your update operations work.&lt;/p&gt;

&lt;p&gt;The goal isn't to create as many endpoints as possible. It's to create endpoints that serve a clear purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CRUD is a template, not the law&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>api</category>
      <category>programming</category>
    </item>
    <item>
      <title>Hello DEV Community! I'm Gabriel, a Full Stack Developer 👋</title>
      <dc:creator>Gabriel L</dc:creator>
      <pubDate>Tue, 10 Nov 2026 15:40:15 +0000</pubDate>
      <link>https://dev.to/galbedroid/hello-dev-community-im-gabriel-a-full-stack-developer-a63</link>
      <guid>https://dev.to/galbedroid/hello-dev-community-im-gabriel-a-full-stack-developer-a63</guid>
      <description>&lt;p&gt;Hey everyone!&lt;/p&gt;

&lt;p&gt;I'm Gabriel, a Full Stack Developer from Brazil, and I've recently joined the DEV Community!&lt;/p&gt;

&lt;p&gt;I've been working with software development, mainly focusing on:&lt;/p&gt;

&lt;p&gt;C# and ASP.NET Core&lt;/p&gt;

&lt;p&gt;React.js and TypeScript&lt;/p&gt;

&lt;p&gt;SQL Server and Entity Framework Core&lt;/p&gt;

&lt;p&gt;REST API Development&lt;/p&gt;

&lt;p&gt;JWT Authentication and Authorization&lt;/p&gt;

&lt;p&gt;I enjoy building applications, solving technical challenges, and learning new technologies along the way.&lt;/p&gt;

&lt;p&gt;🚀 What am I currently working on?&lt;/p&gt;

&lt;p&gt;One of my recent portfolio projects is a Restaurant Management Dashboard built with React and ASP.NET Core.&lt;/p&gt;

&lt;p&gt;It includes features such as user management, authentication, product management, restaurant tables, orders, reservations, and business insights.&lt;/p&gt;

&lt;p&gt;I'm currently working on the frontend and looking forward to sharing more about the development process here.&lt;/p&gt;

&lt;p&gt;💻 Freelance Development&lt;/p&gt;

&lt;p&gt;Besides my regular software development work, I'm also starting to offer freelance services.&lt;/p&gt;

&lt;p&gt;I can help with:&lt;/p&gt;

&lt;p&gt;React bug fixing and improvements.&lt;/p&gt;

&lt;p&gt;ASP.NET Core REST API development.&lt;/p&gt;

&lt;p&gt;Backend troubleshooting.&lt;/p&gt;

&lt;p&gt;API integration.&lt;/p&gt;

&lt;p&gt;If you need help with a development project, you can find my freelance services here:&lt;/p&gt;

&lt;p&gt;👉 My Fiverr Profile: &lt;a href="https://www.fiverr.com/s/Bb8j8oG" rel="noopener noreferrer"&gt;https://www.fiverr.com/s/Bb8j8oG&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🤝 Let's Connect!&lt;/p&gt;

&lt;p&gt;I'm looking forward to meeting other developers, sharing experiences, learning from the community, and contributing whenever I can.&lt;/p&gt;

&lt;p&gt;Feel free to say hello or share what you're currently working on!&lt;/p&gt;

&lt;p&gt;Thanks for reading! 😊&lt;/p&gt;

</description>
      <category>freelance</category>
      <category>webdev</category>
      <category>dotnet</category>
      <category>react</category>
    </item>
    <item>
      <title>My Third Portfolio Project: Restaurant Management Dashboard (React + .NET)</title>
      <dc:creator>Gabriel L</dc:creator>
      <pubDate>Mon, 09 Nov 2026 15:18:58 +0000</pubDate>
      <link>https://dev.to/galbedroid/my-third-portfolio-project-restaurant-management-dashboard-react-net-1g7l</link>
      <guid>https://dev.to/galbedroid/my-third-portfolio-project-restaurant-management-dashboard-react-net-1g7l</guid>
      <description>&lt;p&gt;This is my third portfolio project, but the first one that really challenged me to put most of my backend and API development knowledge into practice.&lt;/p&gt;

&lt;p&gt;The project is a Restaurant Management Dashboard built with React and .NET.&lt;/p&gt;

&lt;p&gt;🚀 Project Goals&lt;/p&gt;

&lt;p&gt;One of my main goals was to create a modular system that gives restaurant managers control over different aspects of their business.&lt;/p&gt;

&lt;p&gt;The system allows managers to:&lt;/p&gt;

&lt;p&gt;Create and manage employee accounts, such as waiters and cashiers.&lt;/p&gt;

&lt;p&gt;Create and manage product categories.&lt;/p&gt;

&lt;p&gt;Register and manage products.&lt;/p&gt;

&lt;p&gt;Create and manage restaurant tables.&lt;/p&gt;

&lt;p&gt;Handle reservations.&lt;/p&gt;

&lt;p&gt;Manage product orders.&lt;/p&gt;

&lt;p&gt;I also wanted to include a management dashboard with business insights, such as the restaurant's best-selling products and most popular categories.&lt;/p&gt;

&lt;p&gt;⚙️ Technical Challenges&lt;/p&gt;

&lt;p&gt;On the backend, I worked with several concepts and technologies:&lt;/p&gt;

&lt;p&gt;ASP.NET Core REST APIs.&lt;/p&gt;

&lt;p&gt;JWT Authentication.&lt;/p&gt;

&lt;p&gt;Refresh Token implementation.&lt;/p&gt;

&lt;p&gt;Role-based authorization.&lt;/p&gt;

&lt;p&gt;Entity Framework Core.&lt;/p&gt;

&lt;p&gt;DTOs and manual object mapping.&lt;/p&gt;

&lt;p&gt;Business logic involving tables, products, and orders.&lt;/p&gt;

&lt;p&gt;One of my biggest challenges was implementing authentication and the refresh token flow.&lt;/p&gt;

&lt;p&gt;Another interesting learning experience was manual object mapping. Instead of relying on an existing paid mapping solution, I decided to implement the mappings myself to better understand how data transformation works between entities and DTOs.&lt;/p&gt;

&lt;p&gt;Using DTOs also helped reduce the amount of data returned by the API, making responses more focused on what the frontend actually needs.&lt;/p&gt;

&lt;p&gt;📌 Current Progress&lt;/p&gt;

&lt;p&gt;The backend is finished, and I'm currently working on the React frontend.&lt;/p&gt;

&lt;p&gt;Unfortunately, I haven't had as much time to work on the project recently due to my new job and university responsibilities.&lt;/p&gt;

&lt;p&gt;However, I'm looking forward to finishing it and sharing more about the development process here!&lt;/p&gt;

&lt;p&gt;This project has been a great learning experience, and I'm excited to see the final result.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>react</category>
      <category>dotnet</category>
      <category>api</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
