index.html 17.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
<title>An intern's views - How far have I come? - VARSTACK</title>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); = id;
js.src = "//";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
var host = "";
var hostwww = "";
if (((host == || (hostwww ==
        && (window.location.protocol != 'https:'
            || window.location.toString().match(/http.?:\/\/var/))){
  window.location = window.location.toString().replace(/^http:/, "https:").replace(/https:\/\/varstack/, "https://www.varstack");
<meta name=viewport content="width=device-width, initial-scale=1">
<meta charset="utf-8"/>

    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/highlighting.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">

<script id="loadcss">function loadCSS(e,n,o,t){"use strict";var d=window.document.createElement("link"),i=n||window.document.getElementsByTagName("script")[0],r=window.document.styleSheets;return d.rel="stylesheet",d.href=e,"only x",t&&(d.onload=t),i.parentNode.insertBefore(d,i),d.onloadcssdefined=function(e){for(var n,o=0;o<r.length;o++)r[o].href&&r[o].href===d.href&&(n=!0);n?e():setTimeout(function(){d.onloadcssdefined(e)})},d.onloadcssdefined(function(){||"all"}),d}
loadCSS( "", document.getElementById("loadcss"));
loadCSS( "/css/highlighting.css", document.getElementById("loadcss"));
loadCSS( "/css/style.css", document.getElementById("loadcss"));

<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
    <script src="//"></script>

    <div class="container">
        <div class="row" id="menu">
            <div class="col-sm-2 col-xs-2 menu" id="site_title">
                <a href="/" style="color:black;">
                    <img src="/img/logo.png" style="max-height:90%;">
            <div class="col-sm-6 col-xs-10 menu">
                <div class="row" id="top_menu">
                    <ul class="nav nav-pills">
                        <li class="active" id="blog"><a class="color_change" href="/">Blog</a></li>
                        <li class="" id="tips"><a class="color_change" href="/tips/">Tips</a></li>
                        <li class="" id="algo"><a class="color_change" href="/algo/">Behind The Scenes</a></li>
                        <li class="" id="about"><a class="color_change" href="/about_me/">About Me</a></li>
            <div class="col-sm-4 col-xs-12 menu">
                <form action="/search/" id='search-form'>
                    <input id="search-box" type="text" name="query" placeholder="Search..">
        <div class="row" id="content">
            <div class="col-md-7 col-md-push-3">
                <div class="row" id="data">
                    <div class="col-md-12">
                        <br />
                        <h3 id="page_title">An intern's views - How far have I come?</h3>
73 74 75 76 77 78 79 80 81 82 83
                        <hr />
                        <div class="row text-justify" id="content-holder">
                            <div class="col-md-12">
                                <p>AKA, what the hell about work? I have gone on and on about getting here. The
things I found here. But I have still made no mention of what I do here. Well,
here it is. So sit back, and read on.</p>

<li><a href="/2017/05/07/How-I-got-here/">An intern's views - How I got here</a></li>
<li><a href="/2017/06/07/A-month-end-at-Google/">An intern's views - A month's end at Google</a></li>
<li><a href="/2017/07/10/How-far-have-I-come-working-at-Google/">An intern's views - How far have I come?</a></li>
Pallav Agarwal's avatar
Pallav Agarwal committed
<li><a href="/2017/07/29/End-of-Diary/">An intern's views - End of diary</a></li>
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

<p>In case you haven't read the last article, you might want to.</p>

<p>So where were we? Oh yeah, end of orientation (week 1). So, after week 1,
interns actually start working in full force. Now, the command structure is
something like this - I'm an intern. I have a host who is responsible for
hosting my project. He is primary reviewer on all my code, and my main point of
contact in case of any problems. Apart from my host, I have a second reviewer,
who is basically the person who has worked on similar stuff before and is in
the best position to help me deploy my code.</p>

<p>Above them is our manager, and then more managers above him (in a nutshell).</p>

100 101 102
<p>So what do I work on? <del>Hmmm.. I am not sure if I'm allowed to say yet?</del>
This blog article describes my project pretty well: <a href="">Introducing
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

<p>Anyway, I am in the Blaze team. Blaze is the internal name for Bazel
(<a href=""></a>). To understand what Blaze is, first let's jog your
memory. Which names do you recognize?</p>

<li>Make (Makefile)</li>

<p>All the above mentioned are build tools, and they all work on a similar
concept. You have a build configuration, and they try to build the project by
minimizing the work done. For example, if only one file has changed, they'd try
not to build the whole project again, but just that one file. Now as projects
become complicated, these tools become inefficient, and slowly more and more
incompetent. Google has all their source code in one huge repository (really
really huge), and code can take hours to build on parallel running machine
124 125 126 127 128 129
clusters. These tools can neither handle such complexity, nor the functionality
required for such a thing.</p>

<p>This is where Bazel (Blaze) comes in. Blaze is <em>the</em> build tool used by every
project in Google. It is what builds tens of thousands of projects everyday.
Now, Bazel is the open source version of Blaze, which other people can use in
130 131
their projects, but is mostly used by other companies (like Dropbox), who have
such huge requirements.</p>
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221

<p>If you are in a CS related field, you would've heard the term "correctness"
thrown around a lot. Proof of correctness of algorithms? Correctness in multi
threaded systems? Anyway, the main aim for a build tool is to ensure that the
build output is always correct (deterministic). Thus, the changing
circumstances should not change the build. For example, if a project A does not
depend on project B, then whether or not you have B installed should not have
an effect on build of A.</p>

<p>One important way to ensure correctness is to sandbox the compiler. This
basically means to remove anything that might affect the build, except for the
dependencies declared by the programmer. Now this can be quite slow to do for
1000s of parallel builds, having 10,000s of dependencies. The current approach
can take up to 300% extra time for a build with sandboxing enabled than
disabled for some projects with a lot of dependencies. My project is a
completely different (and hopefully fast) approach to solving this.</p>

<p>Back to working at Google; how does the work feel? One word - challenging. I
take up problems quickly, I can code fast, I can even understand libraries,
APIs faster than people expect me too. But I was not prepared for this. I don't
think I'm the only one who felt this way. My friends, who are interning at
Google or even other big companies felt the same. Programming in a company is
not the same as programming projects as a hobby.</p>

<p>What am I talking about? Code Reviews, Lints, Style Guides. Writing code for
Google is not the same as writing code for oneself. Your code needs to work,
but that is low priority (okay, not really). Anybody reading your code should
be able to understand what it does, and that's high priority. I'm not
complaining, I have learnt more about writing "good" code in the last two
months than I did in years coding by myself. However, I am going on this rant
because I want whoever is reading this, to realise that if you are in college
right now, you have a wonderful opportunity to learn to write "good" code.</p>

<p>What are code reviews? Code reviews are comments on your code, asking you to
fix problems (that you didn't even think were present) using alternatives you
would've never come up with yourself. Frankly, the first time around, code
reviews feel something like this:</p>

<p><img src="/img/review.png" width="100%" /></p>

<p>For the record, I made that meme for memegen <strong><em>after</em></strong> I finally got my first
pull request (or change list) accepted. It got 850+ upvotes, so I'm pretty sure
I'm not the only one who felt this way.</p>

<p>Hmmm... Memes should be standard way of getting a point across. Memegen is full
of memes about "Intern's first pull request", because it is a standard scene.
Intern comes, confident, writes a bunch of code, sends it for review, and BAM!
40+ comments on the code. Been there, done that. My first pull request (~400
lines) had over 90 comments and was finally submitted after 2 weeks when I had
managed to please all the reviewers by fixing every problem.</p>

<p>Why am I writing about all this? Do I still feel the pain? Well, yes, but a lot
less than I originally did. After the code reviews, the code actually does look
a lot better. It also gives a sense of inferiority, that takes time getting
used to. At my college, there are a total of 2 people who can make me feel
inferior (in programming). At Google, every second employee manages to do it
with ease. We were told in our orientation that almost 70% of the Googlers have
felt that they don't belong here due to inferiority complex at some point in
their lives. But then a Googler comes along and asks for my help in area he
doesn't have any experience in, and the feeling goes away. These people aren't
all superior, they have just been working among the best too long.</p>

<p>Best part of working at Google? The Googlers. Not only are the people here
brilliant at what they do, I have actually met some of the most down to Earth
people here.  And the benefit of working with the best people? I have a doubt
in Go; the Go team sits 6 rows from my desk. I need help implementing
something? I bet at least 3 people in the 50 step radius have done it before.
Can't remember the name of that one spaceship from Star Trek? I'm pretty sure 1
out of 5 people here know that too. I don't even need to Google my doubts that
often because somebody can usually clear them up (yeah, I can see the irony).</p>

<p><em>I know most of you don't care about how my project is going, but I'm going to put
it here anyway :P It's going well, and I had a fairly nice mid-term review. I'm
currently pushing hard to get the project released as open source (lots of
legal issues to solve in the way). Finger crossed :D</em></p>

<p>So, any regrets? Yes, from back at college. I really wish somebody had told me
about all this. Told me that the programming as I know it, isn't exactly how
it's done in real life. I wish I had had someone read all my codes, just to see
if they can understand it. I wish I had an expert nit-picking on my codes just
so having that now wouldn't be so surprising.</p>

<p>Next steps? I like to help out others, so let's hope I can help a few people
avoid this shock. For now, mandatory code reviews on Programming Club IITK
repositories, adding test suites and continuous integration to important
projects and planning lectures on just these topics.
<br/> <br/></p>

<p><em>Doubt? Question? Suggestion? I think the comment panel below works :)</em></p>

222 223
<p>Next in series: <a href="/2017/07/29/End-of-Diary/">An intern's views - End of diary</a></p>

224 225 226 227 228 229 230 231 232 233
                <hr /><br />
            <div class="col-md-3 col-md-pull-7" id="recent">
                <h4>RECENT POSTS</h4>
                <ul class="nav nav-pills nav-stacked">
Pallav Agarwal's avatar
Pallav Agarwal committed
                        <a href="/2018/01/07/Encrypted-posts-on-a-static-website/" class="color_change">Encrypted posts on a Static Website...</a>
Pallav Agarwal's avatar
Pallav Agarwal committed
236 237
                        <a href="/2017/12/08/Automating-HTTPS-certs/" class="color_change">Automating HTTPS certs using Namesilo and...</a>
240 241
                        <a href="/2017/12/05/Simplifying-Travis-with-Nix/" class="color_change">Simplifying CI with Nix</a>
244 245 246
                        <a href="/2017/07/29/End-of-Diary/" class="color_change">An intern's views - End of...</a>
248 249 250
                        <a href="/2017/07/24/Mistakes-are-okay/" class="color_change">Mistakes are okay</a>
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
                <h4>RECENT TIPS</h4>
                <ul class="nav nav-pills nav-stacked">
                        <a href="/2016/05/06/Ultimate-control-over-mobile-browser/" class="color_change">Ultimate control over Mobile Browser with...</a>
                        <a href="/2016/04/27/SSH-keys/" class="color_change">Easy sharing of SSH keys</a>
                        <a href="/2015/08/01/SSH-from-Windows/" class="color_change">Using SSH from Windows 10 without...</a>
                        <a href="/2015/07/27/Boost-Python-Performance/" class="color_change">Cython: Boost Python Code Performance</a>
                        <a href="/2015/07/01/Vim-Mappings/" class="color_change">Quick intro to custom Vim Mappings...</a>
                <h4>TAGGED POSTS</h4>
                <ul class="nav nav-pills nav-stacked">
                        <a href="/2016/05/13/Reference-Sheets-and-Useful-Links/" class="color_change">Reference Sheets and Useful Links</a>
                <br />
                <br />
            <div class="col-md-2">
            <div class="row">
                <div class="col-md-7 col-md-offset-3 col-xs-10 col-xs-offset-1">
                    <div class="row">
                            <div class="col-xs-4">
                                <div class="fb-like" data-href="//" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
                            <div class="col-xs-8 text-right">
                                <script src=""></script>
                                <script src=""></script>
                                <script src="/js/script.js"></script>
                <div class="col-md-7 col-md-offset-3 col-xs-10 col-xs-offset-1">
                    <div id="disqus_thread"></div>
                    <script type="text/javascript" async>
var disqus_shortname = 'varstack';

(function() {
    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
    dsq.src = '//' + disqus_shortname + '';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-21768487-2', 'auto');
ga('send', 'pageview');
                    <noscript>Please enable JavaScript to view the <a href="" rel="nofollow">comments powered by Disqus.</a></noscript>

    <div class="modal fade" id="imagemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span>
                        <span class="sr-only">Close</span>
                    <h4 class="modal-title" id="myModalLabel">
                        Image Preview
                <div class="modal-body">
                    <img src="" id="imagepreview" style="max-height: 100%; max-width: 100%;">