<?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: Schattian</title>
    <description>The latest articles on DEV Community by Schattian (@schattian).</description>
    <link>https://dev.to/schattian</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%2F218160%2Fbd44f236-cd0d-4378-85d0-dd23b9367813.jpeg</url>
      <title>DEV Community: Schattian</title>
      <link>https://dev.to/schattian</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/schattian"/>
    <language>en</language>
    <item>
      <title>Warnings are design errors</title>
      <dc:creator>Schattian</dc:creator>
      <pubDate>Sun, 27 Oct 2019 12:50:26 +0000</pubDate>
      <link>https://dev.to/schattian/warnings-are-design-errors-1poi</link>
      <guid>https://dev.to/schattian/warnings-are-design-errors-1poi</guid>
      <description>&lt;p&gt;What an opinionated sentence.&lt;/p&gt;

&lt;p&gt;Lemme explain: when I was starting, as the majority of us (I believe) I was obsessive to not have warnings on my dependencies/tools/whatever. &lt;/p&gt;

&lt;p&gt;Acquiring experience, and looking at the very big systems, &lt;strong&gt;warnings are everywhere&lt;/strong&gt;. Tons of them, on every: docker build, CLI tool, CI pipeline, etc.&lt;/p&gt;

&lt;p&gt;I was thinking a lot about how that can be real, with those &lt;strong&gt;"potential errors" everywhere, at every time, and all of the developers not paying attention to these&lt;/strong&gt; but trying at the same time to test the best way they can to be near zero errors in the runtime. &lt;/p&gt;

&lt;p&gt;Or the warnings aren't really "potential errors", or all the devs out there are badass (like those &lt;em&gt;my code is always great&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;Then, and googling about logging, I saw one &lt;a href="https://dave.cheney.net/2015/11/05/lets-talk-about-logging"&gt;post&lt;/a&gt; with a near POV, coming from the excellent &lt;a href="https://dave.cheney.net/"&gt;Dave Cheney blog&lt;/a&gt;, in which he said:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;... "Nobody needs a warning log. Setting the level to warning is an admission that you’re probably logging errors at warning level." ...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So there I started to see with a bit more hateful those logging levels. &lt;/p&gt;

&lt;p&gt;From then, and when I was working with 3rd party software, I was trying to see why the dev which created that piece includes that log at that level.&lt;/p&gt;

&lt;p&gt;For example, in the past week, I implemented the ELK stack (ElasticSearch, Logstash, Kibana), together with Filebeat and Redis, to centralize and visualize logs &lt;del&gt;isn't that irony?&lt;/del&gt;.&lt;/p&gt;

&lt;p&gt;Then, I received the first warning:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;2019-10-20T06:52:15.316-0700  WARN    beater/filebeat.go:152  Filebeat is unable to load the Ingest Node pipelines for the configured modules because the Elasticsearch output is not configured/enabled. If you have already loaded the Ingest Node pipelines or are using Logstash pipelines, you can ignore this warning.&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Yes, I was using Logstash pipelines.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Another example is the typical hardware related warnings, like &lt;br&gt;
&lt;code&gt;You are at 98% of RAM usage&lt;/code&gt; or similar.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What does make the number 98 that special? &lt;em&gt;You don't know if I want to use just half of the memory&lt;/em&gt; to have the capability to scale the execution or sth else... That's an INFO log.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or the typical Ruby on Rails warning &lt;code&gt;warning: already initialized constant X&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is a constant? It was initialized two times? Constants are constant, not runtime-only constant. It is an error.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, basically, those says: &lt;em&gt;"maybe you are wrong or maybe not. If not, ignore me"&lt;/em&gt;. &lt;br&gt;
This means: &lt;em&gt;"I think you are probably not smart enough to use my software."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But I'm not saying that all the warnings are done by people who think they're smarter than the rest. No.&lt;/p&gt;

&lt;p&gt;Remembering a general design principle &lt;strong&gt;"easy to use and hard to misuse"&lt;/strong&gt;, I think this problem came when the software you are building is not simple enough, or the API it uses isn't clear. &lt;/p&gt;

&lt;p&gt;From the &lt;strong&gt;ambiguous parameters in the config&lt;/strong&gt; to the very well-known &lt;strong&gt;nullable-only-if-you-know-what-you-are-doing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Then was when I realized that &lt;strong&gt;every warning is a design error&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Don't misunderstand me: design errors are always unwanted but that's the real world, and sometimes you have a schedule (or even simpler, you are lacking ideas to do it in another way) and a design error is the easiest/fastest ~not the only~ way to proceed.&lt;/p&gt;

&lt;p&gt;For me, &lt;strong&gt;warnings are to logging what dynamic typing is to type systems&lt;/strong&gt;. When you're using them, you feel that this isn't the best way to do it, but it allows you to skip tons of rules and just do things work.&lt;/p&gt;

</description>
      <category>warnings</category>
      <category>log</category>
      <category>errors</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
