<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming Archives - Angry dev thoughts</title>
	<atom:link href="https://angry-dev-thoughts.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>https://angry-dev-thoughts.com/category/programming/</link>
	<description>Software developers are sometimes angry</description>
	<lastBuildDate>Sun, 02 Feb 2025 13:25:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://angry-dev-thoughts.com/wp-content/uploads/2024/09/cropped-android-chrome-512x512-3-32x32.png</url>
	<title>Programming Archives - Angry dev thoughts</title>
	<link>https://angry-dev-thoughts.com/category/programming/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to do performant count of child entities in rich entity with doctrine?</title>
		<link>https://angry-dev-thoughts.com/2025/02/02/how-to-do-performant-count-of-child-entities-in-rich-entity-with-doctrine/</link>
					<comments>https://angry-dev-thoughts.com/2025/02/02/how-to-do-performant-count-of-child-entities-in-rich-entity-with-doctrine/#respond</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Sun, 02 Feb 2025 13:25:06 +0000</pubDate>
				<category><![CDATA[Doctrine ORM]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Testing]]></category>
		<guid isPermaLink="false">https://angry-dev-thoughts.com/?p=80</guid>

					<description><![CDATA[<p>TLDR: Use Extra Lazy feature from Doctrine ORM: https://www.doctrine-project.org/projects/doctrine-orm/en/3.3/tutorials/extra-lazy-associations.html &#8212; Let&#8217;s imagine that we&#8217;re working on e-commerce platform. Each user can sold maximum 100 items How to do it properly? How to introduce domain limit on doctrine relationships? How can I introduce it? Let&#8217;s use rich entities (trying to follow Domain-Driven-Design and Test-Driven-Development rules): &#60;?php [&#8230;]</p>
<p>The post <a href="https://angry-dev-thoughts.com/2025/02/02/how-to-do-performant-count-of-child-entities-in-rich-entity-with-doctrine/">How to do performant count of child entities in rich entity with doctrine?</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>TLDR: Use Extra Lazy feature from Doctrine ORM: https://www.doctrine-project.org/projects/doctrine-orm/en/3.3/tutorials/extra-lazy-associations.html</p>



<p>&#8212;</p>



<p>Let&#8217;s imagine that we&#8217;re working on e-commerce platform. Each user can sold maximum 100 items How to do it properly? How to introduce domain limit on doctrine relationships? How can I introduce it? Let&#8217;s use rich entities (trying to follow Domain-Driven-Design and Test-Driven-Development rules):</p>



<pre class="wp-block-preformatted">&lt;?php

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'users')]
class User
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: 'integer')]
    private int|null $id = null;

    #[ORM\Column(type: 'string', length: 255)]
    private string $name;

    /** @var Collection&lt;int, Item&gt; */
    #[ORM\OneToOne(inversedBy: 'createdBy', targetEntity: Item::class)]
    private Collection $items;

    public function __construct(string $name)
    {
        $this-&gt;name = $name;
        $this-&gt;items = new ArrayCollection();
    }

    public function addItem(Item $item): void
    {
        $this-&gt;items[] = $item;
    }

    public function getItems(): Collection
    {
        return $this-&gt;items;
    }
}</pre>



<p>and item:</p>



<pre class="wp-block-code"><code>&lt;?php

use Doctrine\ORM\Mapping as ORM;

class Item
{
    #&#91;ORM\Id]
    #&#91;ORM\GeneratedValue]
    #&#91;ORM\Column(type: 'integer')]
    private int|null $id = null;

    #&#91;ORM\Column(type: 'string')]
    private string $description;

    #&#91;ORM\Column(type: 'integer')]
    private int $price;

    #&#91;ORM\ManyToOne(targetEntity: User::class, inversedBy: 'items')]
    private User $createdBy;

    public function __construct(string $description, int $price)
    {

    }

    public function setCreator(User $createdBy): void
    {
        $createdBy-&gt;addItem($this);
        $this-&gt;createdBy = $createdBy;
    }
}</code></pre>



<p>And basic test for that:</p>



<pre class="wp-block-code"><code>&lt;?php

namespace tests;

use Item;
use PHPUnit\Framework\TestCase;
use User;

