<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Robin Palotai</title>
    <description>The latest articles on DEV Community by Robin Palotai (@bootcode).</description>
    <link>https://dev.to/bootcode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F161415%2Fd518011a-527c-492c-a7e9-e2bea411de35.jpg</url>
      <title>DEV Community: Robin Palotai</title>
      <link>https://dev.to/bootcode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bootcode"/>
    <language>en</language>
    <item>
      <title>How to be a Better Husband &amp; Why it Makes Daily Standups Foolish</title>
      <dc:creator>Robin Palotai</dc:creator>
      <pubDate>Thu, 07 Nov 2019 09:55:20 +0000</pubDate>
      <link>https://dev.to/bootcode/how-to-be-a-better-husband-why-it-makes-daily-standups-foolish-5d0j</link>
      <guid>https://dev.to/bootcode/how-to-be-a-better-husband-why-it-makes-daily-standups-foolish-5d0j</guid>
      <description>&lt;p&gt;To the day I remember my turn in a daily standup 10 years ago, feeling quite foolish. As per the book, I should have said something like &lt;em&gt;"Yesterday I fixed the indexer bug and updated the user documentation, and today I'm going to add batch support to the load pipeline."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But in reality, I said &lt;em&gt;"Yesterday I was working on the indexer bug, and I will continue so today."&lt;/em&gt;, &lt;strong&gt;for the third day in a row&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So was I really working on the indexer bug all that time? Or was I just slacking? How does this relate to becoming a better husband? You will find out after a short detour.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rdgA9msO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m05cnewlvt2hlel8kt9b.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rdgA9msO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m05cnewlvt2hlel8kt9b.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While I don't agree on all of the points delivered in &lt;a href="https://www.theguardian.com/world/2017/may/26/gender-wars-household-chores-comic"&gt;The gender wars of household chores&lt;/a&gt;, it is an enlightening read with a practical takeaway.&lt;/p&gt;

&lt;p&gt;I'll summarize below, but maybe you want to read it yourself first. If inpatient, jump to the &lt;em&gt;"...when I decide to take care of a simple chore.."&lt;/em&gt; part. The header image of this article is taken from that part as well.&lt;/p&gt;

&lt;p&gt;(Waiting here for you to return.)&lt;/p&gt;

&lt;p&gt;The illustration depicts that usually, when a husband is asked to fill the washing machine, he does so and that's it. In contrast, the wife would pick up all sorts of accidental chores on the way there, like refilling soap, putting away toys lying accross the floor, etc. &lt;strong&gt;What started out as a single chore became a bunch of loosely related tasks due to it made sense to batch them.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now you might suspect how this relates to programming.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rdgA9msO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m05cnewlvt2hlel8kt9b.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rdgA9msO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m05cnewlvt2hlel8kt9b.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ideally, we are expected to come up with a plan, estimate the time it would take, and execute precisely. But let me tell about &lt;a href="https://www.fowllanguagecomics.com/comic/working-week/"&gt;my day yesterday&lt;/a&gt; (even if it was not a Monday). &lt;/p&gt;

&lt;p&gt;While sipping the last drops of coffee in the morning, I drew a small dependency graph of recent tasks, and concluded that working on indexing (again) is the most important. As I reached for the keyboard, an email popped in carrying a &lt;strong&gt;UI bug report from a user&lt;/strong&gt;. As a usability bug trumps backend improvements, I started on it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Technical detail):&lt;/em&gt; The bug was about some input element acting up after the user tabs away from the browser and back. Indeed, when tabbing, first the element loses focus, then the window, finally they get it back in reverse order. But from the user's perspective, there was no focusing happening, so the action specified in &lt;code&gt;onfocus&lt;/code&gt; didn't make sense.&lt;/p&gt;

&lt;p&gt;Fine, I started adding a UI test to replicate the behavior. But as it turns out, creating a new tab using &lt;code&gt;puppeteer&lt;/code&gt; &lt;a href="https://github.com/GoogleChrome/puppeteer/issues/1462"&gt;doesn't trigger&lt;/a&gt; the &lt;code&gt;window.blur&lt;/code&gt; or &lt;code&gt;focus&lt;/code&gt; events. &lt;strong&gt;Ok, this is not my fight&lt;/strong&gt;, so added this test to the list of manual tests.&lt;/p&gt;

