<?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 Szántó Balázs on Medium]]></title>
        <description><![CDATA[Stories by Szántó Balázs on Medium]]></description>
        <link>https://medium.com/@szntb?source=rss-93c006b11a13------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BUvFmw2CqyG5j7JMGxXKcw.jpeg</url>
            <title>Stories by Szántó Balázs on Medium</title>
            <link>https://medium.com/@szntb?source=rss-93c006b11a13------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:23:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@szntb/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[Az 5 kedvenc könyvem 2018-ból]]></title>
            <link>https://medium.com/@szntb/az-5-kedvenc-k%C3%B6nyvem-2018-b%C3%B3l-e9396ca3228b?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9396ca3228b</guid>
            <category><![CDATA[books]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Tue, 01 Jan 2019 14:03:29 GMT</pubDate>
            <atom:updated>2019-01-01T14:03:29.774Z</atom:updated>
            <content:encoded><![CDATA[<p>Négy éve megtaláltam az ideális stressz levezető tevékenységem, és azóta egyre több könyvet olvasok. Az előző évre 25 könyv jutott. Lássuk a top 5-ös listát.</p><h3>John le Carré: Egy tökéletes kém</h3><p>Nem nagyon olvastam eddig kém regényeket, szóval nem is igazán tudtam mire számítsak. Mit is mondjak, nem volt egy akció dús könyv, mégis izgalmas volt az elejétől kezdve. Tele volt érzelmekkel, dilemmákkal és sok rejtett feszültséggel. Semmi sem volt kimondva, mégis minden ott volt előttem.</p><p>Magnus Pym történetét és lelki világát követhettem nyomon, a gyerekkorától kezdve, a kém pályafutásáig. Mindig más szemszögből volt prezentálva a történet. A naív gyermek, az ifjú lelkes titán és a tapasztalt kém váltakozva szólalt fel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*ppd8yhHAwSjPm5l5ImRaew.jpeg" /><figcaption><a href="https://www.goodreads.com/book/show/18515208-egy-t-k-letes-k-m">https://www.goodreads.com/book/show/18515208-egy-t-k-letes-k-m</a></figcaption></figure><h3><strong>Philip Pullman</strong>: La ​Belle Sauvage</h3><p>Aki olvasta az Úr sötét anyagai trilógiát, annak ez egy kötelező darab. Philip Pullman ugyanis kiegészíti a világát, három új könyvel. Az első ilyen a La Belle Sauvage, egy fiatal fiú hősies történetéről szól, aki önzetlenül gondját viseli a veszélyben lévő Lyra-nak egy olyan világban, ahol a tudományos elnyomásban él az egyház miatt.</p><p>Az Úr sötét anyagaihoz képest a hangszín komorabb. Sokkal több ízelítőt ad abból a világból, mint a három előző kötet. Tökéletes kiegészítő.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*bjga_l3lECwatddGk_WjyQ.jpeg" /><figcaption><a href="https://www.goodreads.com/book/show/36300772-la-belle-sauvage">https://www.goodreads.com/book/show/36300772-la-belle-sauvage</a></figcaption></figure><h3>Fredrik Backman: Itt ​járt Britt-Marie</h3><p>Britt-Marie egy rigolyás öregasszony. Nincs mit szépíteni ezen. A világot egyféleképpen lehet élni, és azt is csak akkor, ha minden csillog és villog. Szerinte nem lehetünk állatok, hogy nem pontban ebédelünk. A könyv végére mégis megszerettem őt. Miért is?</p><p>Fredrik Backman úgy tud bemutatni sorsokat és szituációkat, félig humorosan, félig komolyan, hogy nagyon könnyen bele tudom magam élni és megérteni, hogy az adott ember miért olyan, amilyen. Az különösen tetszik az írói stílusában, hogy néha rövid, akár 1–1 soros fejezetekkel, mondatokkal operál, de azokkal akkorát üt, hogy meg kell állni egy pillanatra.</p><p>Bármelyik Fredrik Backman könyv bekerülhetett volna a top listámra, mert mindegyiket zseniális élmény volt olvasni.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*I9WZjts9H8lk9VA2jbR56A.jpeg" /><figcaption><a href="https://www.goodreads.com/book/show/29813443-itt-j-rt-britt-marie">https://www.goodreads.com/book/show/29813443-itt-j-rt-britt-marie</a></figcaption></figure><h3>Philip K. Dick: Elektronikus álmok</h3><p>Philip K. Dick az egyik kedvenc írom. Főleg a regényeit szoktam olvasni, amelyek zseniálisak, még akkor is, ha néha csak kapkodom a fejem, hogy mi a pék történt most.</p><p>Az Elektronikus álmok egy 10 darabos novellás kötet. Kicsit olyan, mint a <a href="https://www.imdb.com/title/tt2085059/">Fekete Tükör</a> (Black Mirror). Sokkol. Annyi a különbség, hogy Philip K. Dick 1951–1982 között jött elő az ötleteivel. Aki erre befizet, az olvashat a valóság természetéről, félresikerült ipari automatizálásról, a félelem pénzügyi kiaknázásáról és sok más érdekfeszítő témáról.</p><p>Jó hír, hogy van sorozat adaptációja is a novellás kötetnek, <a href="https://www.imdb.com/title/tt5711280/">Electric Dreams</a> néven fut az Amazonon. Még nem néztem meg, hamarosan sor kerül erre is. Különösen tetszett a könyvben a novellák előtti előszó, egy pár gondolat attól a rendezőtől, aki az adott novellát megfilmesítette.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*HKH9kq-_uSQgWe6hCENWlg.jpeg" /><figcaption><a href="https://www.goodreads.com/book/show/38196264-elektronikus-lmok">https://www.goodreads.com/book/show/38196264-elektronikus-lmok</a></figcaption></figure><h3>Susan Cain: Csend — A hallgatás ereje egy harsány világban</h3><p>Introvertáltnak lenni még mindig ciki és kellemetlen érzés a mai világban. Sokan azt erőltetik, hogy legyen szavad, szólalj fel, még akkor is, ha csak a levegő süvít ki a szádon, értelmes gondolatok hiányában. Legyél harsány, dolgozz nyitott irodában, legyél meggyőző és lehengerlő az adott pillanat hevében.</p><p>Ezt a könyvet olvasva úgy éreztem van remény. Kevésbé éreztem azt, hogy gáz introvertáltnak lenni és tetszett az, hogy kicsit jobban megismerhettem, mit ad nekünk az introvertáltság, és miért alakul ki. Ez a könyv talán segít annak a megértésében, hogy különböző beállítottságú emberekkel, máshogy kell érintkezni az élet összes területén.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*aG7Fa9f3flFvMzgU2zMLTQ.jpeg" /><figcaption><a href="https://www.goodreads.com/book/show/25189947-csend">https://www.goodreads.com/book/show/25189947-csend</a></figcaption></figure><h3>Fin</h3><p>Ennyit a top 5-ről, remélem nektek is jól telt az előző év olvasás ügyileg. Ha szeretnétek ötleteket meríteni, akkor ajánlom a <a href="http://goodreads.com/">GoodReads</a>-et, ami a könyv molyok Facebookja, továbbá keressétek fel a <a href="http://reddit.com/r/books">https://reddit.com/r/books</a> alredditet, vagy túrjátok végig a <a href="https://moly.hu/">https://moly.hu/</a>-t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*owDFTJ7ZxOjF4rM-QvX6pA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9396ca3228b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The dark side of dependency injection]]></title>
            <link>https://medium.com/@szntb/the-dark-side-of-dependency-injection-5c673f3ed751?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c673f3ed751</guid>
            <category><![CDATA[benchmarking]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Sun, 07 Oct 2018 17:05:08 GMT</pubDate>
            <atom:updated>2018-10-07T17:05:08.230Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTIEOzIIO3zcIHVULwh5GQ.jpeg" /><figcaption>How did I end up here?</figcaption></figure><p>Just like every story, it started with the profiler. I was curious why the app startup is slow. Soon I realized that most of the time spent by the DI framework creating objects. As DI frameworks are pretty performant these days, the problem must be with the dependencies or the DI container configuration. Further investigation with the profiler and Benchmark.NET showed what’s wrong.</p><p>Dependency injection frameworks offer great ways to express your architecture. That’s all. It doesn’t warn you if you create wide and deep object hierarchies. It lets you introduce more and more singletons. Are there long running constructors? Never mind. All in all, DI frameworks provide the tools, and you give the architecture.</p><p>So, let’s see what kind of issues I had to face:</p><ul><li>Singletons and memory leaks</li><li>Singletons and lifecycle issues</li><li>Heavy constructors</li><li>Threading puzzles</li><li>Lifecycle issues in general</li></ul><h3>Singletons, singletons everywhere</h3><p>I used to make almost every type a singleton. Why? Don’t ask me. I guess it made life more comfortable and I felt my code is much simpler as only one instance exists of my type. Here come the disadvantages of using singletons:</p><h4><strong>Exhibition 1: Memory leaks</strong></h4><p>Do you want to write some legacy code? Here’s how you should do it:</p><p><strong>Step 1:</strong> Make sure you have some singletons in your complex object hierarchy.</p><p><strong>Step 2</strong>: Sit back and relax. Quit your job. Leave it to the professionals.</p><p><strong>Step 3</strong>: Grab some popcorn and check back on how your former colleagues are dealing with memory leaks.</p><p>Thanks to well-placed singletons, supposedly short-lived objects won’t be garbage collected, as singletons are holding references on them. They might hold on to unmanaged resources longer than expected. Forever young.</p><h4>Exhibition 2: <strong>Lifecycle issues</strong></h4><p>We want to implement some master-detail UI, so we choose the <strong>DetailsViewModel.cs </strong>to be a singleton. Imagine, that the <strong>DetailsView.xaml</strong> is a complex piece of UI, bloated and has a deep control hierarchy. It’s expensive to create, especially on the UI thread. As an optimization, classes are configured to be singletons, both the view model and the view. We’re also happy because we can reference the <strong>DetailsViewModel </strong>anywhere from our code. Singelton as architecture at its best.</p><p>One of the issue with singleton “god” objects is that now and then you have to reset the object’s state. By state, I mean fields of the object and its event subscriptions. You might even have to do more complex re-initialization. Bookkeeping is relatively easy in the beginning, however it gets much more complex over time. Usually, bugs are introduced after a few changes made to the class, often by another developer. Here’s a dummy example for the kind of mistake I’m talking about:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a211a8c6328ff0a6123632917afb4f5f/href">https://medium.com/media/a211a8c6328ff0a6123632917afb4f5f/href</a></iframe><p>Be careful. Even if you make <strong>DetailsViewModel </strong>a per-request style transient object, it might be referenced by a singleton object. Imagine the scenario when the object lifetimes are configured well thought out, so they have transient lifetime along the object hierarchy. Then comes another developer and marks one of the objects in the hierarchy singleton for some reason. It might introduce subtle bugs and annoying side effects. In the example there’s an event subscription, which will be listening and doing harm forever thanks to the singleton having a reference on the DetailsViewModel.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8712f377cdd0e252d18bba1dccc82ec3/href">https://medium.com/media/8712f377cdd0e252d18bba1dccc82ec3/href</a></iframe><h3>Heavy constructors</h3><p>var dep1 = new Dep1();<br>var dep2 = new Dep2(dep1, …, …)<br>var dep3 = new Dep3(dep1, dep2, …, …)<br>.<br>.<br>.<br>var myObject = new MyObject(dep1, dep2, dep3, …, depN);</p><p>This is the code you don’t have to write thanks to the DI framework, however you have to take it into consideration when you call <strong>IoC.Get&lt;IMyObject&gt;().</strong></p><p>God knows what are these constructors do. Make constructors as fast as possible. Get rid of the clutter. For example, I managed to cut 2– 4 seconds on a startup just by transforming some field initializations in the constructors to Lazy&lt;T&gt; instead.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e612990c6502a2bbfaf48e8fc6ac006/href">https://medium.com/media/2e612990c6502a2bbfaf48e8fc6ac006/href</a></iframe><p><strong>SlowViewModel </strong>creation takes some time, but when <strong>DoSomething </strong>is called, it can start the computation immediately. <strong>FastViewModel </strong>can be created without any overhead, however the first <strong>DoSomething </strong>call is slower. You know the trade-offs, choose wisely. Last but not least, I recommend reading this article on async constructors from Stephen Cleary:</p><p><a href="https://blog.stephencleary.com/2013/01/async-oop-2-constructors.html">Async OOP 2: Constructors</a></p><h3>Threading considerations</h3><p>Be confident about where objects are created. It might be justifiable to build up an object hierarchy slowly. However, it’s not acceptable if object creation makes the UI thread very busy, causing low frame rates. Avoid deep hierarchies and busy constructors.</p><h3>Lifecycle issues</h3><p>Last but not least I want to talk a little more about lifecycle management. Once I was investigating why does it take so much time to create specific view models, and I realized that along the creation process there are unnecessary dependencies. Let’s see the example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8ccb8f703b10e6ccbd032a883067d4c/href">https://medium.com/media/c8ccb8f703b10e6ccbd032a883067d4c/href</a></iframe><p>The <strong>ISettingsViewModel </strong>creation can be delayed when <strong>ShowSettings()</strong> is called. As this method might never get called, the <strong>ISettingsViewModel </strong>is not an essential dependency, which means that it shouldn’t be in the constructor in the first place.</p><h3>Learnings</h3><p>I wasn’t aware of the architectural problems until performance issues reached a critical and noticeable point. Not only did I identify anti-patterns, but I also felt that I have to be sharper while introducing new dependencies.</p><p>Opening up the profiler now and then, or just writing performance tests can shed some light on some bad decisions. You can easily go from thinking “hmm — it’s slow” to “it’s slow because of this and that …”. For example, I wrote a test suite using Benchmark.NET which queried what kind of types registered in the DI container and run the simple test of IoC.Get&lt;T&gt;().</p><p>For the future, I’ll look at my and other’s code differently. I’ll try to be more aware of the effect of the code changes towards the overall architecture of the application. It’s also worth mentioning those good decisions from the past need to be revisited on a regular basis.</p><p>What’s your opinion on dependency handling?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c673f3ed751" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting burnt with HttpClient]]></title>
            <link>https://medium.com/@szntb/getting-burnt-with-httpclient-9c1712151039?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c1712151039</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Wed, 31 May 2017 14:10:00 GMT</pubDate>
            <atom:updated>2017-06-01T08:33:31.192Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.nuget.org/packages/System.Net.Http/">System.Net.Http</a> offers pretty neat building blocks to create kick-ass HTTP requesting pipelines. The <a href="http://chimera.labs.oreilly.com/books/1234000001708/ch14.html">Designing Evolvable Web APIs with ASP.NET</a> gives a great overview what can be achieved beyond sending simple GET requests.</p><p>This post is more about how to shoot yourself in the foot. At home. Not in production:</p><ul><li>Spicing up downloading huge files by using HttpClient’s <strong>default timeout.</strong></li><li>The uninvited guest while downloading huge files: <strong>OutOfMemoryException.</strong></li><li>Is <strong>HttpCompletionOption.ResponseHeadersRead </strong>your friend or your enemy?</li></ul><p>It’s story telling time!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*w0IaJg9iknhaEHpjaLhDjQ.jpeg" /><figcaption>Please go ahead, release it to production. Source: <a href="http://i2.kym-cdn.com/entries/icons/original/000/000/043/disaster-girl.jpg">http://i2.kym-cdn.com/entries/icons/original/000/000/043/disaster-girl.jpg</a></figcaption></figure><h4>Spicing up downloading huge files by using HttpClient’s <strong>default timeout.</strong></h4><p>Let’s download huge files. I’m sorry, but I hope you have a slow connection. What could possibly go wrong this code snippet?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c1597cb83938dea2d25bc24d9d732d0/href">https://medium.com/media/3c1597cb83938dea2d25bc24d9d732d0/href</a></iframe><p>We’re downloading loads of bytes and based on your bandwidth, the requests may or may not throw a <strong>TaskCancelledException</strong> before it has a chance to run to completion.</p><p><strong>LEARNING: HttpClient has a default timeout set to </strong><a href="https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/HttpClient.cs"><strong>100 seconds</strong></a><strong>. So you better have a good connection or download small files.</strong></p><p>Let’s fix this issue once and for all with <strong>Timeout.InifiniteTimeSpan.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/190866ab23035cc3ed5675d5a8302786/href">https://medium.com/media/190866ab23035cc3ed5675d5a8302786/href</a></iframe><p>Do you want to hear the bad or the good news first?</p><p>The good news: Introducing infinite timeout, low bandwidth scenarios will cause less headache.</p><h4>The bad news: I didn’t inivite <strong>OutOfMemoryException to the party. Oh wait. You just did.</strong></h4><p>Take a look at the previous code snippet. All these bytes retrieved from the internet will be held in the memory, so <strong>OutOfMemoryExceptions </strong>might occur. Of course, not on your high end developer machine, testing only with small videos, but in your creative, let’s push to the limits kind of end users’ machines.</p><h4>Streaming comes to the rescue</h4><p>Instead of reading the whole remote response stream to the memory, let’s read small chunks and do it right.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/799526b3bb4233c97d18ebd56ec7fea9/href">https://medium.com/media/799526b3bb4233c97d18ebd56ec7fea9/href</a></iframe><p>If you executed the code snippet above, you would see that the <strong>“bytes.bin” </strong>file is not created until the whole response’s content is downloaded. You can go to the File Explorer and see it for yourself. We can come to the following conclusion: <strong>“await client.GetAsync(string url)” </strong>block until the response’s content is fully downloaded/read to the memory. We wrote a bunch of code and we’re at square one.</p><h4>The mighty HttpCompletionOption parameter</h4><p>With <a href="https://msdn.microsoft.com/en-us/library/system.net.http.httpcompletionoption(v=vs.118).aspx">HttpCompletionOption</a> you can control the timing the request should be considered completed. By default a GetAsync, …, SendAsync methods are blocking up until the entire response message is read (headers + content), which we want to avoid in some cases.</p><p>If you want to stream the response’s content and not loading it entirely into memory, <strong>HttpCompletionOption.ResponseHeadersRead </strong>is your new best friend. Let’s modify the previous example. You go to file explorer and see the <strong>“bytes.bin” </strong>keeps growing and growing.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd308a87722b8da3a309633c607fd687/href">https://medium.com/media/fd308a87722b8da3a309633c607fd687/href</a></iframe><p>Now we’re safe from OutOfMemoryExceptions, however we’re subjected to programming errors.</p><h4>Is <strong>HttpCompletionOption.ResponseHeadersRead </strong>your friend or your enemy?</h4><p>It’s your friend, but you need to be careful. Using HttpCompletionOption.ResponseHeadersRead can go really wrong in case of using infinite timeout and not disposing the response objects. You can actually create a sort of deadlock situation. Let’s see how:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd784c7707f369e75a50b478c4d8d798/href">https://medium.com/media/bd784c7707f369e75a50b478c4d8d798/href</a></iframe><p>I simulated the scenario when some media files are not available on my CDN. I set up my application to only allow 2 concurrent requests at a time (btw: I wasn’t aware of this option for a while). As long as two requests are running at a same time, the next requests are just blocking. To make things worse I didn’t dispose my <strong>response </strong>object. On top of all these, I use infinite timeout for the HTTP operation. The whip cream is the HttpCompletionOption.ResponseHeadersRead on this tasty cake.</p><p>The third time the code’s hitting the <strong>httpClient.GetAsync, </strong>it’s blocking forever, as none of the previous requests ever ran to completion or got disposed. The default timeout didn’t save our sorry asses, because we override it with infinite timeout.</p><p>This version looks better:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5a7a4fccfb9b229af4c7f706bcc5f8e/href">https://medium.com/media/c5a7a4fccfb9b229af4c7f706bcc5f8e/href</a></iframe><h4>Learnings:</h4><ul><li>Defaults just like the timeout in this case are there for a reason. Try to find the reason behind them.</li><li>Timeouts are also important and make sure you know what you do when you set it to infinite. Even if you do, have some seconds thoughts about it and remove the infinite timeout. What’s better? Clogging your whole HTTP requesting pipeline time to time, because of some files downloading with 0 KB/s or keeping your pipeline responsive and accepting the fact that some files might not be downloaded or only after a few retry?</li><li><strong>ServicePointManager.DefaultConnectionLimit</strong> is something that I’ve only found by doing my homework, which reminded me that some APIs still have a learning curve, which you may or may not skip, but there’s a chance that your customer will pay the price.</li><li>Know the context. Just take my file downloading example. It’s essential to know how large are they. Are you saving them on disk. What’s your CDN’s performance and so on … With this information in mind, you’re chances are higher for getting the calibration of the timeouts and the default connection limit right.</li><li>Experiment with the given frameworks and APIs to find their strengths and weaknesses in time.</li><li>Lookout for <strong>IDisposable </strong>return types (there are exceptions to it of course: <a href="https://stackoverflow.com/questions/15705092/do-httpclient-and-httpclienthandler-have-to-be-disposed">https://stackoverflow.com/questions/15705092/do-httpclient-and-httpclienthandler-have-to-be-disposed</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c1712151039" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pitching PowerShell]]></title>
            <link>https://medium.com/@szntb/pitching-powershell-ae52962203a6?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae52962203a6</guid>
            <category><![CDATA[cmd]]></category>
            <category><![CDATA[scripting]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[powershell]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Sat, 26 Nov 2016 08:23:12 GMT</pubDate>
            <atom:updated>2016-11-26T08:23:12.859Z</atom:updated>
            <content:encoded><![CDATA[<p>Microsoft should have had a huge amount of self esteem to include “Power” in the name of their tool. Did they have the ground?</p><p>Well 10 points to Gryffindor (or Slytherin) because it’s been built on top of the .NET Framework. I find it interesting, because C# is my mother tongue. I can use some of the tools I’m accustomed to and there’s plenty of new super useful stuff. You also have the option just to use it as regular a “CMD”. Calling command line tools and whatnot.</p><p>Here’s my short Pitch to persuade you to use PowerShell over any other alternatives on Windows:</p><ol><li><strong>What does Redmond plan against us?</strong></li></ol><pre>Get-Process | Where {$_.Name -match “Microsoft.*”} | Sort CPU</pre><p><strong>2. Hush, hash</strong></p><pre>Get-FileHash MyProduct.msi -Algorithm MD5</pre><p><strong>3. Gimmie my JSON</strong></p><pre>“[{X: 10, Y: 5}, {X: 3, Y: 4}, {X: 101, Y: 44}]” | ConvertFrom-Json</pre><p><strong>4. Some XML love</strong></p><pre>([xml]”&lt;some&gt;&lt;number&gt;10&lt;/number&gt;&lt;/some&gt;”).some.number</pre><p><strong>5. Normalizing input strings</strong></p><pre>“ Spaces     can cause trouble “.Trim()<br># the Trim() you&#39;re calling is the String.Trim()</pre><p><strong>6. Be yourself, be unique — with the help of the .NET FCL</strong></p><pre>$uid = [guid]::NewGuid().Guid</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae52962203a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the IDisposable]]></title>
            <link>https://medium.com/@szntb/usingtheidisposablefirstpart-5a4ac69c495e?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a4ac69c495e</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Sat, 30 Jul 2016 14:38:19 GMT</pubDate>
            <atom:updated>2016-07-30T14:38:19.155Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using the IDisposable — Part I.</h3><p>I like reading code. Let it be doing code review, exploring 3rd parties, or just reading the <a href="http://referencesource.microsoft.com/">reference source</a>. You can learn so much from others. Those aha! moments are the best. In this blog post, I want to introduce you a neat trick, that I learned from a coworker. It involves the <a href="https://msdn.microsoft.com/en-us//library/yh598w02.aspx"><strong>using(…)</strong></a> statement and the <a href="https://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx"><strong>IDisposable</strong> interface</a>.</p><h4>Using temporary directories</h4><p>Temporary directories are useful, when it comes to importing data, making a copy of data or just providing throwaway storage. Take a look at the <strong>TemporaryDirectory</strong> class, which abstracts the notion of temporary directory into a type.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1eacf8228e5ba98b2ebed1bfb7dc5cf0/href">https://medium.com/media/1eacf8228e5ba98b2ebed1bfb7dc5cf0/href</a></iframe><p>Highlights:</p><ol><li>Check the constructor. A <strong>_real_</strong> directory will be created when an instance of the class is created. It’s not a pig in a poke.</li><li>The directory is accessible via the <strong>Path </strong>property.</li><li>The temporary directory implements the <strong>IDisposable</strong> interface, which gives a hint to the caller that it’s not a permanent directory. It has a lifespan and the object’s owner can control it. All by the power of C#.</li></ol><h4>Using the temporary directory abstraction</h4><p>Let’s put on a show and see how the <strong>TemporaryDirectory </strong>can be used. Let’s add an <strong>ApplicationStorage</strong> factory/manager class first as I want to create an even more powerful abstraction. The gains would be:</p><ul><li>The caller doesn’t have to be worried where the temp directory is created.</li><li>The <strong>ApplicationStorage </strong>could provide a mechanism, which would delete directories every now and then, if the Dipose() method would fail for some reason.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47acb5613e068976fce9e2454616732d/href">https://medium.com/media/47acb5613e068976fce9e2454616732d/href</a></iframe><p>The moment of truth:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/765406693614200803de93e1212cce51/href">https://medium.com/media/765406693614200803de93e1212cce51/href</a></iframe><h4>The cake is a lie</h4><p>What I really like is that the operation, which involves the usage of a temporary directory, is scoped. Once the business is done, everything is cleaned up. The temporary directory is gone. As there are different layers of responsibilities, it makes the design more decoupled. The layers of the cake we baked:</p><ul><li>Creating and deleting the directory</li><li>Defining where the temporary directories should reside</li><li>The actual work being done</li><li>Extra: application wide cleanup as a fallback</li></ul><h4>Readability matters</h4><p>By taking advantage of the <a href="https://msdn.microsoft.com/en-us//library/yh598w02.aspx">using</a> statement, we also made our code more readable and expressive. Nonetheless, you could implement it without all the fluff, however, it’s more code in the long run and hard on the eye and I wouldn’t be surprised if the code got copy pasted all over the code base in this form.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/20108e14a377550504cfac171ca0ed33/href">https://medium.com/media/20108e14a377550504cfac171ca0ed33/href</a></iframe><h4>Conclusions</h4><p>If you use the right LEGO parts together there’s a chance that you end up with readable and reusable code. In this post, the LEGO parts are the <strong>using statement</strong> and the <strong>IDisposable interface</strong>. Sometimes it’s not obvious how different pieces can be used for building powerful abstractions. That’s why I like reading code.</p><p>This was the first part of a blog post series. Next time I will bring another example of the using+IDisposable combo. Stay tuned.</p><p>Checkout the full source code. Questions? Comments? Concerns?</p><p><a href="https://github.com/szanto90balazs/UsingTheIDisposable">szanto90balazs/UsingTheIDisposable</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a4ac69c495e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rule your build scripts]]></title>
            <link>https://medium.com/@szntb/rule-your-build-scripts-96520980adda?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/96520980adda</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[scripting]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Fri, 17 Jun 2016 18:29:12 GMT</pubDate>
            <atom:updated>2016-06-19T06:59:59.340Z</atom:updated>
            <content:encoded><![CDATA[<p>Writing a simple C# desktop app has a pretty convenient workflow. After installing Visual Studio, you create a project using already available templates. You add some NuGet package dependencies. What comes next is writing C# code and running your app by pressing F5 every now and then. You don’t even have to touch the command line or setup pre-build or post-build tasks.</p><p>Working on ever growing applications alters the scene. You are ought to get your hands dirty. Not every dependency is a shiny NuGet package and you also have dependencies written in totally different languages. As brilliant ideas and new requirements surface on and off, you have to be flexible. Let’s say, you have to ship all the templates and fonts in the installer, but you don’t want to commit that extra 200 MB into your GitHub repository, don’t you?</p><p>Let’s take <a href="https://prezi.com/desktop/">Prezi for Windows</a> as an example. It’s a cloud-based desktop application. It’s mix of WPF and web technologies. It utilizes the Chromium Embedded Framework to embed a browser into the WPF application, which the prezi editor run on. Why do we need all the hassle? The prezi editor has been written in AS3/Flash. The application itself is a great mix of different technology stacks. We also support offline prezi document editing features, that’s why we ship fonts and many other assets in the installer.</p><p>We kept declaring more and more pre- and post-build steps in the project. Copy this, move that, execute {place-your-favourite-exe-here} as post processing. We incorporated automated tests and a auto updater framework. Other teams had been knocking on our door to provide a way of having a nightly build against their dependency.</p><p>The learning is that customers, dependent teams, and product teams have always big dreams and expectations towards applications, so change is inevitable. From the many challenges, which it imposes, I would like to deal the following two:</p><ul><li>How long does it take to build your application on a clean machine?</li><li>How many manual steps are required to build and maintain your application?</li></ul><h3>How long does it take to build your application on a clean machine?</h3><p>Let me be Captain Obvious here. The longer the build takes, the less you can get done. You will be more tempted to check up on {place-your-favourite-time drainer-website} while the app is building.</p><p>Adding more and more pre- and post-build step to your build would enormously slow down your regular pressing “F5” kind of workflow. For example, it’s not worth checking and pulling down the new fonts on every local build. Neither building your application against the latest version of dependencies. You don’t want to download the internet, over and over again.</p><p>By and large, these operations should be the part of setting up or updating your work-space and shouldn’t run on every “F5”.</p><h3>How many manual steps are required to build and maintain your application?</h3><p>Boring manual steps are the easiest to screw up and sometimes they go unnoticed, causing headaches later on. For example, if you have an x86 application, you can’t just tick a checkbox to allow your application to use more than 2 GB of memory. You have to run the <a href="https://msdn.microsoft.com/en-us/library/xd3shwhf.aspx">EditBin</a> tool to workaround the problem. If you want to do this by hand for every release, you’ll totally forget every now and then.</p><pre>#Running the EditBin tool<br>$TargetPath = &quot;C:\path\to\the\app.exe&quot;<br>EditBin &quot;$TargetPath&quot; /LARGEADDRESSAWARE</pre><h3>Scripts are here to rescue</h3><p>Scripts can be the answer to the questions. You can create scripts for initializing your workspace every now and then, so you don’t do anything time-consuming while you’re building your app. Usually, these scripts download files from various sources and organize them some way. Furthermore, scripts allow you to automate boring manual tasks like digitally signing the executables or releasing a new version.</p><p>When I first started fiddling with scripting I felt I was way out of my comfort zone. The lack of Intelli-Sense and the limited syntax highlighting in different editors are just the tip of the iceberg. The biggest problem for me is the absence of a type system, or proper compiler, which could point out my mistakes in time. I felt alone, in a dark room’s corner.</p><p>Over time, I adjusted and started to respect the scripts and I felt quite accomplished after automating something boring. However, the more script I wrote the more I’ve started drifting towards mayhem. My scripts were coming to bite me.</p><h3>When all hell breaks loose</h3><p>It’s Friday afternoon and you’ve been working hard all week to push out a release. You have a long week behind. You’re exhausted. The application is polished and it’s ready for the release. You have some scripts responsible for the process. You hit the big red button and start packing. Time to go home. The only problem is that the script failed. As you can’t leave it like that, you check the console and all you’re seeing is errors, that doesn’t make sense at all.</p><p>Your heart rate starts increasing. You can’t identify the exact problem and as a hopeless move, you start adding WriteLine’s to the release script. After modifying and re-running the script few times, you managed to release the application, although it’s 8 PM and your kids are crying for you at home.</p><p>It happened several times with me. My team and I had to suffer because of my lame scripts over and over again. I solved one problem and created two in return. Poorly written scripts are daunting and they can cause serious problems. Just like duct tape, flaky scripts provide temporary redemption followed by unexpected failures.</p><p>All I can say is that you should treat your scripts as your code.</p><h3>How to live a long and “scriptful” life</h3><p>I can thank the late night debugging sessions at least one thing. Over time I’ve picked up some practices how I can produce kind of well-behaving scripts. Let’s go through them.</p><h4><strong>Assert your hypothesis</strong></h4><p>What if a command returns JSON with different formats?<br>Is it acceptable if a command failed to run in a script, but it continues executing the next commands? Did it really copy the files to the server? Are the items in the returned list in the right order? Are you sure how given command line tools operate?</p><p>In languages like C#, most of your hypothesis are asserted by the compiler. When it comes to scripts, you have to validate thoroughly the results of commands.</p><p>For example, during the release process, I check whether by any chance some files would be overridden.</p><pre>if ((ExistsOnS3 &quot;releases&quot; &quot;Setup_1.0.0.0.exe&quot;)) {<br>    throw &quot;You cannot overwrite already released version=1.0.0.0&quot;<br>    exit 1<br>}</pre><pre>MoveInS3 &quot;rtm/Setup_1.0.0.0.exe&quot; &quot;releases/Setup_1.0.0.0.exe&quot;</pre><p>I’m also in favor of checking input parameters of scripts. It can be really helpful when you start tweaking your script files and you don’t call the given script with the right parameters.</p><pre>AssertNotNullOrEmpty $version &quot;Version is null or empty&quot;<br>AssertNotNullOrEmpty $gitSha &quot;Git sha is null or empty&quot;<br>AssertNotNullOrEmpty $awsConfigPath &quot;awsConfigPath is null or empty&quot;<br>AssertFileExists $awsConfigPath</pre><p>My point is that it’s better to fail early than letting the scripts run and do harm. Assertions also help you identify the source of the problem.</p><h4><strong>Try to break it, before you release it</strong></h4><p>Which situation would you prefer to be in? Trying to break the script before committing it to your repository, or walk away the thorough testing and risking the chance of a potential debugging session, let’s say in a half year?<br>Sometimes you are urged to get things done _ASAP_. For example, you have to release a critical security patch, but you’re held back as your scripts failing to run for whatever reason. How much effort should be put into testing the given script? You should answer one simple question.</p><blockquote>Is it critical If I can’t run the XYZ script anytime?</blockquote><p>It’s always problematic if you can’t release a security fix. However, it’s not a nightmare if the translated resource strings are not auto-magically committed into your repository on weekends.</p><p>Having false assumptions towards commands is the recipe for disaster. Let me tell you the story of how the introduction of version 6.10.0.0 broke our release process. After every release, we tag our repository with the released version number. During our build process, we obtain the latest released version from the git tags and we use that version to calculate the next version number. This is how we obtained the latest released version number.</p><pre>$tags = git tag | Where { $_ -match ‘(\d+)\.(\d+)\.(\d+)\.(\d+)’ }<br>$latestVersion = $tags[-1]</pre><p>After releasing 6.10.0.0, our installer scripts started to fail. We’ve realized that the git tag command doesn’t work as we expected. When I issued the git tag command, this is what I saw and I laughed (left out some versions)</p><pre>PS D:\repos\awesome-project&gt; git tag<br>6.0.0.0<br>6.1.0.0<br>6.10.0.0<br>6.2.0.0<br>6.9.0.0</pre><p>We wrongly assumed that the tags are sorted by the date added. It turned out that it’s sorted alphabetically. The fix was an easy one. I used the built in System.Version type for getting the list sorted by the right way.</p><pre>$tags= git tag<br>$versions = $tags | Where { $_ -match ‘(\d+)\.(\d+)\.(\d+)\.(\d+)’ }<br>$sortedVersions = $versions | %{[System.Version]$_} | sort<br>$latestVersion = $sortedVersions[-1]</pre><h4><strong>Breadcrumbs</strong></h4><p>You will experience errors, I’m sure. When everything gets out of your hand, you should at least be able to point to an exact problem. I sprinkle breadcrumbs in my scripts in forms of WriteLine’s and assertions, so when the shit hits the fan, I know where to start digging. Some examples:</p><pre>#Instead of being general<br>echo &quot;Uploading the installer...&quot;</pre><pre>#Prefer to be more contextual<br>echo &quot;Uploading the installer&quot;<br>echo &quot;To https://cdn.somewhere.com/Setup_5.0.0.0.exe&quot;<br>echo &quot;Installer hash $installerHash&quot;<br>echo &quot;Installer size $installerSize&quot;<br>echo &quot;Installer file path $installerFilePath&quot;</pre><pre>#Assertions are your buddies<br>#It&#39;s better letting your scripts fail, than risking them to do some damage</pre><pre>#My favorite assertion is for checking the last exit code of a command</pre><pre>$workingDirectory = (Get-Item .).FullName<br>function ExitIfLastExitCodeIsNotZero<br>{<br>    #LastExitCode is populated by PowerShell<br>    #If(!$?)... could be used as well, but it looks odd   <br>    If ($LastExitCode -ne 0)<br>    {<br>        Get-PSCallstack #provide some context for this call<br>        cd $workingDirectory<br>        throw &quot;Last exit code was not 0 - I need human intervention&quot;<br>        exit 1<br>    }<br>}</pre><pre>#This is how it&#39;s used<br>doSomeSeriousStuff.exe<br>ExitIfLastExitCodeIsNotZero</pre><h4><strong>Isolate your scripts</strong></h4><p>Have small LEGO parts. Not only does it allow you to easily test them, but you can also try them out one by one. It takes much more time to run the whole set of your scripts, than testing the isolated parts. It’s also worth mentioning that big files tend to grow over time. Law of physics, or whatnot.</p><h4><strong>Follow the DRY principle</strong></h4><p>Don’t (always) repeat yourself. Even though you can leverage the power of REGEX, when you want to replace something across your scripts, I’d rather suggest you following the DRY principle to some degree.</p><p>For example, when you have scripts responsible for generating installers, you should have a separate &lt;pick one: JSON/INI/PROPERTIES/PS1&gt; file containing the name of the product, the name of the company, the current version, etc.</p><p>I also tend to keep a biggish common.ps1 script around, which contains utilities used by different scripts. Let’s see few examples:</p><pre>function CleanUpFolder($folderPath)<br>{<br>   if (Test-Path $folderPath) { <br>       rm -r $folderPath <br>   }</pre><pre>   mkdir $folderPath<br>}</pre><pre>function GetS3FileMetaData($path, $bucket) <br>{<br>    WriteLine “Getting metadata for bucket: $bucket path: $path”<br> <br>    $metaDataRaw = ((aws s3api head-object — bucket “$bucket” — key “$path”) | Out-String)<br>    ExitIfLastExitCodeIsNotZero</pre><pre>    $metaDataObject = $metaDataRaw | ConvertFrom-Json</pre><pre>    return $metaDataObject<br>}</pre><h4>Avoid having hierarchical dependencies</h4><p>When someone depends on your piece of code in any way, it’s more challenging for you and any other fellow developers to modify it. If you work at a big company, you might rely on other teams work. The more popular your code is, the higher the chances of stepping on each other’s toes. My problem with cross-team dependencies is that even small changes can cause havoc at other teams ends. This is the time when copy paste is here to rescue. #copypastepattern</p><h4><strong>Have full control over the external tools you use</strong></h4><p>It’s important to have the same tools both on your developer machine and on your production machine / Continuous Integration slave machine. In one of the projects, I’ve started centralizing the tools we use in our build and release scripts. It’s good for several reasons. For example, if something changes in your CI infrastructure, you can instantly point it out, that your scripts are failing, because some tools haven’t been installed on the new CI machines. Different software versions can cause troubles as well.</p><pre>$NUGET = “C:\Program Files (x86)\NuGet\nuget.exe”<br>if (!(Test-Path $NUGET)) {<br> throw “NUGET IS NOT INSTALLED: $NUGET”<br> exit 1<br>}</pre><pre>#Usage<br>&amp;$NUGET restore</pre><h4><strong>Write tests</strong></h4><blockquote>“If wishes were fishes, we’d all cast nets.” — Frank Herbert</blockquote><h4><strong>Learn about tools and the scripting environment</strong></h4><p>Some tools are extremely easy to start with, which make you productive and also gives you a false illusion of experience and expertise. Every tool and environment have their own quirks. Even if you’ll learn them in a hard way, invest in mastering a skill, if you feel it’ll be used extensively.</p><p>PowerShell is my love of choice, although it required some getting used to. It had certainly some quirks. The most painful was for me to learn the <a href="http://stackoverflow.com/questions/10286164/function-return-value-in-powershell">return semantics</a> in PowerShell with my C# mindset. Actually, it caused some weird bugs in my scripts. Not once, not twice, …</p><h3>Szántó Balázs on Twitter</h3><p>This is the second time I burned myself with powershell and because of the same reason: http://stackoverflow.com/questions/10286164/powershell-function-return-value ... #lifelonglearning #why</p><h4><strong>Scripts should be able to run both locally and on your CI</strong></h4><p>For example in Jenkins, you can create jobs which can run arbitrary scripts. In these cases that scripts are not stored in your Git repository, but actually somewhere else. I like to keep my scripts in my applications repository. It’s likely that the changes made to the scripts will be reviewed by others as they will see the pull request. In addition to that, as you have the scripts files in your repository, you can easily try them out on your local development environment.</p><h4><strong>Make it fast — take advantage of caching</strong></h4><p>The more time your job requires to run to completion, the higher the chances that some CI error will happen (node disconnected, timeout, …) You should also not download the same resources over and over again.</p><h4>Write scripts in a proper text editor</h4><p>For example PowerShell support is incredible in <a href="https://code.visualstudio.com/">VS Code </a>or in the PowerShell ISE as they provide basic Intelli-Sense kind of support. Notepad is awesome, but you can get rid of some very basic typos by using a decent editor.</p><h4>Follow the Unix philosophy</h4><p>Probably I should have started with the <a href="https://en.wikipedia.org/wiki/Unix_philosophy">UNIX philosophy</a>, but people might learn more from their mistakes than from the books, just like me. Keep iterating.</p><h3>I’m confused, should I use scripts or not?</h3><p>Yes. No. Read the small print.</p><p>By using scripts you can get rid of manual, boring and repetitive work. I wasn’t used to scripting, but I felt pretty much productive immediately after started writing scripts.</p><p>Although every now and then I had to face hard debugging sessions, it felt entertaining and I was the hero, who fixed the script. I replaced the boring work, with more entertaining one. However, I had to come to the realization, that I wasn’t able to do less by scripting overall. Actually, in some cases, it generated an extra amount of shit to take care of.</p><p>Hopefully, I managed to identify few key practices over time, which now allows me to write painless scripts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96520980adda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choose reading as your New Year’s resolution]]></title>
            <link>https://medium.com/@szntb/choose-reading-as-your-new-year-s-resolution-a1ebd2d768bf?source=rss-93c006b11a13------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1ebd2d768bf</guid>
            <category><![CDATA[resolutions]]></category>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[books]]></category>
            <dc:creator><![CDATA[Szántó Balázs]]></dc:creator>
            <pubDate>Sat, 30 Jan 2016 15:22:34 GMT</pubDate>
            <atom:updated>2016-01-30T15:23:12.809Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m keen on losing the 5 kgs that have somewhat magically appeared on me. No more burgers, for the love of God. Enough of the countless hours spent in the office. From now on the family is everything. I must quit smoking. Let’s do sports. Enjoy life.</p><p>Yes, you’re not late. It’s high time for your New Year’s resolution. I can see the common pattern however in these promises. They won’t have been achieved. It’s not a surprise that there is no such tradition as New Year’s accountability.</p><blockquote><strong><em>May all your troubles last as long as your New Year’s resolutions.</em></strong><em><br></em>Joey Adams</blockquote><p>As a dreamer, I kept coming up with promises and goals. Silly ideas like creating a nice mobile application for basketball players, owning a blog, don’t get me started on this. All in all, I’ve never been a New Year’s resolution guy, it’s not my cup of tea. Dreaming is better. Nevertheless, I ended up creating a list of 14 Goals I’d love to pursue.</p><p>Stupid me. Foolish me. Brilliant me. I’ve managed to accomplish 8 though, and I’m particularly happy about one of them. A goal that is not as meaningful at first sight as it should be. Might not be as ostentatious as a proper New Year’s Resolution should be, on the other hand, it’s surprised me after every milestone. I’ve traded my time to entertainment, enlightenment and relaxation.</p><h3><strong>It was reading 10 arbitrary books in 2015.</strong></h3><blockquote><strong><em>A goal without a plan is just a wish.</em></strong><br>Antoine de Saint-Exupery</blockquote><p>I came across closely GoodReads and suddenly the project codenamed WannaBeBookWorm™ kicked off without me realizing it. I bootstrapped my <a href="https://www.goodreads.com/review/list/37695592-sz-nt-bal-zs?shelf=%23ALL%23">reading list</a> at the end of December with books worth reading. After coming up with the goal of reading 10 books, it instantly hit that books were waiting to be discovered all along.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owDFTJ7ZxOjF4rM-QvX6pA.jpeg" /></figure><p>The IMDB for books has certainly changed the way I read. No need to leave the sofa. Pick a title, buy it and enjoy it on your Kindle. Just like scrolling through reviews on Amazon, you can only pick great books with 4.5+ ratings from different genres. Time saved, money kept.</p><p>I somehow look at GoodReads as my mentor, my coach, my opponent and my cheerleader. Not only passionate, but detailed recommendations and reviews are there to guide you. You can collect the well-deserved likes for the books read and why wouldn’t you say no to finishing your reading challenge earlier than your friends.</p><blockquote><strong><em>It’s the job that’s never started as takes longest to finish.</em><br></strong> J.R.R. Tolkien</blockquote><p>My adventure started with a beast. 736 pages of in-depth NBA history including thorough player reviews and delicacies. I learned the reason behind the shot clock. It was about time to know why every basketball player treats the ball as a hot potato. After finishing the book my inner dream of becoming Michael Jordan, Larry Bird or Magic Johnson in one ultimate basketball hero surfaced again. All because of a book. It was also a special time for me as I’d been visiting San Francisco at the time and I was thrilled to go to my first NBA game to see Chef Curry hitting deep threes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*bEZZDCMDAF3a0-QvbDvT_Q.jpeg" /></figure><p>I immediately started thinking what should be come up next. Choosing the next book has never been such a fun activity. It totally sucks me in even now as it’s become a ritual. Browsing the titles from the reading list. Checking the reviews. Virtually engaging in <a href="https://www.reddit.com/r/books">Reddit conversations</a>. All this is fun and on top of that, I’d got a sense for books which would fit my taste and my current emotional state. It’s good to know beforehand whether a book is slow paced or not. You might need something that pumps you up, wouldn’t you? If you don’t want to make a ritual out of choosing your next book just pick one title from <a href="https://www.goodreads.com/choiceawards/best-books-2015">GoodReads Choice Awards</a> or check out <a href="https://www.reddit.com/r/books/comments/3yl6au/the_rbooks_bookclub_selection_for_january_is_the/">Reddit book club selection</a>. How about just simply popping into the next bookstore in the neighbourhood?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YPRjvNbWvog4d1U56tcEQ.jpeg" /><figcaption>Photo by <a href="https://www.flickr.com/photos/rene-germany/">Rene Schwietzke</a> - <a href="https://flic.kr/p/4gTA8x">https://flic.kr/p/4gTA8x</a></figcaption></figure><p>Wait a minute. Let’s take a step back here. Why 10 books, when we have twelve months in a year? I could have read one book every month. Even more. There should be a but or an if in this story. Actually, there isn’t. I just wanted to be realistic. So let’s stick with 10. Easy peasy lemon squeezy.</p><p>You might also be wondering why I should even come up with a particular number at all? Isn’t it all about having fun and learning stuff? Developing your personality and whatnot? Sure, that’s the most important thing, the road ahead and not the formalities. Bazinga.</p><p>Having declared the number of titles pushes you towards the holy goal of succeeding. As the goal becomes more specific, the stakes are raised higher, so as the chances of succeeding. By 999999999%. Not kidding. Prepare for the moment of friends asking you in a bar what’s up with your book thingy. By giving a confident 10/7 answer, I bet you would certainly experience a sense of achievement. The goals suddenly develop into a real and measurable activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KNLOhQK8adgkcSENATKOA.png" /></figure><p>Unleash you inner data Jedi, define metrics and measure your progress. Say it out loud. By the time it’s March I should be reading the 4th book. I usually take a look at which page I’m at in the book. Thanks to my Kindle and the Kindle app, I know for a fact the amount of time it takes to finish a chapter. I’m aware that I’m 70% through the book and in 2 minutes I’ll put my suffering to an end with the geeky WPF programming book. Personally I like to allocate longer time slots for reading. If I don’t have enough time to finish a chapter, I might not start it at that very moment. It’s also thrilling when it’s only 5% and I’m feeling like a little boy getting his hands on his new toy and embracing a high level of excitement. Crunching the numbers is good for your health. I promise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwWQhz3js5kJaUlFkdxYIg.png" /></figure><p>Throughout the year, I’ve tried to be reasonable and I know when it was time to kick off the new book to be on schedule. It’s very easy to check how realistic it is to hit the deadline given how many books and pages you have to get through. It’s not like software projects when delivering the last 20% of features would eat up enormous resources. With books it’s different, as you’re the one who chooses the book, it’s already given how long the book is, that’s why it’s not a pig in a poke. It’s highly unlikely that you come across a horrible book which will deter you from reading books forever. My point is that you don’t have to try hard to get through compelling books. In a supportive environment, you’re deemed to succeed. To me, it was a low hanging fruit to include reading books in my goals. I just didn’t know back then.</p><blockquote><strong><em>Achievement unlocked</em></strong><br>Xbox</blockquote><p>Reading is a super power. You take a bunch of papers stitched together and create whole words out of the ink. Not only does it allow your imagination to fly, but it’s there for you whatever you name it for.</p><p>It allowed me to broaden my horizon professionally and personally. I’ve read two programming related books, which I open up every now and then. To be able to understand the gap between developers, designers and users I’ve picked up <a href="https://www.goodreads.com/book/show/840.The_Design_of_Everyday_Things">The Design of Everyday Things</a>.</p><blockquote><strong><em>Design is really an act of communication, which means having a deep understanding of the person with whom the designer is communicating.<br></em></strong>The Design of Everyday Things by Donald A. Norman</blockquote><p>Other times I only wanted to unwind, but couldn’t because I was unable to stop thinking about work. Science fiction is my way to escape. When you read about a planet, which is basically a desert and its inhabitants have to recycle their body fluids to pull through, then your imagination starts kicking in. All the crap’s left behind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*hn4fA62PNScEdWydEYWMoQ.jpeg" /></figure><p>Elaborating on how good a decision it was to kick off this project made me realise that I have to share my story. Reading books are prooven to be fun, relevant, achievable and realistic. Despite the fact, that it was just a goal to achive it evolved over time, it became totally fun and relevant to me.</p><p>I highly recommend to consider reading as your New Year’s resolution. Challenge yourself just like Mark Zuckerberg <a href="https://www.facebook.com/zuck/posts/10101828640656261">did</a> or Bill Gates <a href="https://www.gatesnotes.com/Books">does</a>. <strong>1,725,239</strong> people did the same and finished <strong>29,173,675 </strong>books on <a href="https://www.goodreads.com/challenges/3082-2015-reading-challenge">GoodReads</a>. The random dude from the internet will do the same. Let’s read 15 books in 2016.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLAkc6uk-MzoOi4YjnXbWw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ebd2d768bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>