final class ItemsLimitPerUserTest extends TestCase
{
    public function testItemsLimitPerUser(): void
    {
        $user = new User('John');
        $itemA = new Item('My aswesome item A', 20);
        $itemB = new Item('My aswesome item B', 20);
        $itemC = new Item('My aswesome item C', 20);

        $itemA-&gt;setCreator($user);
        $itemB-&gt;setCreator($user);
        $itemC-&gt;setCreator($user);

        $this-&gt;assertEquals(
            3,
            $user-&gt;getItems()-&gt;count()
        );
    }
}</code></pre>



<p>Now let&#8217;s add new test case that adding fourth item will fail (let&#8217;s set limit = 3). Basically we will implement items limit per user logic.</p>



<pre class="wp-block-preformatted">public function testItemsLimitPerUserIsMet(): void<br>{<br>    $user = new User('John');<br>    $itemA = new Item('My aswesome item A', 20);<br>    $itemB = new Item('My aswesome item B', 20);<br>    $itemC = new Item('My aswesome item C', 20);<br>    $itemD = new Item('My aswesome item D', 20);<br><br>    $itemA-&gt;setCreator($user);<br>    $itemB-&gt;setCreator($user);<br>    $itemC-&gt;setCreator($user);<br><br>    try {<br>        $itemD-&gt;setCreator($user);<br>    } catch (Exception $exception) {<br>        $this-&gt;assertInstanceOf(LimitMetException::class, $exception);<br>    }<br><br>    $this-&gt;assertEquals(<br>        3,<br>        $user-&gt;getItems()-&gt;count()<br>    );<br>}</pre>



<p>Which obviously will fail for that moment:</p>



<pre class="wp-block-code"><code>~/Development/doctrine-playground$ ./vendor/bin/phpunit tests
PHPUnit 11.5.6 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.27

.F                                                                  2 / 2 (100%)

Time: 00:00.007, Memory: 8.00 MB

There was 1 failure:

1) tests\ItemsLimitPerUserTest::testItemsLimitPerUserIsMet
Failed asserting that 4 matches expected 3.

/home/adt/Development/doctrine-playground/tests/ItemsLimitPerUserTest.php:48

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.
</code></pre>



<p>Now let&#8217;s try to implement this requirement (git diff): </p>



<pre class="wp-block-code"><code>diff --git a/src/User.php b/src/User.php
index ec83b61..d8dcde8 100644
--- a/src/User.php
+++ b/src/User.php
@@ -8,6 +8,8 @@ use Doctrine\ORM\Mapping as ORM;
 #&#91;ORM\Table(name: 'users')]
 class User
 {
+    public const ITEMS_LIMIT = 3;
+
     #&#91;ORM\Id]
     #&#91;ORM\GeneratedValue]
     #&#91;ORM\Column(type: 'integer')]
@@ -26,8 +28,15 @@ class User
         $this-&gt;items = new ArrayCollection();
     }
 
+    /**
+     * @throws LimitMetException
+     */
     public function addItem(Item $item): void
     {
+        if ($this-&gt;items-&gt;count() &gt;= self::ITEMS_LIMIT) {
+            throw new LimitMetException();
+        }
+
         $this-&gt;items&#91;] = $item;
     }
</code></pre>



<p>Now, all tests are passing:</p>



<pre class="wp-block-code"><code>~/Development/doctrine-playground$ ./vendor/bin/phpunit tests
PHPUnit 11.5.6 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.27

..                                                                  2 / 2 (100%)

Time: 00:00.003, Memory: 8.00 MB

OK (2 tests, 3 assertions)</code></pre>



<p>But we have one issue, during adding new item doctrine by default will load whole items collection. It&#8217;s not good to load it only to do the count. For that we can use Extra lazy feature from Doctrine ORM:</p>



<pre class="wp-block-code"><code>    /** @var Collection&lt;int, Item> */
    #&#91;ORM\OneToOne(inversedBy: 'createdBy', targetEntity: Item::class, fetch: 'EXTRA_LAZY')]
    private Collection $items;</code></pre>



<p>git diff:</p>



