<?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: Christian Wolf</title>
    <description>The latest articles on DEV Community by Christian Wolf (@chaos0815).</description>
    <link>https://dev.to/chaos0815</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%2F122251%2F247abcd2-4ea1-4108-acb6-f82af401e276.jpg</url>
      <title>DEV Community: Christian Wolf</title>
      <link>https://dev.to/chaos0815</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chaos0815"/>
    <language>en</language>
    <item>
      <title>Don't name objects for what they are used for but for what they represent</title>
      <dc:creator>Christian Wolf</dc:creator>
      <pubDate>Mon, 14 Dec 2020 08:30:28 +0000</pubDate>
      <link>https://dev.to/chaos0815/don-t-name-objects-for-what-they-are-used-for-but-for-what-they-represent-3g5j</link>
      <guid>https://dev.to/chaos0815/don-t-name-objects-for-what-they-are-used-for-but-for-what-they-represent-3g5j</guid>
      <description>&lt;p&gt;When reviewing, I often come across code with a, let's say 'dubious' naming. &lt;/p&gt;

&lt;p&gt;When looking at the places where this code is integrated in, it becomes clear that the programmer had a concrete necessity and created a tool for it.&lt;/p&gt;

&lt;p&gt;Say, at one point we need to keep track how many foos the user entered for a given bar:&lt;br&gt;
Well, I need to count the foos in a bar so I'll just create a &lt;code&gt;FooCounter&lt;/code&gt;, it'll have an &lt;code&gt;addBars()&lt;/code&gt; method and, of course, a &lt;code&gt;countFoos()&lt;/code&gt; method.&lt;br&gt;
Oh, and I only need to count foos of certain bars, so I'll need a &lt;code&gt;hasBarBlurb()&lt;/code&gt; method to check if a certain bar is available.&lt;/p&gt;

&lt;p&gt;Ready. It all works. Great job done.&lt;/p&gt;

&lt;p&gt;Except, you really didn't create a &lt;code&gt;FooCounter&lt;/code&gt;. It's more of a &lt;code&gt;BarCollection&lt;/code&gt;, isn't it?&lt;/p&gt;

&lt;p&gt;I specifically noticed it when I saw the &lt;code&gt;countCurrentFoo(): FooCounter&lt;/code&gt; method. Why would a &lt;code&gt;count()&lt;/code&gt; method return anything else than an &lt;code&gt;int&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;Just rename &lt;code&gt;FooCounter&lt;/code&gt; to &lt;code&gt;BarCollection&lt;/code&gt;. The methods now make more sense (&lt;code&gt;FooCounter::countFoos()&lt;/code&gt;, a counter that counts? &lt;code&gt;BarCollection::countFoos()&lt;/code&gt;, yeah, count things in a collection, I've seen that!)&lt;/p&gt;

&lt;h3&gt;
  
  
  Naming is hard.
&lt;/h3&gt;

&lt;p&gt;It's totally fine starting to name things for what they are used for. Maybe you still have no clear idea where things are going with this new Object, so you gotta start somewhere.&lt;/p&gt;

&lt;p&gt;But later on, you should make sure things sound semantically correct and start renaming objects and methods.&lt;br&gt;
Be as close to spoken language as possible.&lt;/p&gt;

</description>
      <category>cleancode</category>
      <category>codequality</category>
    </item>
    <item>
      <title>How to keep events and their listeners organized?</title>
      <dc:creator>Christian Wolf</dc:creator>
      <pubDate>Mon, 06 Apr 2020 07:27:50 +0000</pubDate>
      <link>https://dev.to/chaos0815/how-to-keep-events-and-their-listeners-organized-588j</link>
      <guid>https://dev.to/chaos0815/how-to-keep-events-and-their-listeners-organized-588j</guid>
      <description>&lt;p&gt;Asking for a friend, obviously...&lt;/p&gt;

&lt;p&gt;Say, you a have a well kept legacy codebase with a nice framework in place. It's a rather big piece of monolithic glory. It's maintainable. We're well off.&lt;/p&gt;

&lt;p&gt;But the concept of triggers, events and listeners gains traction and now events and listeners are popping up left and right. (When all you have is a hammer...)&lt;/p&gt;

&lt;p&gt;Now, nobody is demonizing the concept of events and I... err, my friend has used events and listeners quite successfully. But this feeling of being flooded is setting in. You know, when you are not sure if you have seen that exact event message once or twice before. Are we having multiple messages for the same event in different places? Am I listening to the right event? &lt;/p&gt;

&lt;p&gt;So I was wondering if you guys have a strategy or style of documentation that would help keep things, at least apparently, organized.&lt;/p&gt;

</description>
      <category>events</category>
      <category>listener</category>
      <category>documentation</category>
    </item>
  </channel>
</rss>
