<?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 Gröber</title>
    <description>The latest articles on DEV Community by Christian Gröber (@christiangroeber).</description>
    <link>https://dev.to/christiangroeber</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%2F210158%2F9dbad57d-3a1d-4c6e-9ae8-d46c80af1046.jpg</url>
      <title>DEV Community: Christian Gröber</title>
      <link>https://dev.to/christiangroeber</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/christiangroeber"/>
    <language>en</language>
    <item>
      <title>A Social Media Platform Where You Aren't The Product</title>
      <dc:creator>Christian Gröber</dc:creator>
      <pubDate>Mon, 22 Feb 2021 17:19:17 +0000</pubDate>
      <link>https://dev.to/christiangroeber/a-social-media-platform-where-you-aren-t-the-product-p4g</link>
      <guid>https://dev.to/christiangroeber/a-social-media-platform-where-you-aren-t-the-product-p4g</guid>
      <description>&lt;p&gt;By now we all should have at least heard of the Netflix Movie "the social dilemma". In short, it's a documentary on how social media platforms like Twitter, Facebook, TikTok, Reddit and YouTube are optimized to be addictive, so that they can make more money, by showing us even more ads. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“If something's free then you aren't the customer, but the product."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, what if there was a social media platform that you would have to pay for in order to use it?&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://www.socialmediatoday.com/news/would-people-pay-to-use-social-media-platforms-to-avoid-data-sharing-info/575956/"&gt;this&lt;/a&gt; article, people would be willing to pay up to 5$ a month to use facebook + instagram.&lt;/p&gt;

&lt;p&gt;So the question is, do you believe it to be worth investing time and resources on building such a platform?&lt;/p&gt;

&lt;p&gt;Here are my personal Pro's and Con's, I'll gladly add yours as well:&lt;/p&gt;

&lt;h4&gt;
  
  
  Pro's
&lt;/h4&gt;

&lt;p&gt;+It's the goal of the Platform to connect you, not to get you addicted&lt;br&gt;
+Content could not be regulated by advertisers.&lt;/p&gt;

&lt;h4&gt;
  
  
  Con's
&lt;/h4&gt;

&lt;p&gt;-Hard to get paying userbase&lt;/p&gt;

&lt;h2&gt;
  
  
  Final words
&lt;/h2&gt;

&lt;p&gt;One last remark, this platform would only solve half of the problem. People could still get addicted, younger users might still define their self-worth by the amount of likes. But it would be a much more private platform than anything that exists at the time. If you have any interest in helping bootstrap such a site, please do leave a comment.&lt;/p&gt;

</description>
      <category>social</category>
      <category>privacy</category>
      <category>discuss</category>
    </item>
    <item>
      <title>On the journey to writing better comments</title>
      <dc:creator>Christian Gröber</dc:creator>
      <pubDate>Wed, 03 Feb 2021 13:20:38 +0000</pubDate>
      <link>https://dev.to/christiangroeber/on-the-journey-to-writing-better-comments-2137</link>
      <guid>https://dev.to/christiangroeber/on-the-journey-to-writing-better-comments-2137</guid>
      <description>&lt;p&gt;Tl;dr: Write them before writing the actual code&lt;/p&gt;

&lt;p&gt;You always hear how you should write more, better comments... But this is a habit we probably all struggle with&lt;/p&gt;

&lt;p&gt;A few days ago I was working on a function that I knew what it should do, which is to take an image at a specified path and create a copy of that image with a different width to a subfolder of the original image, the subfolder's name being the new width.&lt;/p&gt;

&lt;p&gt;Here is the base structure of this function (yes, I write PHP, sue me):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    public function compressImage(string $imagePath, int $size)
    {

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

&lt;/div&gt;



&lt;p&gt;I knew what the function should do, but didn't quite know how to make it do what I wanted to, so I jotted down my ideas in the form of comments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public function compressImage(string $imagePath, int $size)
    {
        // Find out path of original image
        // Scale down image
        // Create new path if it does not exist yet
        // Save scaled down version in new path
        // Return relative path to compressed Image
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this I managed to organize my mind. Next came the part of actually writing the code, which was now a lot easier because the comments told me, what I was supposed to do. This is the final function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public function compressImage(string $imagePath, int $size)
    {
        // Find out path of original image
        $originalImgPath = '';
        $splImgPath = explode('/', $imagePath);
        $fileName = array_pop($splImgPath);
        $originalImgPath = implode('/', $splImgPath);

        // Scale down image
        $imgObject = imagecreatefromstring(file_get_contents($imagePath));
        $scaled = imagescale($imgObject, $size);

        // Create new path if it does not exist yet
        if (!is_dir("${originalImgPath}/${size}")) {
            mkdir("${originalImgPath}/${size}", 0777, true);
        }

        // Save scaled down version in new path
        imagejpeg($scaled, "${originalImgPath}/${size}/${fileName}");

        return "${originalImgPath}/${size}/${fileName}";
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(&lt;em&gt;I was lucky because I could basically just copy the part of the actual scaling (&lt;code&gt;imagejpeg($scaled, "${originalImgPath}/${size}/${fileName}");&lt;/code&gt; from a function I'd written a few months ago, so it was pretty much straight-forward.&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;I hope you found this approach interesting and will be able to at least give it a try in one of your own projects. I would also be delighted to hear your ideas on how to write good comments.&lt;/p&gt;

&lt;p&gt;Lastly, I hope you have a lovely day, wherever you may be&lt;/p&gt;

</description>
      <category>comments</category>
    </item>
  </channel>
</rss>