<pre class="wp-block-code"><code>diff --git a/src/User.php b/src/User.php
index d8dcde8..194fe67 100644
--- a/src/User.php
+++ b/src/User.php
@@ -19,7 +19,7 @@ class User
     private string $name;
 
     /** @var Collection&lt;int, Item> */
-    #&#91;ORM\OneToOne(inversedBy: 'createdBy', targetEntity: Item::class)]
+    #&#91;ORM\OneToOne(inversedBy: 'createdBy', targetEntity: Item::class, fetch: 'EXTRA_LAZY')]
     private Collection $items;</code></pre>



<p>Now doctrine won&#8217;t load all entities into memory to simply count them, it will do dedicate count SQL query. In that way you can introduce limit for really large entity collections and avoid hitting memory limit and performance issues.</p>
<p>The post <a href="https://angry-dev-thoughts.com/2025/02/02/how-to-do-performant-count-of-child-entities-in-rich-entity-with-doctrine/">How to do performant count of child entities in rich entity with doctrine?</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2025/02/02/how-to-do-performant-count-of-child-entities-in-rich-entity-with-doctrine/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>We should be able to write test for every bug reported showcasing bug</title>
		<link>https://angry-dev-thoughts.com/2025/01/08/we-should-be-able-to-write-test-for-every-bug-reported-showcasing-bug/</link>
					<comments>https://angry-dev-thoughts.com/2025/01/08/we-should-be-able-to-write-test-for-every-bug-reported-showcasing-bug/#respond</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Wed, 08 Jan 2025 12:08:34 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software development]]></category>
		<guid isPermaLink="false">https://angry-dev-thoughts.com/?p=75</guid>

					<description><![CDATA[<p>In my opinion if bug was reported by client then it shouldn’t happen again. Writing good test securing this is worth an effort in many cases. Even simpel unit test showcasing error (if it&#8217;s possible), then it&#8217;s worth to commit test case showing error, and now tests should fail. Then write fix and commit that, [&#8230;]</p>
<p>The post <a href="https://angry-dev-thoughts.com/2025/01/08/we-should-be-able-to-write-test-for-every-bug-reported-showcasing-bug/">We should be able to write test for every bug reported showcasing bug</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In my opinion if bug was reported by client then it shouldn’t happen again. Writing good test securing this is worth an effort in many cases. Even simpel unit test showcasing error (if it&#8217;s possible), then it&#8217;s worth to commit test case showing error, and now tests should fail. Then write fix and commit that, now tests should be green.</p>
<p>The post <a href="https://angry-dev-thoughts.com/2025/01/08/we-should-be-able-to-write-test-for-every-bug-reported-showcasing-bug/">We should be able to write test for every bug reported showcasing bug</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2025/01/08/we-should-be-able-to-write-test-for-every-bug-reported-showcasing-bug/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Starting development of new feature by creating new micro service does not make sense in most cases</title>
		<link>https://angry-dev-thoughts.com/2024/10/27/starting-development-of-new-feature-by-creating-new-micro-service-does-not-make-sense-in-most-cases/</link>
					<comments>https://angry-dev-thoughts.com/2024/10/27/starting-development-of-new-feature-by-creating-new-micro-service-does-not-make-sense-in-most-cases/#respond</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Sun, 27 Oct 2024 14:37:01 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software development]]></category>
		<guid isPermaLink="false">https://angry-dev-thoughts.com/?p=69</guid>

					<description><![CDATA[<p>I think it&#8217;s better to develop core/monolith part and then split it to the microservice if the feature would needed it (high usage, a lot of data, high frequency of changes). In general I don&#8217;t think so there should be auto rules, like new service = new microservice.</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/27/starting-development-of-new-feature-by-creating-new-micro-service-does-not-make-sense-in-most-cases/">Starting development of new feature by creating new micro service does not make sense in most cases</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I think it&#8217;s better to develop core/monolith part and then split it to the microservice if the feature would needed it (high usage, a lot of data, high frequency of changes).</p>



<p>In general I don&#8217;t think so there should be auto rules, like new service = new microservice.</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/27/starting-development-of-new-feature-by-creating-new-micro-service-does-not-make-sense-in-most-cases/">Starting development of new feature by creating new micro service does not make sense in most cases</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2024/10/27/starting-development-of-new-feature-by-creating-new-micro-service-does-not-make-sense-in-most-cases/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to make PHP session sticky/auto renew on last activity</title>
		<link>https://angry-dev-thoughts.com/2024/10/20/how-to-make-php-session-sticky-auto-renew-on-last-activity/</link>
					<comments>https://angry-dev-thoughts.com/2024/10/20/how-to-make-php-session-sticky-auto-renew-on-last-activity/#comments</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Sun, 20 Oct 2024 14:50:09 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software development]]></category>
		<guid isPermaLink="false">https://angry-dev-thoughts.com/?p=66</guid>

					<description><![CDATA[<p>Let&#8217;s talk about php session life managment. What if we want to set it to autorenew based on last activity? How can I do it? Set PHP sesion cookie to be session (session.cookie_lifetime = 0) + set garbage collection time which is calculated since last session_start() [by setting session.gc_maxlifetime=3600 to have session valid for one [&#8230;]</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/20/how-to-make-php-session-sticky-auto-renew-on-last-activity/">How to make PHP session sticky/auto renew on last activity</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Let&#8217;s talk about php session life managment. What if we want to set it to autorenew based on last activity? How can I do it? Set PHP sesion cookie to be session (<code>session.cookie_lifetime = 0</code>) + set garbage collection time which is calculated since last session_start() [by setting session.gc_maxlifetime=3600 to have session valid for one hour since last activity]. I&#8217;m taking about those two settings</p>



<pre class="wp-block-code"><code> session.cookie_lifetime int</code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means &#8220;until the browser is closed.&#8221; Defaults to 0.</p>



<p><a href="https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime">https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime</a></p>
</blockquote>



<pre class="wp-block-code"><code> session.gc_maxlifetime int </code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>session.gc_maxlifetime specifies the number of seconds after which data will be seen as &#8216;garbage&#8217; and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor). Defaults to 1440 (24 minutes).</p>



<p><a href="https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime">https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime</a></p>
</blockquote>



<p>Sometimes I see that people set PHP session cookie lifetime however it does not increase security and only annoys people. Like if set expiration to 24h then when you logged on at 10 AM you will be logged out at 10 AM next day, no matter what.</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/20/how-to-make-php-session-sticky-auto-renew-on-last-activity/">How to make PHP session sticky/auto renew on last activity</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2024/10/20/how-to-make-php-session-sticky-auto-renew-on-last-activity/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>I don&#8217;t believe dependency inversion princpile makes sense in most cases</title>
		<link>https://angry-dev-thoughts.com/2024/10/13/i-dont-believe-dependency-inversion-princpile-makes-sense-in-most-cases/</link>
					<comments>https://angry-dev-thoughts.com/2024/10/13/i-dont-believe-dependency-inversion-princpile-makes-sense-in-most-cases/#respond</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Sun, 13 Oct 2024 12:01:43 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software development]]></category>
		<guid isPermaLink="false">https://angry-dev-thoughts.com/?p=56</guid>

					<description><![CDATA[<p>I often see that following dependency inversion principle (from SOLID) we end up with many interfaces with just one implementation, and what is more it&#8217;s usually whole public API of given class. In my opinion it doesn&#8217;t make sense. However I do believe in original purpose of this rule. Like the example of deploying embedded [&#8230;]</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/13/i-dont-believe-dependency-inversion-princpile-makes-sense-in-most-cases/">I don&#8217;t believe dependency inversion princpile makes sense in most cases</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I often see that following dependency inversion principle (from SOLID) we end up with many interfaces with just one implementation, and what is more it&#8217;s usually whole public API of given class. In my opinion it doesn&#8217;t make sense. However I do believe in original purpose of this rule. Like the example of deploying embedded system, when you can recompile and send through wire less data because you applied interface.</p>



<h2 class="wp-block-heading">So, we should avoid interfaces with one implementation, right?</h2>



<p>From my experience interfaces with one implementation should be avoided. I sometimes hear this explanations from people adding interface with one implementation:</p>



<ul class="wp-block-list">
<li><em>when I have inerfaces (even with one implementation) code is decoupled</em> &#8211; seriously? Adding interfaces changes anything? In my opinion no. If there is need for coupling and there is coupling in real life then it probably should be depicted in the code.</li>



<li><em>when I have inerfaces (even with one implementation) testing is easier</em> &#8211; I can agree with that, however when I saw code people stating that in tests I did not see implementation of this interface Like<em> RepositoryInterface </em>and <em>InMemoryRepository implements RepositoryInterface</em>, and what they do is just creating another mock with mocking library</li>



<li><em>when I have inerfaces (even with one implementation) when I will need second implementation it will be easier</em>  &#8211; happend zero times in my over 10 years experience. Usually abstraction that you will make based on one case won&#8217;t fit more cases. That is why I propose to wait with creating abstractions till you will be able to notice the pattern (at least 3 cases)</li>



<li><em>when I have inerfaces (even with one implementation) it isolates parts of the system</em> &#8211; I can sometimes agree, but usually what I see is the interface that contains whole public API of given class and what is more is changed with the same pace as given concrete class (bruh)</li>
</ul>



<h2 class="wp-block-heading">So what&#8217;s wrong with interface with one implementation?</h2>



<p>In my opinion the less code we write the better, so I don&#8217;t like interfaces with one implementation because:</p>



<ul class="wp-block-list">
<li>they make navigation trough code harder,</li>



<li>you have more code,</li>



<li>they hide real dependency even if there is only one implementation</li>
</ul>



<h2 class="wp-block-heading">So when to use interface?</h2>



<p>From my experience creating abstraction is really hard. That is why I advice to wait till more cases, so you can notice and validate pattern. In general I think that creating interfaces with one implementation is  misinterpeetation of DIP from SOLID, here is quote from Uncle Bob:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The need to mock every class interaction forces an explosion of polymorphic interfaces. In statically typed languages like Java, that means the creation of lots of extra interface classes whose sole purpose is to allow mocking. This is over-abstraction and the dreaded “design damage”.</p>



<p><a href="https://blog.cleancoder.com/uncle-bob/2014/05/10/WhenToMock.html">https://blog.cleancoder.com/uncle-bob/2014/05/10/WhenToMock.html</a></p>
</blockquote>



<p></p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/13/i-dont-believe-dependency-inversion-princpile-makes-sense-in-most-cases/">I don&#8217;t believe dependency inversion princpile makes sense in most cases</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2024/10/13/i-dont-believe-dependency-inversion-princpile-makes-sense-in-most-cases/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Estimating stories using story points with Fibonacci sequence doesn’t make sense.</title>
		<link>https://angry-dev-thoughts.com/2024/10/06/estimating-story-points-with-fibonacci-doesnt-make-sense/</link>
					<comments>https://angry-dev-thoughts.com/2024/10/06/estimating-story-points-with-fibonacci-doesnt-make-sense/#respond</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Sun, 06 Oct 2024 11:46:28 +0000</pubDate>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software development]]></category>
		<guid isPermaLink="false">https://angry-dev-thoughts.com/?p=46</guid>

					<description><![CDATA[<p>Did you hear about estimating stories in story points with Fibonacci? Yeah, it may sound fancy, but it is a nightmare in implementations that I saw like you use 1, 2, 3, 5, 8,1 3, and 21 values to estimate your tasks. Then what’s more funny scrum master tends to sum up them and calculate [&#8230;]</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/06/estimating-story-points-with-fibonacci-doesnt-make-sense/">Estimating stories using story points with Fibonacci sequence doesn’t make sense.</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Did you hear about estimating stories in story points with Fibonacci? Yeah, it may sound fancy, but it is a nightmare in implementations that I saw like you use 1, 2, 3, 5, 8,1 3, and 21 values to estimate your tasks. Then what’s more funny scrum master tends to sum up them and calculate the average per sprint/per quarter! Like you have no relative scale and you’re trying to do an average that requires values to be relative to each other. For example if you have one task estimated as 3 story points and three tasks for 1 story points it&#8217;s usually like task for 3 story points takes much more time than those three smaller ones together.</p>



<p>I think it is sometimes proposed and forced <a href="https://angry-dev-thoughts.com/2024/09/29/non-tech-scrum-master-is-scam/" data-type="post" data-id="41">by non-tech scrum masters</a>, because they think it needs to be that way. It annoys me. It does not have to be like that.</p>



<p>I really prefer to have a linear scale (with step 1), like:</p>



<ul class="wp-block-list">
<li>1 story point &#8211; around 1 day of development</li>



<li>2 story points &#8211; around 2 days of development</li>



<li>3 story points &#8211; around 3 days of development</li>



<li>4 story points &#8211; around 4 days of development</li>
</ul>



<p>etc. In that way you can really see how much work will fit into sprit.</p>



<h2 class="wp-block-heading">Do not estimate bugs</h2>



<p>Sometimes I hear do not estimate bugs &#8211; and I always think WTF? Without estimating bugs you&#8217;re not able to asses how many of them you are able to take into sprint. Something different is to fix bug that wrong image is shown and something different is to track why wrong price is calculated at the end of quarter. So it should be visible, how much do you expect them to differ. In my opinion esimating bugs is just fine</p>



<h2 class="wp-block-heading">Average story points per sprint</h2>



<p>With usage of story points constrained to values from fibonacci sequence you cannot do regular maths on that numbers. Why? Because they are not proportional. So using arithmetic mean will not give you reliable results. Probably you heard many times why this time we planned sprint using artiehmetic mean from pasts sprints and we still did not deliver all stories. Sounds familiar?</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/10/06/estimating-story-points-with-fibonacci-doesnt-make-sense/">Estimating stories using story points with Fibonacci sequence doesn’t make sense.</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2024/10/06/estimating-story-points-with-fibonacci-doesnt-make-sense/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>I don&#8217;t think that unit test with mocking everything around is good idea</title>
		<link>https://angry-dev-thoughts.com/2024/09/19/i-dont-think-that-unit-test-with-mocking-everything-around-is-good-idea/</link>
					<comments>https://angry-dev-thoughts.com/2024/09/19/i-dont-think-that-unit-test-with-mocking-everything-around-is-good-idea/#respond</comments>
		
		<dc:creator><![CDATA[angryDev]]></dc:creator>
		<pubDate>Thu, 19 Sep 2024 20:10:23 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Testing]]></category>
		<guid isPermaLink="false">http://angry-dev-thoughts.com/?p=1</guid>

					<description><![CDATA[<p>I think that we should not test unit as class, but as large class group as possoble without mocks. </p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/09/19/i-dont-think-that-unit-test-with-mocking-everything-around-is-good-idea/">I don&#8217;t think that unit test with mocking everything around is good idea</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="has-text-align-left">I think that we should not treat unit as class, but as large class group as possible without mocks. Plus mocks supposed to be used for things that are outside of given process memory (like databases, 3rd party API calls). Sometimes when I see too many mocks it looks for me as we would test our mocks, instead of code</p>



<p>At the same time I don&#8217;t believe that we should blindly follow 100% of code coverage. As a result we can see test which tests if programming language works. Sometimes making tests testing line by line what our code does.</p>



<p>Creating many mocks makes refactoring harder, and having 1:1 test -&gt; production relation doesn&#8217;t help.</p>



<p>In addition having 1:1 to test =&gt; production code relation can create so many test cases that they are will be slower than unit tests of groups of classes (ie Angular testing)</p>



<p>As a rule of thumb I prefer to write tests that can test as much production code as possible. So to have:</p>



<p>(lines of production code tested) / (lines of code test) ratio as high as possible.</p>



<p>And I call this test effectiveness ratio (TER).</p>



<h2 class="wp-block-heading">Many mocks make refactoring harder</h2>



<p>I do not like mocking, because extensive mocking leads to situation that with every change in code you need to change many mocks. Ideal situation for me is I can do refactor without touching tests (because I did not change behaviour)</p>
<p>The post <a href="https://angry-dev-thoughts.com/2024/09/19/i-dont-think-that-unit-test-with-mocking-everything-around-is-good-idea/">I don&#8217;t think that unit test with mocking everything around is good idea</a> appeared first on <a href="https://angry-dev-thoughts.com">Angry dev thoughts</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://angry-dev-thoughts.com/2024/09/19/i-dont-think-that-unit-test-with-mocking-everything-around-is-good-idea/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
