<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Felix Jung on Medium]]></title>
        <description><![CDATA[Stories by Felix Jung on Medium]]></description>
        <link>https://medium.com/@felix.jung?source=rss-3a066a556dc7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FU6WlvrWPSiKzef9m_rq5Q.png</url>
            <title>Stories by Felix Jung on Medium</title>
            <link>https://medium.com/@felix.jung?source=rss-3a066a556dc7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:29:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@felix.jung/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Custom iTerm2 titlebar background colors]]></title>
            <link>https://medium.com/code-matters/custom-iterm2-titlebar-background-colors-a088c6f2ec60?source=rss-3a066a556dc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a088c6f2ec60</guid>
            <category><![CDATA[themes]]></category>
            <category><![CDATA[iterm2]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Felix Jung]]></dc:creator>
            <pubDate>Wed, 14 Jun 2017 20:14:32 GMT</pubDate>
            <atom:updated>2018-09-30T15:12:36.562Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Update (Sep 30th, 2018)<br></strong>A lot has changed since I wrote this post. The settings described below do not work in macOS High Sierra. Now with some updates to iTerm2 and macOS Mojave, much more is possible. I have documented the changes <a href="https://www.felixjung.io/posts/pretty-iterm2-with-a-modern-titlebar">on my personal blog</a>. If you follow that post, you will get something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PS-lOKRBOzqQOYeXn7WZ5w.jpeg" /><figcaption>Check out my <a href="https://www.felixjung.io/posts/pretty-iterm2-with-a-modern-titlebar">new post</a> do get your iTerm2 to look like in this screenshot.</figcaption></figure><p>If you are like me, you get pretty obsessed about the look and feel of your development environment. It’s such a productivity waste, but I am a sucker for nice looking apps. After all, as a dev, you look at this stuff all day.</p><p>Over the past years, Electron apps have become all the rage. If you look at a typical JavaScript dev’s development environment these days, you will probably notice them running either <a href="https://atom.io/">Atom</a> or <a href="https://code.visualstudio.com/">Visual Studio Code</a> (VS Code) for their editor and <a href="https://hyper.is/">Hyper</a> for their terminal emulator. In particular VS Code seems to have become the default editor for most. Personally, I do not really like the look of VS Code. Yes, it has made a lot of progress and there are some cool themes, but to me, it still really looks like a Microsoft product. At least as soon as you start digging a level deeper. Atom and Hyper on the other hand, not so much. Look at these two beautiful apps next to each other. They are 🔥🔥🔥🔥.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uShsnqQPAZHNgke8KEzBKA.png" /><figcaption>Atom on the left, Hyper on the right. Two beautiful Electron apps.</figcaption></figure><p>Sadly, though, I cannot get myself to use these apps for work. I am used to <a href="https://neovim.io/">Neovim</a>/Vim and Atom’s model for splits is way too different. It just does not feel right. And while Hyper is beautiful and its plugin system rocks, as soon as I try to run Vim in it, I start noticing all kinds of performance related glitches and lag. On top of all of that, these Electron apps just take too much of my system’s resources. Today, I noticed Atom causing 150% CPU load when I was scrolling its settings screen. <em>Scrolling</em>. Both apps regularly take up gigabytes of memory.</p><p>So, I am stuck with my iTerm2, tmux, Neovim combo, which is not easy to get to look really nice. With enough patience and determination, I think I ended up with a nicely looking setup (getting theme colors to work has become a lot easier thanks to <a href="https://gist.github.com/XVilka/8346728">True Color</a> support across the stack). You be the judge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zItBu4OKrETwYJ3FyuqXEQ.png" /><figcaption>Neovim on the left, terminal on the right, all running inside a tmux session in iTerm2.</figcaption></figure><p>However, one thing that always bothered me was iTerm’s grey titlebar. In the nightly builds, George Nachman has added support for macOS’ dark mode for the titlebar. This is nice, but still does not look as beautiful as Hyper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLXYMoG1pixGCtVYvcbpyw.png" /><figcaption>iTerm2 with dark titlebar left, Hyper on the right.</figcaption></figure><p>Recently, I finally — by accident — found a solution to this problem. 🎉 Turns out, iTerm2 supports some <a href="https://www.iterm2.com/documentation-escape-codes.html">proprietary escape codes</a> for overwriting certain settings. And yes, there are codes to change the titlebar background color!</p><p>Here is how to set the titlebar color to the background of the <a href="https://github.com/joshdick/onedark.vim/blob/master/term/One%20Dark.itermcolors">iTerm2 One Dark</a> theme I am using. Type the following into your iTerm2 terminal.</p><pre>$ echo -e &quot;\033]6;1;bg;red;brightness;40\a&quot;<br>$ echo -e &quot;\033]6;1;bg;green;brightness;44\a&quot;<br>$ echo -e &quot;\033]6;1;bg;blue;brightness;52\a&quot;</pre><p>This is what it looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6c6PC1TGhHQGkqw4WS_aRA.png" /><figcaption>iTerm2 with custom titlebar background.</figcaption></figure><p>Finally. iTerm will not save this to your settings. The solution is to automatically execute the above commands when launching a new session. Just add them to your .bashrc or .zshrc, etc.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a088c6f2ec60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-matters/custom-iterm2-titlebar-background-colors-a088c6f2ec60">Custom iTerm2 titlebar background colors</a> was originally published in <a href="https://medium.com/code-matters">Code matters</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test-driving Prepack with webpack 2]]></title>
            <link>https://medium.com/code-matters/test-driving-prepack-with-webpack-2-baf96e51e64d?source=rss-3a066a556dc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/baf96e51e64d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webpack-2]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[prepack]]></category>
            <dc:creator><![CDATA[Felix Jung]]></dc:creator>
            <pubDate>Mon, 05 Jun 2017 21:56:57 GMT</pubDate>
            <atom:updated>2017-06-06T07:40:27.386Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PcY0rzt8Vs-Kc9ZSitz9iA.jpeg" /></figure><p>About a month ago, Facebook announced <a href="https://prepack.io/">Prepack</a>, a build tool that optimizes JavaScript for faster runtime execution. It does so by replacing any computations known at “compile time” with their result. Here’s an example from the Prepack webiste:</p><pre>// Input<br>(function () {<br>  function hello() { return &#39;hello&#39;; }<br>  function world() { return &#39;world&#39;; }<br>  global.s = hello() + &#39; &#39; + world();<br>})();<br><br>// Output<br>(function () {<br>  s = &quot;hello world&quot;;<br>})();</pre><p>Prepack still has a very long way to go before becoming production-ready for your average single-page application code. For example, at the moment, it is completely unaware of its environment. In the browser, document and window would evaluate to undefined, if you do not provide what the Prepack folks call a “model”.</p><p>However, that did not stop my colleagues at <a href="https://twitter.com/sumupeng">@SumUpEng</a> and myself from taking Prepack for a spin in our Dashboard application — just to see what it would do in terms of performance.</p><h4>Setting up Prepack with webpack 2</h4><p>Turns out, there is a <a href="https://github.com/gajus/prepack-webpack-plugin">webpack 2 plugin</a> that came out shortly after Prepack was announced. All you have to do is to instantiate the plugin with a configuration object (possibly empty) and add it to the plugins property of your webpack config.</p><pre>import PrepackWebpackPlugin from ‘prepack-webpack-plugin’;</pre><pre>module.exports = (env) =&gt; ({<br>  // ...<br>  plugins: [<br>    new PrepackWebpackPlugin({})<br>  ]<br>});</pre><p>One thing to note is that this plugin <a href="https://github.com/gajus/prepack-webpack-plugin/issues/11">will not work properly</a> when you run it after the UglifyJS plugin. So make sure to position it before UglifyJS in the plugins array.</p><h4>What we learned</h4><p>After doing some <em>very</em> casual tests loading a build of the Dashboard without and one with the Prepack webpack plugin, I was somewhat surprised. The overall size of the application had gone from 4.9MB for 5MB. Say what? I thought this was supposed to optimize our app? Why did it get bigger?</p><p>Luckily, my colleagues and I were at <a href="https://twitter.com/jsconfeu?lang=en">@jsconfeu</a> when we made this experiment. So I walked over to Facebook’s <a href="https://medium.com/u/9ea60eb6fc7c">Christoph Pojer</a> and some of his fellow engineers to figure out what was going on. And while these guys do not work on Prepack, they were quick to help me overcome some misconceptions I had.</p><p>Being a tool for optimizing runtime performance, Prepack does not care about file size! The only thing it should care about is making the code run faster inside the JavaScript VM. This means: simple instructions (i.e. a lot of simple assignments) and — in some cases — long computation results instead of the original computation code. Here is an example where Prepack will create significantly more code. You can go to the <a href="https://prepack.io/repl.html">interactive repl</a> on prepack.io to try it out live.</p><pre>/**<br> * Input @ 262 characters, measured by running<br> * `wc -c prepack-example.js`.<br> **/</pre><pre>const names = [<br>  &#39;Han&#39;, &#39;Leia&#39;, &#39;Luke&#39;, &#39;Obi-Wan&#39;,<br>  &#39;Anakin&#39;, &#39;Jyn&#39;, &#39;Rey&#39;, &#39;Finn&#39;<br>]</pre><pre>function sayHello(name) {<br>  return `Hello ${name}! It is very nice to meet you. How are you doing?`<br>}</pre><pre>const greetAll = names.map(sayHello).join(&#39;\n&#39;)</pre><pre>console.log(greetAll)</pre><pre>/*<br> * Prepack output @ 663 characters, measured by running<br> *<br> * prepack hello-star-wars.js \<br> *   --out hello-star-wars-prepacked.js \<br> *   &amp;&amp; wc -c hello-star-wars-prepacked.js<br> *<br> **/</pre><pre>var sayHello;</pre><pre>(function () {<br>  function _0(name) {<br>    return `Hello ${name}! It is very nice to meet you. How are you doing?`;<br>  }</pre><pre>sayHello = _0;<br>  console.log(&quot;Hello Han! It is very nice to meet you. How are you doing?\nHello Leia! It is very nice to meet you. How are you doing?\nHello Luke! It is very nice to meet you. How are you doing?\nHello Obi-Wan! It is very nice to meet you. How are you doing?\nHello Anakin! It is very nice to meet you. How are you doing?\nHello Jyn! It is very nice to meet you. How are you doing?\nHello Rey! It is very nice to meet you. How are you doing?\nHello Finn! It is very nice to meet you. How are you doing?&quot;);<br>})();</pre><p>Optimizing the example code using Prepack, we end up with a wooping <strong>663</strong> characters instead of the original 262.</p><blockquote>The time the VM spends parsing your bundle before anything happens seems like a big topic right now.</blockquote><p>What does this mean for your application? Should you use Prepack or not, once it becomes ready for production? The answer will probably end up being: “it depends”. At least that’s what the conversation with <a href="https://medium.com/u/9ea60eb6fc7c">Christoph Pojer</a> and colleagues came down to.</p><p>Here is why. The size of your bundle is most likely the biggest factor in how quickly your users will be able to interact with the page. However, the time the browser spends parsing your code before it can execute might add significantly to that time. Parsing performance seems like a big topic right now. <a href="https://medium.com/u/2508e4c7a8ec">Addy Osmani</a> <a href="https://youtu.be/7vUs5yOuv-o?t=23m10s">touched on it</a> at JSConf EU and <a href="https://twitter.com/marjakh">Marja Hölttä</a> <a href="https://youtu.be/Fg7niTmNNLg">gave an entire talk</a> about how Chrome parses JavaScript. If the parsing time you save by optimizing with Prepack outweighs any additional load time due to an increased bundle size, it is worth using Prepack. Otherwise, probably not.</p><p>Personally, I was not aware of these performance implications. And having focussed so much on chunk sizes in the build output (see my post on <a href="https://codematters.blog/upgrading-to-webpack-2-fc09bd8adbd4">upgrading to webpack 2</a> for more details on the topic), I had totally missed the point of Prepack. After some conversations on the topic with other developers, it seems I was not the only one, though.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baf96e51e64d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-matters/test-driving-prepack-with-webpack-2-baf96e51e64d">Test-driving Prepack with webpack 2</a> was originally published in <a href="https://medium.com/code-matters">Code matters</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upgrading to webpack 2]]></title>
            <link>https://medium.com/code-matters/upgrading-to-webpack-2-fc09bd8adbd4?source=rss-3a066a556dc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc09bd8adbd4</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[build-tool]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Felix Jung]]></dc:creator>
            <pubDate>Tue, 21 Mar 2017 22:00:38 GMT</pubDate>
            <atom:updated>2017-03-21T22:02:31.052Z</atom:updated>
            <content:encoded><![CDATA[<h3>Upgrading to webpack 2 — what I learned along the way</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlGeNHsSLwmNrtUAB0WPdQ.png" /></figure><p>I upgraded our Angular 1.6 app at work from webpack 1 to webpack 2, mainly for two reasons:</p><ol><li>We moved from a gulp based monolithic build to webpack in summer, 2015, and did not update the configuration much after. Since then, a lot of things have changed and new best practices have emerged. With the upgrade to webpack 2 I also wanted to optimize our build in ways that were already possible with webpack 1.</li><li>Webpack 2 enables you to apply a technique called tree-shaking, which should reduce the overall build size. Who would not want that?</li></ol><p>This post documents the changes I made to our build and what I learned along the way. I assume that you are familiar with webpack and some of its key concepts like entries, loaders, plugins, and chunks. If not, I highly recommend <a href="https://leanpub.com/survivejs-webpack">SurviveJS — webpack</a> by <a href="https://github.com/bebraw">Juho Vepsäläinen</a>, a webpack core team member. You can also find a great getting started guide in the <a href="https://webpack.js.org/guides/get-started/">guides section</a> of the <a href="https://webpack.js.org/">new webpack website</a>. While I was working on this post, <a href="https://medium.com/u/10baa568c50a">Adam Rackis</a> wrote a <a href="https://medium.com/@adamrackis/vendor-and-code-splitting-in-webpack-2-6376358f1923#.pyuadzo48">great post</a> on code splitting with webpack 2. It helped me improve our build even further.</p><h3>Why upgrade to webpack 2</h3><p>Tobias Koppers (a.k.a <a href="https://github.com/sokra">@sokra</a>), the creator of Webpack, published a <a href="https://gist.github.com/sokra/27b24881210b56bbaff7">gist of changes</a> in webpack 2, some time ago. While this gist is not up-to-date, it should contain most reasons why upgrading to webpack 2 might be a good idea. <a href="https://medium.com/u/393110b0b9e4">Sean T. Larkin</a> of the webpack core-team also published <a href="https://medium.com/webpack/webpack-2-and-beyond-40520af9067f#.y5489bb6z">this blog post</a>, listing reasons to upgrade.</p><p>Webpack 2 does offer some nice features like support for the <a href="http://www.2ality.com/2017/01/import-operator.html">ECMAScript (ES) dynamic import spec</a> using the import() operator. This can be seen as a less powerful, but potentially more elegant, replacement for <a href="https://webpack.js.org/guides/code-splitting-require/">webpack’s </a><a href="https://webpack.js.org/guides/code-splitting-require/">require.ensure()</a>.</p><p>The big new feature in Webpack 2, however, is native support for ES6 modules, facilitating the above-mentioned <em>tree-shaking</em> technique. I will discuss this in more detail in a subsequent section. But, essentially, this allows webpack to drop unused exports from ES6 modules. The result are smaller chunks and <strong>shorter load times</strong>. 🚀</p><h4>Starting point</h4><p>Here is where I started from:</p><ul><li>Roughly 37,000 lines of JavaScript. Specifically, Angular 1.6 with a lot of inline templates, written in ES6.</li><li>Heavy use of <a href="https://lodash.com/">lodash</a> throughout the project. Unfortunately, because our application grew over time, we are importing the main lodash object directly <em>everywhere</em> (i.e., import _ from &#39;lodash&#39;;).</li><li>A relatively basic Webpack 1.12 setup. We use a vendor chunk comprised of the various aliases specified in the Webpack config and split code from within the <a href="https://github.com/angular-ui/ui-router/tree/master">Angular UI-router</a> using require.ensure().</li></ul><p>Here is what this looked like when analyzed using the <em>awesome</em> <a href="https://github.com/yuffiy/webpack-bundle-analyzer">webpack-bundle-analyzer</a> plugin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqMckIUcFvnqC9g37j1UuA.png" /><figcaption>Analysis of our chunks created with webpack-bundle-analyzer.</figcaption></figure><p>Angular 1.6 made up a huge part of our vendor chunk. This is something I would not be able to change. The second biggest dependency in vendor was lodash. I thought there should be a way to make this part smaller 🤔. Lastly, I had made the mistake of importing all of <a href="https://github.com/d3/d3">D3 version 4</a> in a route of our app, despite it providing named member exports. Possibly something I could change.</p><h3>Updating our config to the webpack 2 format</h3><p>My first step was to update our configuration for webpack 2. The webpack team has put together a <a href="https://webpack.js.org/guides/migrating/">pretty good guide</a> for this. It was very straight forward. A couple of notes on the experience.</p><ul><li>The new function format of the configuration is extremely useful. Being able to directly pass and evaluate environment variables is convenient.</li><li>Personally, I found the new loaders configuration format much easier to understand.</li></ul><p>Compare these two config extracts:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83913c226630920abd23fbbc2fa528cc/href">https://medium.com/media/83913c226630920abd23fbbc2fa528cc/href</a></iframe><p>rules and use make much more sense to me than the old loaders and loader. Yes, the old format also supported a loaders array — instead of the string example above — where we now use use. But then you had loaders nested within loaders. 😐</p><h3>Cleaning up our chunks</h3><p>Alright, I was now running webpack 2. Next, I wanted to optimize the way the application was split into chunks. In our config we were already using one commons chunk for heavily used third-party dependencies. Specifically, these were put into an <a href="https://webpack.js.org/plugins/commons-chunk-plugin/#explicit-vendor-chunk">explicit vendor chunk</a> using the <a href="https://webpack.js.org/plugins/commons-chunk-plugin/">CommonsChunkPlugin</a>. This is probably what most people, in particular in situations without lazy loading of additional chunks, end up with. At least, most tutorials I found end up showing this solution. It can get tedious, as each new dependency has to be added to the vendor chunk manually. In addition, the explicit vendor chunk does not lend itself well to tree-shaking, because Webpack will end up placing each vendor entry in the chunk in full. Luckily, the CommonsChunkPlugin gives you very fine grained control over what to place in a commons chunk via the minChunks option. minChunks can be a function that determines if a module should be included in the commons chunk. It is passed two parameters; a module object and a numeric value representing the number of chunks the module is included in. I ended up configuring three commons chunks; one for application-wide dependencies loaded at the application entry, one catch-all chunk including dependencies required by child chunks of the entry chunk, and, finally, one chunk for shared application modules loaded by child chunks.</p><h4>Vendor chunk</h4><p>Third-party dependencies usually have one thing in common: they are located within node_modules. The module object passed to our minChunks function has a property context. It is the path to the module file, excluding the file itself. Hence, you can check if context contains the substring node_modules to include a module in the common vendor chunk. This method is known as the “<a href="https://webpack.js.org/guides/code-splitting-libraries/#implicit-common-vendor-chunk">implicit common vendor chunk</a>”. I used the following very standard configuration for the main vendor chunk:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8a9ce23c91934dcb459873732936998/href">https://medium.com/media/f8a9ce23c91934dcb459873732936998/href</a></iframe><h4>Catch-all vendor chunk</h4><p>The problem with the above vendor chunk was that it would only capture dependencies required in the application’s entry chunk. All child chunks would still contain third-party dependencies they needed, unless they were already included in the main vendor chunk. Webpack behaves like this because users should not have to load code they might never need synchronously — and the main vendor chunk has to be loaded synchronously. By adding an extra <em>catch-all</em> commons chunk, you reduce duplicate code in the children. Here is how I added such a catch-all chunk to our application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42415d0de799d8495fbd6a9ac58859b4/href">https://medium.com/media/42415d0de799d8495fbd6a9ac58859b4/href</a></iframe><p>By adding the async option to the chunk configuration, I was able to change both the name of the chunk and cause it to be loaded asynchronously. Webpack ended up loading the chunk with the application’s entry chunk, which is slightly contradictory to the <a href="https://webpack.js.org/plugins/commons-chunk-plugin/#options">plugin’s documentation</a>. I will follow up on the various configurations for the CommonsChunkPlugin in future posts.</p><h4>Shared app modules chunk</h4><p>Our application has a lot of code that gets used in several places. For example, our AddressService is used in our shop module to look up a shipping address. Similarly, the service is used in the signup and account modules to provide address auto-completion via Google maps. All three modules are, however, located in different chunks, which are created by dynamic imports in the router logic. As with the third-party dependencies required by multiple child chunks, webpack’s default behavior in such a case is to include the AddressService in each of the three child chunks, if it is not already included in the app’s entry chunk. To create a commons chunk for shared application logic, I added another instance of the CommonsChunkPlugin with the following configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9a594b6f41c092ad94bdcf97e60d738/href">https://medium.com/media/b9a594b6f41c092ad94bdcf97e60d738/href</a></iframe><p>The difference to the catch-all chunk above lies merely in the string app/scripts, looked up in the module context. This is the relative path where our application code lives.</p><h4>Chunky results</h4><p>Having reconfigured our chunks, I got the following output analysis from webpack-bundle-analyzer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8oxH2R5ek6b81UkQ2s88g.png" /><figcaption>Analysis of our chunks after replacing the explicit with an implicit commons vendor chunk and introducing a chunk for shared app modules.</figcaption></figure><p>As you can see, the new chunk configuration put most of our third-party dependencies into the entry-vendor-deps commons chunk, effectively replacing the old vendor commons chunk. Additionally, we see the newly created shared-app-modules chunk with our shared application code.</p><p>You will notice that D3 and RxJS are still included in our split chunks, despite being imported from node_modules. This is because they are only used in their respective modules and not in the application entry. Additionally, at this stage, the entry-vendor-deps chunk only contained code extracted from the entry chunk.</p><h3>Preparing the build for tree-shaking</h3><p>With our chunks in order, it was time to finally get our project into shape for tree-shaking and dead code elimination. Tree-shaking is an optimization technique that — essentially — removes any unused ES6 module exports from your build output. In webpack 2, this is a two-step process. In the first step webpack identifies any unused exports and removes their export statement (i.e., the actual <em>tree-shaking</em>). In the second step, these now dead entities are removed by dead code elimination during minification with UglifyJS. You will find more details on this in <a href="http://www.2ality.com/2015/12/webpack-tree-shaking.html">Axel Rauschmayer’s post</a>. According to Tobias Koppers’ aforementioned Gist, webpack is only able to detect unused exports in a module in the following situations:</p><ul><li>The module’s members are imported via a named import.</li><li>The module’s default export is imported.</li><li>Some of the module’s members are re-exported</li></ul><p>For me this translated to: “If you want to reduce chunk sizes via tree-shaking, better use named member imports.“ Now, I couldn’t do anything about this with the Angular 1.6 part of our codebase. But, I could do something about some other big dependencies visible in the bundle analysis above.</p><p>Here is how we typically imported the heavily used third-party libraries in our across our codebase before I made changes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2b0821c59930bb975c0fd8357cffa68/href">https://medium.com/media/e2b0821c59930bb975c0fd8357cffa68/href</a></iframe><h4>Importing module members by name where possible</h4><p>The only dependency that was already being imported in a tree-shaking compatible way was RxJS — 👍🏻 for that. With the huge dependency that D3 was, according to the above chunk analysis, I was happy to see it had supported named member imports of individual modules since version 4. So I matched the specific functions we were using with their respective modules. Given our limited use of D3 this was luckily not too much work.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d09f8773a53266628ad3c4cbcfd2059d/href">https://medium.com/media/d09f8773a53266628ad3c4cbcfd2059d/href</a></iframe><p>As you can see below, after replacing our D3 imports, I was left with a much smaller footprint of the library in our build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i1GIEDAv1Vtd3CaFjI8xyg.png" /><figcaption>Analysis of chunks after importing D3 by named members (red rectangle in the middle).</figcaption></figure><p>The chunk containing D3 (the big purple one) went from second- to third-largest. Sweet 🍭.</p><h4>Handling a monolithic lodash dependency</h4><p>Now to the — hopefully — final step before flipping the switch enabling tree-shaking. Finding a way to import only the bits of lodash we needed. Lodash is available in many different builds. There is regular <a href="https://www.npmjs.com/package/lodash">lodash</a> (what we use), <a href="https://www.npmjs.com/package/lodash-es">lodash-es</a> (an ES2015 exports based version), <a href="https://www.npmjs.com/browse/keyword/lodash-modularized">lodash-modularized</a> (individual lodash functions as modules). You can also directly import individual lodash functions (e.g., import map from &#39;lodash/map&#39;;). So, there are ways to facilitate named member imports from lodash, enabling tree-shaking along the way. However, I did not want to go through our entire codebase and rewrite all those lodash imports. Luckily, there is a very handy <a href="https://github.com/lodash/babel-plugin-lodash">lodash Babel plugin</a> that turns any imports of lodash and subsequent use of lodash methods into named member imports. Here is the example from the plugin’s readme:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93c356279f91aa0f2bd230dd8a4dddfd/href">https://medium.com/media/93c356279f91aa0f2bd230dd8a4dddfd/href</a></iframe><p>Without touching any of our code, I could get function imports for the entire project. Using the plugin is very much straight forward. After installation, all I did was add it to the list of babel plugins.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aeafc78bdc2b0d48f740c0e7ca729235/href">https://medium.com/media/aeafc78bdc2b0d48f740c0e7ca729235/href</a></iframe><p>And here is what happened with our chunks afterwards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*41YH8ImVWE2DwyQOkDqO6A.png" /><figcaption>All lodash dependencies are included in the entry-vendor-deps and shared-node-deps (bottom-left) chunks.</figcaption></figure><p>As illustrated by the many tiny boxes inside the lodash box in entry-vendor-deps chunk above, enabling the lodash Babel plugin <em>did</em> work as expected. You can also see the <em>catch-all</em> chunk caught all the child chunks’ lodash imports (bottom-right). Awesome 🦄. There is a way to further optimize lodash’s footprint with the <a href="https://github.com/lodash/lodash-webpack-plugin">lodash-webpack-plugin</a>. As I understand it, this plugin allows you to disable parts of lodash entirely, causing them to be dropped from the build.</p><h3>Enabling tree-shaking</h3><p>And now for the grand finale. I had done about as much as I could to prepare our codebase for tree-shaking with webpack 2. If not, please let me know! All that was left was enabling the feature by</p><ol><li>telling Babel to not transpile ES6 modules into CommonJS modules and</li><li>making sure JavaScript minification with the UglifyJS plugin was enabled.</li></ol><p>The first part is necessary for webpack to be able to perform the static module analysis and remove export statements from unused members. The second step eliminates the resulting dead code.</p><p>To tell Babel not to transpile modules, set your ES preset’s modules option to false:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/025d8b540a9eef162a112739888e8c9c/href">https://medium.com/media/025d8b540a9eef162a112739888e8c9c/href</a></iframe><p>Notice the nested array structure for the presets option. Because you may pass multiple presets to Babel, you need to contain each preset with options in an array of its own. There used to be a es2015-native-modules preset. This has been deprecated in favor of the modules option.</p><p>There are (at least) two ways of enabling JavaScript minification in webpack. First, you can pass the --optimize-minimize flag to the CLI. This will enable the UglifyJsPlugin bundled with webpack. Second, you can add the UglifyJsPlugin to the plugins in your configuration file. This also allows you to use a version different from the one bundled with webpack. Here is the configuration I ended up using for our production build:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/528d9696fca458630cd6d8f3c8dfce63/href">https://medium.com/media/528d9696fca458630cd6d8f3c8dfce63/href</a></iframe><p>Notice the dead_code option, which enables dead code elimination.</p><p>After all this and some more work in other parts, here is what our final production build chunks now looked like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlGeNHsSLwmNrtUAB0WPdQ.png" /><figcaption>Chunks with tree-shaking enabled.</figcaption></figure><p>Admittedly, the chunks do not look any different compared to the previous step. I have not seen any effect of tree-shaking, yet. Some initial investigation showed I had brought down the overall size of our build, gzipped, and including all child chunks from 884Kb to 520Kb. That is quite a lot 💪🏻. At the same time, however, due to the asynchronously loaded shared-app-modules chunk, the initially loaded code of our login screen had increased from 173Kb to 251Kb. So, clearly I still need to optimize some things and do a complete analysis of the new build’s performance. Results will be published in the near future.</p><h3>(Preliminary) conclusion</h3><p>I was amazed by all the possibilities webpack offers these days. Once you’re willing to deep-dive into the loaders, plugins and configuration options you realize there is <em>a lot</em> you can fine-tune about your build. I am sure this is all old news to people who have been riding the React train for some long time. To me this was still an exciting experience coming from our old build configuration. Let’s see what the webpack team will produce over the coming months. 🤓</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc09bd8adbd4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-matters/upgrading-to-webpack-2-fc09bd8adbd4">Upgrading to webpack 2</a> was originally published in <a href="https://medium.com/code-matters">Code matters</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feeling good about side projects and experiments]]></title>
            <link>https://medium.com/code-matters/feeling-good-about-side-projects-and-experiments-47caeb1fa8c6?source=rss-3a066a556dc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/47caeb1fa8c6</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[project-management]]></category>
            <dc:creator><![CDATA[Felix Jung]]></dc:creator>
            <pubDate>Sun, 22 Jan 2017 17:24:49 GMT</pubDate>
            <atom:updated>2017-01-22T18:02:22.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*quaDvlxHawCRJX-ojMjdLw.jpeg" /></figure><p>At the point of this writing, my Github account has 24 public repositories, about ten of which could be considered small unfinished or abandoned side projects. Here are some examples:</p><ul><li><a href="https://github.com/felixjung/contentful-utils">contentful-utils</a>: a small CLI tool to help managing content types and entries on Contentful, a headless content management system.</li><li><a href="https://github.com/felixjung/carousel">carousel</a>: my very unfinished attempt to build a nice, responsive, touch friendly slider that I could use on a photography portfolio site, which I never started building.</li><li><a href="https://github.com/felixjung/twitter-tail">twitter-tail</a>/<a href="https://github.com/felixjung/twitter-tail-server">twitter-tail-server</a>: a client/server application that was supposed to let you follow a topic or location on Twitter using the streaming API. I started it to get a feeling for Angular 2 after attending AngularConnect 2016.</li></ul><p>None of these projects are in a state where I would consider them complete. I still had/have many ideas for potential features. I even went though the trouble of creating custom colored tags for some of the repositories and created <a href="https://github.com/felixjung/contentful-utils/issues">lists</a> of <a href="https://github.com/felixjung/carousel/issues">issues</a>. I bet there are many other developers who have this same problem.</p><p>We developers have ideas for cool side projects all the time. We like learning new things and tinkering with new technologies. We want to improve our skills and fight off this feeling that we are not learning quickly enough — I know this is at least true for myself. In my experience, however, these side projects often become too big for what they should be: very small prototypes that allow us to learn something and feel a sense of accomplishment. We get lost dreaming up a list of potential features, we will not finish in the little amount of coding time we have next to work and social life. I have the additional problem of quickly losing interest, after my initial curiosity for a problem has been satisfied.</p><p>Not completing your projects to a satisfactory level can have several bad effects. I constantly hear a nagging voice reminding me that I still have not finished the cool things I wanted to build; that I <em>never</em> finish the cool things I want to build. I get disappointed and maybe even somewhat anxious about not advancing my skills quickly enough. Basically, I am unable to follow through with anything, right? 😔 When you think about it, that’s not true, of course. These unfinished projects helped me acquire new skills. I did solve problems I had not faced before. But this does not register.</p><p>So what might be a good strategy to help yourself feel happy about these accomplishments? How can you turn our small projects into successes? I think, the answer to these questions is: “By finishing”. Because finishing is going to give you a sense of accomplishment. But how are you going to finish? Was this not the problem in the first place? Yes, but now you are going to set small limited scopes for all projects you start. You will figure out the absolute minimum you need to do in order to</p><ol><li>learn something new and</li><li>have something complete to put on the shelf and be happy about.</li></ol><p>Whenever you feel the urge to add another feature to a project, put it on a list for potential future versions. Do not try to add it before your project’s initial version is complete. This should help you stay focused. If a project turns out great or you have some actual real-world use for it, you can always come back to that list of nice ideas.</p><p>If you find you cannot complete a project for whatever reason, having a very small scope will help you not feeling like you wasted a lot of time. Your idea just did not work out and you can move on to the next.</p><p>I for myself, am going to try and follow this strategy. In fact, I wrote this blog post after finding myself unable to implement a JSON/file-based “API” with nothing but Jekyll running on Github Pages, this weekend. I wanted to build a small prototype and write about it. When I found my idea would not work out as planned, at first, I felt like I had wasted time. Then, I realized I had just tried something for an hour or two and I could write about my experience. Suddenly I had this blog post and accomplished something after all. Success! 💪🏻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47caeb1fa8c6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-matters/feeling-good-about-side-projects-and-experiments-47caeb1fa8c6">Feeling good about side projects and experiments</a> was originally published in <a href="https://medium.com/code-matters">Code matters</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On Apple]]></title>
            <link>https://medium.com/code-matters/on-apple-3c3aad523611?source=rss-3a066a556dc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c3aad523611</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Felix Jung]]></dc:creator>
            <pubDate>Tue, 17 Jan 2017 22:46:11 GMT</pubDate>
            <atom:updated>2017-01-18T17:52:16.390Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cop0IvJ2-jyF83z5Ho-OdQ.jpeg" /></figure><p>Much has been said and written about the current state of Apple over the past weeks, months, and even years. Things seem to have gotten more intense since the release of the new MacBook Pro in November. My perception is that a lot of people think this year will finally reveal some future the company has chosen for itself; as the “old” Apple with that unique soul and care for products like the Mac or as the “new” Apple, expanding horizontally and producing all kinds of nicely designed but not as innovative/powerful mass market consumer products.</p><p>I have been a <em>very</em> happy Apple customer ever since I got my first iPod nano for Christmas in 2005. Since then I have owned four iPods, seven Macs, one Cinema Display, both an Airport Extreme and an Airport Express, six iPhones, two iPads, an AppleTV, an Apple Watch, and a pair of AirPods. I have been following Apple-related news and rumors and listened to Apple related podcasts. And after all that, I must admit I feel some of the pessimism over the company’s future creep into my own thoughts.</p><p>Among the pieces I have read on the topic over the past months, I think <a href="https://chuqui.com/2017/01/apples-2016-in-review/">Chug von Rospach</a>’s was the best at analyzing what is currently going on. I can totally identify with the “niche users” Chug describes</p><blockquote>The problem? This group is fairly small and have needs living well towards the end of the bell curve. They are, effectively, a niche within the niche that the Mac now finds itself in. Apple seems to have made business decisions not to support this group. Why?</blockquote><p>In the following, I am going to take some of the topics Chug addresses and add some of my observations, some of which I have not seen mentioned anywhere so far. Bear with me, this is going to be a long one.</p><h4>Missing shipping dates and not meeting demand</h4><blockquote>But over the last year or so, we’ve seen a number of products announced with shipping dates that were pushed out, and out, and out, or met by small shipments that woefully struggled with demand. Last year it was the pencil, and now, we’re seeing a similar challenge to ship with the AirPods.</blockquote><p>Personally, I do not care too much about Apple having to postpone products. Sure if they have to postpone more often it is a sign that either their planning or their execution is lacking. But if they miss a release date once or twice a year, I do not care. What I do care about is the <em>extremely</em> limited availability of products once they are released. Last year, I bought the iPhone 7, the Apple Watch Series 2, a 15” MacBook Pro, and a pair of Air Pods. Every single product was backordered several weeks despite me making the purchase within minutes (iPhone 7, MacBook Pro, Apple Watch) our hours (Air Pods) of availability. How is it possible that for basically any new product Apple keeps struggling with demand? They should be able to handle this by now, no? With the MacBook Pro I made the mistake of choosing wire transfer as payment method, because it was a pre-order — my money would surely arrive way before any shipments would get prepared, right? — and I thought the delivery estimate of 2–3 weeks in the store would be accurate (this was in line with the actual launch date). What then happened was just frustrating. First, the confirmation e-mail showed a shipping estimate of 4–5 weeks. When the shipping date approached, my delivery estimate was pushed back another week and finally it was set for December 22nd. Meanwhile, friends, who had ordered via credit card later than me, were getting their new MacBook Pros. What I take away from this is that Apple kept prioritizing orders, for which they had yet to receive a payment, over mine. I understand the business logic. But I always thought Apple to have some moral high ground. This is simply not what I would have expected from them. They should be better than this.</p><h4>Languishing and discontinued products</h4><blockquote>Apple has products it’s let languish without any significant update for long periods of time.</blockquote><p>There are many examples for this in Apple’s product line: the Mac Pro, the Mac mini, the Airport line of routers, the Thunderbolt Display, and — at the moment — even the non-pro versions of the iPad, iPad Air and iPad mini. Before November, the MacBook Pro would have been on that list.</p><p>I do not understand how Apple can leave these products this unattended for such a long time. People rely on them. It is simply embarrassing that the Mac Pro, which Phil Schiller announced with “Can’t innovate anymore my Ass” is still being sold without any hardware updates in more than 1000 days. Heck, until recently Apple was still advertising this computer with performance gains in Aperture, the company’s long discontinued professional photography Application. Double the embarrassment. Why don’t they just acknowledge these problems? I bet, if they were more open about this, people like me would totally understand.</p><h3>Brian Stucki on Twitter</h3><p>Reminder: The current Mac Pro page brags about the performance with Aperture, a program that Apple retired 2+ years ago:</p><p>Same goes for the Airport routers. These were really great routers once. Apple has not updated them in years and by now there are much better products available — performance-wise. <a href="https://www.bloomberg.com/news/articles/2016-11-21/apple-said-to-abandon-development-of-wireless-routers-ivs0ssec">Rumor has it</a>, Apple is going to discontinue them, too. Chuq notes</p><blockquote>Now, to be fair, I think it makes sense for Apple to stop making WIFI devices; the market is established and there are good products in there, unlike when Apple stepped in and started selling them.</blockquote><p>I disagree. While alternatives such as <a href="http://eero.com/">Eero</a> and <a href="https://madeby.google.com/wifi/">Google Wifi</a> exist, these are not yet available in most markets outside of the US. In places like Germany you still have to buy ugly, potentially nightmare inducing, routers from PC companies or an <a href="https://en.avm.de/products/fritzbox/">AVM FRITZ!Box</a>, a product so German and boring I never even considered buying it. Yes, there is Ubiquity, but their offerings are more for the professional market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qz1gD-BK2HxKJRbGj9kOgg.png" /><figcaption>Manufacturers like Linksys somehow seem to think people want to put something this nightmare-inducing into their homes.</figcaption></figure><p>So yes, Apple should continue making their routers, in particular if they want to maybe finally establish HomeKit as a real thing.</p><h4>The nickle-and-diming</h4><p>This was not part of Chug’s piece, but I think it’s worth discussing, as it has popped up in other discussions. Apple opponents have often argued, Apple products are overpriced and you could get equally good alternatives for much less money. While this has always been true when looking only at specs, Apple’s products turned out to be comparably priced when considering all their features, bundled software, and low cost of maintenance. In particular the last point is so significant that <a href="http://www.imore.com/macs-are-543-cheaper-windows-pcs-says-ibm">IBM apparently saves $273 — $543 per Mac compared to a PC</a>. Mac users like me were thus willing to pay the seemingly higher price. We knew we were getting a significantly better product.</p><p>With the most recent MacBook Pro update, I am starting to get a bit frustrated with Apple’s pricing model, however. These machines are more expensive than they used to be. <a href="http://bgr.com/2016/10/28/apple-defends-expensive-macbook-pro-pricing-we-design-for-the-experience/">According to BGR</a> the new line of MacBook Pros has seen price increases between between $200 and $300. In Germany, where Apple is also adjusting to the depreciation of the Euro against the Dollar, the price increases were even bigger. The 15” base model is <a href="http://www.giga.de/unternehmen/apple/news/teure-macbook-pro-modelle-die-preise-im-zeitlichen-verlauf/">apparently €500 more expensive than its predecessor</a> (this includes the VAT of 19 percent). That is quite <em>a lot</em> of money. But there is more. You will end up spending $50-$150 on Thunderbolt 3 / USB-C dongles — I am 100 percent convinced going Thunderbolt 3 only was the right decision. But wait, there is more. Apple found a way to charge you more for the power adapter. A lot of people tend to buy an extra power adapter for their MacBook. It is very convenient to have one for home and one for work or travel. The 85W MagSafe 2 Power Adapter costs $79. It includes the MagSafe cable <em>and</em> an extension cord. With the new 87W USB-C Power Adapter, this is a different matter. You have to buy <em>three</em> separate items to match what is in the box with the old adapter; the power adapter itself (still the same $79), the USB-C cable connecting to your MacBook to the power adapter ($19), and the extension cord ($19). So the new power adapter comes in at an extra $38 compared to the old MagSafe 2 version. Considering all these extra expenses, the new MacBook Pros come in at a significant premium compared to their predecessors. Some people have made fun of Mac users, who spend $2,800 on a new computer and then complain about $100 extra for adapters. It’s simple not just that. All things considered we are talking up to $500 or even €700 added to the usual cost of upgrading to the latest hardware. Why does Apple keep raising prices? Yes, they are a publicly listed company. Yes, a lot of people are still paying these prices. But at some point this simply looks greedy. Apple could have included adapters and cables in the box with this already much more expensive MacBook Pro. That would have been the right thing to do. We have seen the same behavior in the past. The iPod and iPhone used to ship with a dock, remember? Then someone found out it would help the company’s profits to remove these “extras”. This time this is happening on a much bigger scale, though.</p><h4>Products losing their soul</h4><p>One reason a lot of people became Apple fans and fell in love with products like the Mac and the iPhone was their soul. Apple would always put some extra effort into their products; add some nifty or playful little feature. Some examples of this are</p><ul><li>the Mag Safe connector by itself and the charing indicator LED on it,</li><li>being able to configure AirPort routers via an app, rather than a web interface,</li><li>the battery indicator pre-retina MacBooks used to have,</li><li>the sleeping LED light of pre-retina MacBooks,</li><li>the seemingly first inline microphone and remote not requiring a special connector on the iPhone’s headset,</li><li>the various connectors on the Thunderbolt Display,</li><li>the asymmetrical fans in the retina MacBook Pros, or</li><li>the pairing mechanism used by the AirPods.</li></ul><p>But a Mac fan like me sees this list and notices all the delightful features and products that have been removed or discontinued without an adequate replacement. I remember getting my first MacBook Pro an keeping connecting and disconnecting the Mag Safe connector. To me, coming from an Asus notebook, this was magic. Likewise, you could buy a Cinema or Thunderbolt Display and have this amazing screen that opened a world of possibilities for your MacBook with just a single cable connecting the two. Back then, nobody else provided features like this. Now we have USB-C and you can get similar solutions from regular PC vendors. Probably this is why Apple stopped producing their own displays. Other products were deemed good enough.</p><p>That’s the thing, though. People used to fall in love with Apple products, because they were never just good enough. With the AirPods Apple has kind of shown they are still capable of delivering true innovation and magic. But why should “old” products loose all their magic, their soul? Why does Apple seem to be caring less about putting a smile on people’s faces when they notice a magical little feature? Apple needs to get this back! It is the differentiating factor making people passionate about the company.</p><h4>Why there still is no reason to abandon ship</h4><p>Like Chug, I do not think all is lost. By far not. And despite a lot of posts about people trying Linux or going back to Windows have been popping up, I feel switching is not a viable option. First, other hardware simply is not designed as nicely. Turns out, I do care how my computer looks and feels. Secondly, I do not want to buy a laptop, then try to get Bluetooth, Wireless, and what not working and probably fail in some instances. And what about a consistent nice UI where all apps at least have a similar design language? What about all the awesome apps you can find on macOS, that happen to come with an iOS, even an Apple Watch companion? The <a href="https://www.omnigroup.com/omnifocus">Omni Focuses</a>, the <a href="https://tapbots.com/tweetbot/">Tweetbots</a>, the <a href="http://reederapp.com/mac/">Reeders</a>, the <a href="https://sketchapp.com/">Sketches</a>, the <a href="https://www.git-tower.com/mac/">Towers</a> and the 200 other amazing apps made by indie developers? Am I supposed to settle for <a href="http://corebird.baedert.org/scrot1_1.4.png">ugly UIs</a> and webapps? I just do not think Apple’s hard- and software have gone even 10 percent down the hill at whose end I will switch to Linux — yes, at this point I would only consider Linux. A colleague of mine uses Windows 10 for web development. Basically every time we make a change to the build tools of a project, it will fail on his machine. We will spend hours trying to fix it, eventually finding some obscure workaround or finding that a reboot will fix things. Seriously? 😳</p><p>So, I feel the pain and I wish things were a bit different for the hardcore Apple user, but there is a long, long, long way to go before I would even consider another platform. And who knows, maybe we will see another “Can’t innovate anymore, my Ass!” from Phil in 2017!?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c3aad523611" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-matters/on-apple-3c3aad523611">On Apple</a> was originally published in <a href="https://medium.com/code-matters">Code matters</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Caring about your code]]></title>
            <link>https://medium.com/code-matters/caring-about-your-code-46ad2088d32d?source=rss-3a066a556dc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/46ad2088d32d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Felix Jung]]></dc:creator>
            <pubDate>Sun, 15 Jan 2017 13:33:35 GMT</pubDate>
            <atom:updated>2017-01-19T20:19:30.020Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbphaREfsmTanDWXWpDL7Q.jpeg" /><figcaption>Two implementations of groupBy. Which one is easier to understand — putting some ES2015/2017 magic aside?</figcaption></figure><p>When you are a developer and hacking together some scripts for yourself, there is no immediate need to care about the quality of your code or its style. Likewise when you are using Git to maintain some small personal project, why should you are about things like commit messages or even pull request titles — who creates branches in personal projects anyway, right?</p><p>It is easy to see it this way and keep on hacking together a bunch of code. Keep on committing with messages like “Bug fixes”, ”More bug fixes”, ”More bug fixes 2”. <em>Every</em>. <em>Single</em>. <em>Time</em>. After all, it is just some side project, right? I think most developers, myself included, have told themselves something along the lines of “Ah come on, who cares. I’m just going to commit it like this.” before. But you know what? I strongly believe every time we do that, a tiny part of the better developer most of us want to become goes into a corner and dies. 💀</p><p>A big part of becoming a better developer is experience, sure. Write enough lines of code in different languages and for enough problems and you will have a pretty good idea of what you need to do most of the time. But this is only part of the story. Another huge part, maybe equally as important, is caring about how you write all that code; how you commit your code, too. Whenever you write code, at every step, ask yourself: “Is there a better way to do this?”. Some examples:</p><ul><li>“Does this function or variable name communicate its meaning as precisely as possible?”</li><li>“Instead of using this if-else block, can I maybe just use an if block and return early?”</li><li>“Can I generalize this bit of code and make it a function instead of repeating myself all over the place?”</li><li>“Is the piece of code I’m about to commit an atomic unit? Should I split it into multiple commits?”</li><li>“Is my commit message easily understandable? Does it accurately summarize the changes in this commit? Can I make it even more concise?”</li></ul><p>Always challenge yourself when you code. You might not find the perfect answer to the above questions right away, but asking them and doing your best to improve will eventually make you a better developer.</p><p>But it does not stop there. Not only will you become a better developer, other contributers to that open source project you have been helping out on and your colleagues at work will benefit, too! 🙋🙋🏾‍♂️ More examples:</p><ul><li>The junior your team just hired will be able to read your code and learn from it more easily!</li><li>When you go on vacation and people find a bug in the code you committed just before leaving, they can quickly identify the commit that introduced it (remember, concise commit messages) and revert it (you made a nice atomic commit). You can take care of the problem once you get back.</li><li>And that huge new feature branch you had been working on for months before it was squash-merged can also be reverted because you namedf your pull request nicely and even included the ticket number from whatever ticket system you poor soul have to use at your company — yes Jira, I am talking about you.</li></ul><p>So yeah, just give a damn about this stuff. You will be a better developer for it and people will enjoy working with you. Everybody wins. 🎉 Pro tip: this is true for most things in life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46ad2088d32d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-matters/caring-about-your-code-46ad2088d32d">Caring about your code</a> was originally published in <a href="https://medium.com/code-matters">Code matters</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>