&lt;p&gt;To fix the bug, I began to add some complicated logic about detecting this focusing situation. But &lt;strong&gt;it became nasty quickly, so I took a step back&lt;/strong&gt;. I started fixing focus, since we used focus in the first place. But I could just change the element to react to &lt;code&gt;click&lt;/code&gt; instead of focus. That avoided lots of trouble and made the code simpler.&lt;/p&gt;

&lt;p&gt;While trying to run the integration tests, I stumbled upon &lt;a href="https://twitter.com/bootcode/status/1192004713283293185"&gt;some caching issue&lt;/a&gt; in the build system. &lt;strong&gt;I couldn't let that lie around&lt;/strong&gt;, so took some time to devise a fix.&lt;/p&gt;

&lt;p&gt;Time to push a release then! But it would nag the users to reload the UI, and I wanted to do some other UI updates. So it made sense to do those and do a batched release.&lt;/p&gt;

&lt;p&gt;I'm not going into further details about those (adding a privacy policy, now that we have a great one, or cleaning some spooky skeletons around session handling). But &lt;strong&gt;you can see how a small task snowballs into a set of changes that just makes sense to do while you are there in the context.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rdgA9msO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m05cnewlvt2hlel8kt9b.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rdgA9msO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m05cnewlvt2hlel8kt9b.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So was I slacking back then? Maybe. Probably. But more likely I was stumbling into a cascade of unforeseen issues, reporting other bugs I encountered to be revisited later, running the tests and fixing the test runner, etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  What are the takeaways?
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;(Read the free sample of my in-progress book &lt;a href="https://treetide.com/book/programming-without-anxiety"&gt;Programming without Anxiety&lt;/a&gt; for more tips.)&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unscheduled - or even unnoticed - tasks slow down&lt;/strong&gt; completion of the original goal. &lt;strong&gt;But performing them while in the right mental context pays off&lt;/strong&gt; on the long run. That said, &lt;strong&gt;if you are not in the right context, rather file a bug&lt;/strong&gt; report about them for later.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When hitting an unexpected task, &lt;strong&gt;take a step back&lt;/strong&gt; and ask: Is there any alternative solution? Is this the right time for this fight? &lt;strong&gt;Otherwise, you can be down the rabbit hole quickly&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;(Attribution: Hungarian folklore pattern from an artist on &lt;a href="https://www.meska.hu/t600908-piros-kalocsai-minta-falmatrica"&gt;Meska&lt;/a&gt;, the Hungarian Etsy; Header image from &lt;a href="https://www.theguardian.com/world/2017/may/26/gender-wars-household-chores-comic"&gt;The gender wars of household chores&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>programming</category>
      <category>gender</category>
    </item>
    <item>
      <title>Mastering Back of the Envelope Calculation for System Design Interviews</title>
      <dc:creator>Robin Palotai</dc:creator>
      <pubDate>Tue, 24 Sep 2019 07:31:01 +0000</pubDate>
      <link>https://dev.to/bootcode/mastering-back-of-the-envelope-calculation-for-system-design-interviews-37je</link>
      <guid>https://dev.to/bootcode/mastering-back-of-the-envelope-calculation-for-system-design-interviews-37je</guid>
      <description>&lt;p&gt;Back of the envelope calculation:&lt;br&gt;&lt;br&gt;
 ~ A quick and approximate calculation that gives us further insight.       &lt;/p&gt;

&lt;p&gt;It is named so, since you can typically carry out the calculations on the back of an envelope or a napkin. &lt;em&gt;Note: for interviews, these should be called Side of the Whiteboard Calculations.&lt;/em&gt;        &lt;/p&gt;

&lt;h5&gt;
  
  
  Why do we need it?
&lt;/h5&gt;

&lt;p&gt;Sometimes we face a choice between alternative architectures. At simplest, we can ask if a single server is sufficient? If not, &lt;strong&gt;how many servers would we need?&lt;/strong&gt; A quick calculation gives us a rough estimate.              &lt;/p&gt;

&lt;p&gt;Generally, the calculation tells us&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the architecture can fulfill the functional requirements, for example number of supported users, response latency,&lt;/li&gt;
&lt;li&gt;the resource requirements.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  How to do it?
&lt;/h5&gt;

&lt;p&gt;First, we need to &lt;strong&gt;recognize a limited resource in our system, then approximate the actual usage&lt;/strong&gt;. For example, our servers are capped by 2GHz CPUs, and we would like to know if we can serve all user requests using a single server.                                                        &lt;/p&gt;

&lt;p&gt;So how to approximate the actual usage? We need to &lt;strong&gt;break down the usage to its constituting factors, make a rough estimate of those factors&lt;/strong&gt; (if needed, further breaking them down), and combining them.                     &lt;/p&gt;

&lt;p&gt;For example, we might expect to have 1K active users, each issuing 15 requests per day. That's 15K requests per day, or 15K/86400 requests per second.&lt;/p&gt;

&lt;p&gt;When combining the parts, &lt;strong&gt;a trick is to round aggressively&lt;/strong&gt;. Noone wants to divide by 86400. So let's round to 20K/100K, leaving 0.2 seconds time    available to serve a single request. If we know that a single request roughly takes 0.7 seconds to serve, we need to bring up at least 4 machines. Of course you don't want to live on the edge, so let's add some buffer and make that 10 machines (which is also a nicer number).&lt;/p&gt;

&lt;h5&gt;
  
  
  On quick operations
&lt;/h5&gt;

&lt;p&gt;Prefer using &lt;strong&gt;small numbers along with abbreviation for magnitude&lt;/strong&gt; (or, if needed, exponents) rather than writing out a full number. 10K instead of 10000.&lt;/p&gt;

&lt;p&gt;If given a large and overly-precise number, for example 7432, instantly convert and write it down as 7K. You are approximating anyway.&lt;/p&gt;

&lt;p&gt;Having numbers in this form &lt;strong&gt;makes multiplication and division fast&lt;/strong&gt;.  K*K is M. G/M is K. 4K*7M=28G. To work with larger numbers, round both of them towards a small multiple of a power of 2 or 10.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;27*14 ~ 30*10 = 300.&lt;/li&gt;
&lt;li&gt;6500/250 ~ 6400/256 ~ 100 * 2^6 / 2^8 ~ 100 / 2^2 = 25.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Dimensions to approximate
&lt;/h5&gt;

&lt;p&gt;Find typical limited dimensions, along with exercises below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Network bandwidth&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Assuming 1Gbps link per machine, if we want to crawl 70TB of websites every day, how many machines would a crawler system need?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Storage space&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;How much space would it take to store the contents of 100M web pages?  What if we substitute each word by an integer index? How many machines of 64GB SSD would it fit?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;IO throughput&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You store fetched web pages on a mechanical hard drive, with limited random access speed. Users issue requests with 100 query per sec (qps), each request typically returning the content of 20 pages. How many hard drives would you need to keep request latency low?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Engineering effort.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You need to deliver a new feature. There are 5 programmers and 40 tasks.  How many weeks until possible launch?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Money.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A user pays $10 a month for your image store service, storing all their photos, each downsized to 3MB. During a month a user fetches 1K photos. Find the pricing page of your favorite cloud provider, and calculate the cost associated with each user. How much is your revenue per user? Check for different assumed photo counts.&lt;/p&gt;

&lt;p&gt;Others include &lt;strong&gt;CPU time, RAM size, latencies of various kinds&lt;/strong&gt; (disk access, RAM access, network), thread count.&lt;/p&gt;

&lt;h5&gt;
  
  
  Where to start?
&lt;/h5&gt;

&lt;p&gt;Enumerate typical &lt;strong&gt;use-cases of the system and determine the most critical resources they need&lt;/strong&gt;. A document store will need lots of storage. Guesstimating document sizes and counts is a good start, but further details will depend on usage. How often are new documents added? Are the documents searchable? Do we need any indices? Is it a write-heavy or read-heavy store?&lt;/p&gt;

&lt;p&gt;Different use-cases will likely need very different shapes of resources. For example, serving the documents might need lots of RAM but not CPU, while preprocessing of new documents just the other way around. Hosting all those services on homogeneous machines would waste both CPU and RAM, since you need to get machines which are maxed on both dimensions.&lt;/p&gt;

&lt;p&gt;Such differences indicate those features should be split to different services, hosted on independent sets of machines.&lt;/p&gt;

&lt;h5&gt;
  
  
  Real data
&lt;/h5&gt;

&lt;p&gt;Outside of system design interviews, you can reach out to &lt;a href="https://dilbert.com/strip/2010-08-11"&gt;actual data&lt;/a&gt;. Spend some time mining the monitoring dashboards to get usual CPU usage. Perform a load test to measure peak RAM consumption. Run a SQL query to get the average number of photos stored by user.&lt;/p&gt;

&lt;p&gt;It doesn't need to be an either-or. Complement assumptions with data-backed facts if needed.&lt;/p&gt;

&lt;h5&gt;
  
  
  Useful resources
&lt;/h5&gt;

&lt;p&gt;A summary of &lt;a href="https://gist.github.com/jboner/2841832"&gt;numbers every engineer should know&lt;/a&gt;. Or know where to look up ;)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: Originally appeared at &lt;a href="https://treetide.com/posts/back-of-envelope-calculation"&gt;https://treetide.com/posts/back-of-envelope-calculation&lt;/a&gt;, which I wrote in response to a mentoring session I held at &lt;a href="https://www.codementor.io/robinpalotai"&gt;CodeMentor.io&lt;/a&gt;. I'm available for 1:1 sessions there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>computerscience</category>
      <category>interview</category>
      <category>education</category>
    </item>
    <item>
      <title>Your Textbooks Might Be Outdated</title>
      <dc:creator>Robin Palotai</dc:creator>
      <pubDate>Mon, 09 Sep 2019 11:52:07 +0000</pubDate>
      <link>https://dev.to/bootcode/your-textbooks-might-be-outdated-1ob1</link>
      <guid>https://dev.to/bootcode/your-textbooks-might-be-outdated-1ob1</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally appeared as part of &lt;a href="https://treetide.com/posts/getting-max-from-education"&gt;Getting the Max out from Education&lt;/a&gt; on treetide.com.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As Paul Graham puts it in his excellent &lt;a href="http://www.paulgraham.com/hs.html"&gt;high-school graduation speech&lt;/a&gt;, even college textbooks are bad.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When you get to college, you'll find that (with a few stellar exceptions) the textbooks are not written by the leading scholars in the field they describe. Writing college textbooks is unpleasant work, done mostly by people who need the money.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here's my take on how to get the most out of your education by finding the best material. We'll take the &lt;em&gt;Operating Systems&lt;/em&gt; class as our scapegoat:&lt;/p&gt;

&lt;h4&gt;
  
  
  Don't assume your textbooks or curriculum is of the best quality.
&lt;/h4&gt;

&lt;p&gt;What textbooks do people advise on forums? A &lt;a href="https://www.reddit.com/r/books/comments/d2jlf/best_introductory_textbooks_to_your_field_ill/"&gt;search on reddit&lt;/a&gt; can be insightful. Ask around in your private student group as well!&lt;/p&gt;

&lt;p&gt;What do other institutions teach? Google &lt;a href="https://www.google.com/search?q=operating+systems+cs+inurl%3Aedu%24"&gt;&lt;em&gt;"operating systems cs inurl:edu$"&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Try to get hold of a heavy book.
&lt;/h4&gt;

&lt;p&gt;Books take effort to write, and are hard to update. These makes it likely that the content went through proper editing and lays out time-tested foundations. Amazon seems to have a nice selection here.&lt;/p&gt;

&lt;p&gt;Once you have the book, don't hold back. Pop it open at interesting chapters, use the highlighter, scribble your questions and ideas all over the margins!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(If you like these tips, &lt;a href="https://treetide.com/subscribe"&gt;subscribe to TreeTide articles&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Complement solid material with a peek into research.
&lt;/h4&gt;

&lt;p&gt;Your class materials are likely behind state of the art. Look around for survey papers on &lt;a href="https://scholar.google.com"&gt;Google Scholar&lt;/a&gt; or &lt;a href="https://arxiv.org/"&gt;Arxiv.org&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the Operating Systems class I would search for "&lt;a href="https://scholar.google.com/scholar?q=operating+systems+survey"&gt;Operating Systems Survey&lt;/a&gt;". Even a peek at the results indicates an emerging trend of embedded/IoT OS research, which might be useful insight. It's ok if you don't understand most of a paper, but you will draw inspiration and see contemporary problems.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Image credits: Tom Murphy VII / Wikimedia Commons &lt;a href="http://creativecommons.org/licenses/by-sa/3.0/"&gt;CC BY-SA 3.0&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>education</category>
      <category>career</category>
      <category>beginners</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
