<?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 Gunawan Wijaya on Medium]]></title>
        <description><![CDATA[Stories by Gunawan Wijaya on Medium]]></description>
        <link>https://medium.com/@gunawanwijaya?source=rss-5b2387e5fc79------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lFIeFgNKs4ibDnAA74Ee-Q.png</url>
            <title>Stories by Gunawan Wijaya on Medium</title>
            <link>https://medium.com/@gunawanwijaya?source=rss-5b2387e5fc79------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:12:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gunawanwijaya/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[The Core of Digital Service is Abstraction]]></title>
            <link>https://gunawanwijaya.medium.com/the-core-of-digital-service-is-abstraction-de7b5fd529de?source=rss-5b2387e5fc79------2</link>
            <guid isPermaLink="false">https://medium.com/p/de7b5fd529de</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[webtask]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Gunawan Wijaya]]></dc:creator>
            <pubDate>Sun, 11 Nov 2018 00:11:01 GMT</pubDate>
            <atom:updated>2018-11-11T00:12:20.073Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*takLVL5ZMj0P_oJG" /><figcaption>“blue, yellow, and brown wall decor” by <a href="https://unsplash.com/@aplaceforcreation?utm_source=medium&amp;utm_medium=referral">Gem &amp; Lauris RK</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This week we’re going to talk about abstraction, abstraction enable larger service coverage, provider agnostic, and easier integration between service. Before we dive in, would be good to talk about the task from last week, right?</p><h3>Last Week’s Homework</h3><p>I guess instruction from last week’s is pretty clear, create a github accont one of a popular service to host your digital project based on popular git workflow, create a repo and make it public, setup SSH keys and start using git in your project. Git has a lot of features, but you might need a couples of it though. Also an interactive IDE (Integrated Development Environment) can help us to manage our project, I prefer Visual Studio Code, an open source IDE with tonnes of extension and features, go get it at <a href="https://code.visualstudio.com/">https://code.visualstudio.com/</a>.</p><p>Here are my basic setup on my workstation.</p><ol><li>Install Ubuntu if possible</li><li>sudo apt update &amp;&amp; sudo apt upgrade -y to get latest software update</li><li>get Google Chrome at <a href="https://www.google.com/chrome/">https://www.google.com/chrome/</a></li><li>get VS Code at <a href="https://code.visualstudio.com/docs/setup/linux">https://code.visualstudio.com/docs/setup/linux</a></li><li>get a github account &amp; make a repo via <a href="https://github.com/new">https://github.com/new</a>, just type any name and you’re good to go</li><li>create an SSH key via ssh-keygen and just hit enter until finished</li><li>cat ~/.ssh/id_rsa.pub will print ssh-rsa XXXX user@computer then copy all of it</li><li>go to <a href="https://github.com/settings/ssh/new">https://github.com/settings/ssh/new</a> and paste to Key, type into Title user@computer to match with your SSH keys</li><li>ssh -T git@github.com to verify your SSH key and it will print Hi user! You&#39;ve successfully authenticated, but GitHub does not provide shell access.</li><li>git clone git@github.com:user/repo.git <strong>REMEMBER TO USE SSH, NOT HTTPS</strong> the reason is so that you don&#39;t need to type password everytime you do git push or git pull</li><li>paranoid? activate 2FA <a href="https://github.com/settings/security">https://github.com/settings/security</a></li></ol><p>There you have it the basic machine to help you build your digital product, in case you need a reference to last week’s step-by-step task here is the one.</p><ol><li>go to <a href="https://github.com/">https://github.com</a> and create an account</li><li>make a free public repository, name it “learn-git” or whatever</li><li>get yourself a git command line interface from <a href="https://git-scm.com/">https://git-scm.com/</a></li><li>create SSH key and add to github <a href="https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/">https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/</a> <em>remember to delete SSH keys once you have no access to those computer</em></li><li>git clone your repository using SSH, consider failed if using HTTPS or ZIP whatever except SSH</li><li>git add some new file</li><li>git commit to your local</li><li>git push to share with the world</li><li>git log to show history of this repository, also from this point you can use any computer connected to internet to work with your new git repository on github</li><li>git pull to get latest changes</li><li>git stash if git pull failed then do git pull again then git stash apply</li><li>conflict might exists or not, choose which one to keep</li><li>go to #6 or finish this task</li></ol><h3>Integrating Service</h3><p>For this week’s we need to build a simple service that can act both as a client and as a server, i think NodeJS is a good option since we learn a lot of JavaScript on our way from the beginning of my writing on <a href="https://medium.com/@gunawanwijaya/cs101-makes-me-angry-fcfbd5224371">https://medium.com/@gunawanwijaya/cs101-makes-me-angry-fcfbd5224371</a>.</p><p>When talking about client and server many of us thought that we will make 2 different system, but this week we only create only one service or server that can have multiple role, as a server, so we can listen to the client request, and as a client, so we can make a request to another server.</p><p>Before we begin, let’s define our problems and setup our goals. You are an artist, have a quite huge and hardcore fans that follow your story, so you decide to make a website that publicly visible to the internet, after that your manager give you an advice why not setting up a AMA session to engage and giving a fan-service to your fans? cool, since you’re also a tech-savvy you want to boast to your fans that you can code, so what are a simple approach to achieve this problem?</p><p>The goal is to collect and view questions (or more) from your fans, you can post in Instagram of course but you wouldn’t be able to show off your skill maybe in a vlog or Instagram story. How about email? err, spams? also email only works in professional scope, so no. Whatsapp? no way. Introducing <a href="https://slack.com/">https://slack.com</a></p><h3>Slack</h3><blockquote><em>The hub for your team and your work</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vX1qyrqlv9TpN0BL" /><figcaption>“# slack text” by <a href="https://unsplash.com/@scottwebb?utm_source=medium&amp;utm_medium=referral">Scott Webb</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Slack provide API for a webhook but we can’t used it directly since this weeks is about client and server, we need a server.</p><ol><li>register / login to <a href="https://slack.com/">https://slack.com</a></li><li>create new channels ama-2018–11–11</li><li>navigate to <a href="https://api.slack.com/apps?new_app=1">https://api.slack.com/apps?new_app=1</a></li><li>select Incoming Webhooks</li><li>activate Incoming Webhooks to ON</li><li>Add New Webhook to Workspace</li><li>select channel ama-2018-11-11 &amp; Authorize</li><li><a href="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX">https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX</a> is your webhook endpoint, keep it secret</li></ol><p>9. go to <a href="https://api.slack.com/incoming-webhooks">https://api.slack.com/incoming-webhooks</a> for more configuration</p><pre>curl <a href="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX">https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX</a> \<br>-X POST \<br>-H &#39;Content-type: application/json&#39; \<br>-d &#39;{ &quot;text&quot;:&quot;superfans asked: Will you marry me?? xoxo&quot;}&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*idkHMuYBEbNyr5SQ9peIdg.png" /></figure><p>and there you have it; now to make it more interesting there is a service called webtask that can host your NodeJS code for free.</p><h3>Webtask</h3><ol><li>go to <a href="https://webtask.io/make">https://webtask.io/make</a> &amp; login with your github account</li><li>install cli via <a href="https://webtask.io/cli">https://webtask.io/cli</a> all the way until you get a message on the URL “Hello”</li><li>update hello.js with following code</li></ol><pre>var SLACK_URI =   &quot;<a href="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX">https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX</a>&quot;;<br>var fetch = require(&quot;node-fetch&quot;);<br>module.exports = (context, cb) =&gt; {<br>  var isDebug = false;<br>  if (!(context.headers &amp;&amp; context.headers[&quot;user-agent&quot;])) {<br>    return cb(Error(&quot;&#39;user-agent&#39; are required&quot;));<br>  }<br>  if (context.query &amp;&amp; context.query.debug) {<br>    isDebug = true;<br>  }<br>  if (!(context.body &amp;&amp; context.body.from &amp;&amp; context.body.ask)) {<br>    return cb(Error(&quot;&#39;from&#39; &amp; &#39;ask&#39; are required&quot;));<br>  }<br>  var { from, ask } = context.body;<br>  var { &quot;user-agent&quot;: ua } = context.headers;<br>  fetch(SLACK_URI, {<br>    method: &quot;post&quot;,<br>    body: JSON.stringify({<br>      text: isDebug ? null : `UA: ${ua}`,<br>      attachments: [<br>        {<br>          author_name: `From: ${from}`,<br>          fallback: `Asked: ${ask}`,<br>          title: `Asked: ${ask}`,<br>          text: isDebug ? null : `UA: ${ua}`,<br>          actions: [<br>            {<br>              name: &quot;tags_list&quot;,<br>              type: &quot;select&quot;,<br>              text: &quot;Add a tag...&quot;,<br>              data_source: &quot;static&quot;,<br>              options: [<br>                { text: &quot;Important&quot;, value: &quot;important&quot; },<br>                { text: &quot;Career&quot;, value: &quot;career&quot; },<br>                { text: &quot;Spam&quot;, value: &quot;spam&quot; }<br>              ]<br>            }<br>          ]<br>        }<br>      ]<br>    }),<br>    headers: { &quot;Content-Type&quot;: &quot;application/json&quot; }<br>  })<br>    .then(res =&gt; res.text())<br>    .then(data =&gt; cb(null, data))<br>    .catch(err =&gt; cb(err));<br>};</pre><ol><li>wt update hello hello.js -d node-fetch to deploy new code along with the dependency</li><li>your code is up and running at <a href="https://wt-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0.sandbox.auth0-extend.com/hello">https://wt-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-0.sandbox.auth0-extend.com/hello</a></li></ol><pre>curl <a href="https://wt-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0.sandbox.auth0-extend.com/hello?debug=1">https://wt-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-0.sandbox.auth0-extend.com/hello?debug=1</a> \<br>-X POST \<br>-H &#39;Content-type: application/json&#39; \<br>-d &#39;{ &quot;from&quot;:&quot;diehardfans&quot;, &quot;ask&quot;:&quot;Yo lovely, mind to give me an autograph? on my rear ;)&quot;}&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*J0ozW3gzYR3ywwbb54zVUw.png" /></figure><h3>Conclusion</h3><p>For you who asking “Why we need to setup our webtask? slack alone is already fulfill our goals?”. The answer is about control and abstraction, remember, the goal is to collect and view questions (or more) from your fans, the only required data is question and fans itself, so we want the client to only send the question and fans data and by moving complicated data to server we can custom our need in the server without changing anything in the client.</p><p>Some of you might be disagree with me, but believe me, with team and collaboration this approach would be better, okay let’s say, all you have is a database connection, as if you would expose the connection to the client to see, here we can limit the control of user and giving more abstraction to the client.</p><p>This conclude our task for this week as complete.</p><h3>This Week’s Homework</h3><p>Since the AMA service is up and running, we need the actual website so the fans can ask you anything. The task is to build a website that reflect your style and genre as an artist, be it a musician, an actor, a dancer, a painter, whatever you want to be, eh do painter have a manager to suggest an AMA session?</p><p>Go to <a href="https://www.w3schools.com/html">https://www.w3schools.com/html</a> for more resources on how to create a website, for fancy stuff go to <a href="https://tympanus.net/codrops/category/tutorials">https://tympanus.net/codrops/category/tutorials</a></p><p><a href="https://gist.github.com/gunawanwijaya/910b256cd51b0b44b68cfe27bcd4fa2e">https://gist.github.com/gunawanwijaya/910b256cd51b0b44b68cfe27bcd4fa2e</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de7b5fd529de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Startup Life]]></title>
            <link>https://gunawanwijaya.medium.com/startup-life-124fb9dc7357?source=rss-5b2387e5fc79------2</link>
            <guid isPermaLink="false">https://medium.com/p/124fb9dc7357</guid>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[startup-life]]></category>
            <dc:creator><![CDATA[Gunawan Wijaya]]></dc:creator>
            <pubDate>Fri, 02 Nov 2018 18:30:46 GMT</pubDate>
            <atom:updated>2018-11-02T18:30:46.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qrfK8CIgd-dBdG4X" /><figcaption>“group of people doing fist bumps” by <a href="https://unsplash.com/@rawpixel?utm_source=medium&amp;utm_medium=referral">rawpixel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>this week we don’t talk about programming, but rather my opinion on how’s life and working condition on a startup, but before that let’s review last week’s homework.</p><h3>Last Week’s Homework</h3><p>given an arbitrary JSON data, e.g.</p><pre>var data = [<br>  { NAME: &quot;Hugh&quot;, age: 55, __friends: [<br>    { nAme: &quot;John&quot;, age: &quot;56&quot;, friends_: [<br>      { namE: &quot;Xavier&quot;, age: 52 },<br>      { naMe: &quot;Anna&quot;, age: 52, fri____ends: [<br>        { nAmE: &quot;Betty&quot;, age: &quot;52&quot;, __friends: [<br>          { na_me: &quot;Peter&quot;, age: 52, &quot;fr ie nds&quot;: [<br>            { Name: &quot;Mark&quot;, age: 52 }<br>          ]}<br>        ]}<br>      ]}<br>    ]},<br>    { n_ame: &quot;Wade&quot;, Age: &quot;54&quot;, friEnds: [<br>      { nam_e: &quot;Charlie&quot;, aGe: 52 },<br>      { name_: &quot;Selena&quot;, agE: 52 }<br>    ]}<br>  ]}<br>];</pre><p>note the case of key NAME and nAme, the space and underscore _, and some of the age value represented as text rather than a number, we need to fix the JSON data so that the input should be formatted like the one we used earlier, so no _ and all of the key must be presented using lowercase.</p><p>the second task is also include the minimum, maximum, and average age of all people presented in this data, so don’t forget to cast the number in text to the appropriate one.</p><pre>var expected_output = {<br>  names: [ &quot;Hugh&quot;, &quot;John&quot;, &quot;Wade&quot;, &quot;Xavier&quot;, &quot;Anna&quot;, &quot;Charlie&quot;, &quot;Selena&quot;, &quot;Betty&quot;, &quot;Peter&quot;, &quot;Mark&quot; ],<br>  ages: [ 55, 56, 54, 52, 52, 52, 52, 52, 52, 52 ],<br>  stats: { age: { min: 52, max: 56, average: 52.9 } }<br>}</pre><p>there are some problems:</p><ul><li>normalize key — replace space and underscore</li><li>normalize value — replace number like string with actual number</li><li>recursion on Object and Array — to go all the way down</li></ul><p>let’s make solution for key normalization</p><pre>function kFn(key) {<br>  if (key.constructor === String) {<br>    return key.toLowerCase().replace(/[ _]/gi, &quot;&quot;);<br>  }<br>  return key;<br>}</pre><p>then the solution for value normalization</p><pre>function vFn(value) {<br>  if (!isNaN(Number(value))) {<br>    return Number(value);<br>  }<br>  return value;<br>}</pre><p>the recursion solution for normalization key and value</p><pre>function normalize(data, kFn = k =&gt; k, vFn = v =&gt; v) {<br>  if (Array.isArray(data)) {<br>    return data.map(v =&gt; normalize(v, kFn, vFn));<br>  }<br>  if (data.constructor === Object) {<br>    var clone = {};<br>    Object.keys(data).forEach(k =&gt; {<br>      clone[kFn(k)] = normalize(data[k], kFn, vFn);<br>    });<br>    return clone;<br>  }<br>  return vFn(data);<br>}</pre><p>let’s inspect this function</p><pre>var new_data = normalize(data, kFn, vFn);<br>console.log(new_data);<br>/**<br>[<br>  {&quot;name&quot;:&quot;Hugh&quot;,&quot;age&quot;:55,&quot;friends&quot;:[<br>    {&quot;name&quot;:&quot;John&quot;,&quot;age&quot;:56,&quot;friends&quot;:[<br>      {&quot;name&quot;:&quot;Xavier&quot;,&quot;age&quot;:52},<br>      {&quot;name&quot;:&quot;Anna&quot;,&quot;age&quot;:52,&quot;friends&quot;:[<br>        {&quot;name&quot;:&quot;Betty&quot;,&quot;age&quot;:52,&quot;friends&quot;:[<br>          {&quot;name&quot;:&quot;Peter&quot;,&quot;age&quot;:52,&quot;friends&quot;:[<br>            {&quot;name&quot;:&quot;Mark&quot;,&quot;age&quot;:52}<br>          ]}<br>        ]}<br>      ]}<br>    ]},<br>    {&quot;name&quot;:&quot;Wade&quot;,&quot;age&quot;:54,&quot;friends&quot;:[<br>      {&quot;name&quot;:&quot;Charlie&quot;,&quot;age&quot;:52},<br>      {&quot;name&quot;:&quot;Selena&quot;,&quot;age&quot;:52}<br>    ]}<br>  ]}<br>]<br>**/</pre><p>cool, now to create reducer based on last week’s task.</p><pre>function valueFromKey(data, key, acc = []) {<br>  var cdata = [];<br>  data.forEach(v =&gt; {<br>    if (v[key]) { acc.push(v[key]); }<br>    if (v.friends) { cdata = cdata.concat(v.friends); }<br>  });<br>  if (cdata.length &gt; 0) { return valueFromKey(cdata, key, acc); }<br>  return acc;<br>}</pre><p>we modified a little so that we can pass what key that we want to get and basic Array as accumulator.</p><p>from here we can create</p><pre>var names = valueFromKey(normalize(data, kFn, vFn), &quot;name&quot;);<br>var ages = valueFromKey(normalize(data, kFn, vFn), &quot;age&quot;);<br>var expected_output = {<br>  names,<br>  ages,<br>  stats: {<br>    age: {<br>      min: Math.min(...ages),<br>      max: Math.max(...ages),<br>      average: ages.reduce((a, b) =&gt; a + b, 0) / ages.length<br>    }<br>  }<br>};<br>console.log(expected_output);<br>/**<br>{<br>  &quot;names&quot;:[&quot;Hugh&quot;,&quot;John&quot;,&quot;Wade&quot;,&quot;Xavier&quot;,&quot;Anna&quot;,&quot;Charlie&quot;,&quot;Selena&quot;,&quot;Betty&quot;,&quot;Peter&quot;,&quot;Mark&quot;],<br>  &quot;ages&quot;:[55,56,54,52,52,52,52,52,52,52],<br>  &quot;stats&quot;:{<br>    &quot;age&quot;:{&quot;min&quot;:52,&quot;max&quot;:56,&quot;average&quot;:52.9}<br>  }<br>}<br>**/</pre><p>and thus we conclude that last week’s homework is done.</p><h3>Different From what I Expect</h3><p>After my graduation, i work related to computer stuff, mostly in software agency. But i don’t consider this as software engineer but more like hacker, not that cool hacking scene in movies, but rather changing a small part of what’s already been there before.</p><p>usually using WordPress, Drupal, Joomla, and the likes, so we have CMS, and need new small feature, even when the project is target the mobile device, we’ve already have a boilerplate and just set up the config.</p><blockquote>Work in startup is wonderful #lifeatstartup #startupishiring</blockquote><p>Then I got in situation where i need to choose to work in a startup and try my luck, sure enough i got accepted and the offer is not bad at all!!</p><p>The first month is time to learn and adapt, back when i still work in software agency all i know about JavaScript is jQuery and DOM API to update certain elements in browser that render our WordPress.</p><p>The first year is also thrilling and full of surprise, but really I learn a lot about JavaScript as a system, from Promise based value, Array function map/filter/reduce, Promise based value treating on Array using Promise.all or reduce with initial Promise, a lot of exposure on open source tools and library like Sequelize, Mongoose, GraphQL, even transitioned to Data Team as we develop AI/ML #buzzword in Python, unit-test, API architecture, resource management, etc.</p><h3>Here Comes The Bittersweet of Startup Company</h3><ul><li>You expect to surround by amazing people.</li><li>What you got is one or two amazing people surrounded by you, the team and that annoying co-worker you always hate because the hat they use is slightly smaller than his hair.</li><li>You expect to get a raise per semester.</li><li>What you got is you or some people put a frown face every time you hear “I got a raise”. Why? because you’re not giving a solution to company.</li><li>You expect to master all kind of hype tools &amp; library &amp; algorithm.</li><li>What you got is you have no time for that because of bugs and bug-fix that contains another bugs so the company despise your choice for being bug-friendly developer.</li><li>You expect to have free time for gym and social activity.</li><li>What you got is more inspiration on how to organize your code in your free time, you can’t sleep and you are late to came to office and no free time.</li><li>You expect to build a great product.</li><li>What you get is feedback from client, user, or even investor on what they think is great, you may have a great vision on what product you want to build but your job is to make product that suits their demand.</li></ul><p>That’s some of me and my colleague’s experience as we build our own product, of course it doesn’t happen all the time, but one of this event is surely came at you sooner or later, brace yourself.</p><p>It’s not wise to have all of your expectation fulfilled, since it can weaken your will to do more, but having no support to doing so is not better, always prepare for tasting some disappointment and betrayal.</p><p>I’m not saying that wonderful life in startup is fictions, it can be wonderful once you have the same mission with the company. Say I’m a pro privacy and data liberation, but you work for ads company, or the other way around, you love to gather data and clustering people so you can deliver good recommendations, but the product having no input for user to give feedback. With that said, know your passion and dream it’s okay for not having one at first, but when you are finally found it you must clarify yourself, can the company and you meet at the middle? what needed to compromised, if not then it is better to leave.</p><p>I personally have a good life and work experience working in a startup, am just started at late 2016, about a year and half from this publication but working here, I surely get more experience to solve a real world problem compare to my college time.</p><p>I don’t recommend you to work over a chance to go to college, if you have the chance to go to college, go to college instead and you will have the mentality of being responsible and self-manage trait, only if you can be patient and finish your college. College also help you to communicate and express yourself in a team, having a great communication skill is highly valued everywhere.</p><p>Overall I’m having a good experience here, I would rate my experience 85%, I would give 100 on learning and my development, highly recommend place to work, and 70 from not having the same vision as mine, i prefer having simple interface with user and highly valued their data so privacy is my priority over anything else, also the product feature we develop is sometimes hard to explain and my guess is it can be highly political since we’re working mostly B2B.</p><p>This is also a goodbye letter to Pomona <a href="https://pomona.id/">https://pomona.id</a>, it is a great pleasure to work with you guys, I can’t imagine myself without you guys, learning, building, and solving problem together, my only hope is Pomona can deliver a solution for people to saving more on their spending and give a better insight for business to track their marketing campaign. For more info about Pomona go to <a href="https://www.linkedin.com/company/pomona-indonesia/">https://www.linkedin.com/company/pomona-indonesia/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vi8-D-LasuCJiGD9" /><figcaption>“person holding Thanks card” by <a href="https://unsplash.com/@kevin_xue_pic?utm_source=medium&amp;utm_medium=referral">kevin Xue</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>P.S. this content is highly opinionated, my thought might be or not be same as other people in the same area or company or even all people in general. Found anything that need update or have a feedback? anything is welcomed.</p><h3>This Week’s Homework</h3><p>Before going to explain this week’s homework, did you guys found last week’s is quite challenging for newcomer? it’s okay to not understand things, software engineer is about sharing knowledge, I hope that you guys can also contribute to this content, this is not about solving problem per se, this is just a practice and no need to discourage yourself, enjoy the content and let’s learn together.</p><p>For all the people who want to know basic programming but wondering what kind of tools that needed to follow this content, all you need is a browser, yup internet browser like Chrome, Firefox, Opera or Microsoft Edge, anything that can run JavaScript is okay.</p><ol><li>Open a new tab go to <a href="https://google.com/">https://google.com</a></li><li>Right click on empty space</li><li>Find and click Inspect / Inspect Element menu</li><li>You will a drawer is appearing, search for Console and click</li><li>Do something</li><li>Profit</li></ol><p>This console is your friend to know more about programming, note that this console only run a JavaScript syntax, navigate to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types</a>, this content is not focused in JavaScript only but programming in general and for easier access to console and for sharing snippet and concept, note in the future I might be writing in specific programming language but for now bear with me with JavaScript.</p><p>Okay, move to the task for this week’s, like i said earlier, no programming task, but start by getting yourself familiarized with open source world,</p><ol><li>go to <a href="https://github.com/">https://github.com</a> and create an account</li><li>make a free public repository, name it “learn-git” or whatever</li><li>get yourself a git command line interface from <a href="https://git-scm.com/">https://git-scm.com/</a></li><li>create SSH key and add to github <a href="https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/">https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/</a> <em>remember to delete SSH keys once you have no access to those computer</em></li><li>git clone your repository using SSH, consider failed if using HTTPS or ZIP whatever except SSH</li><li>git add some new file</li><li>git commit to your local</li><li>git push to share with the world</li><li>git log to show history of this repository, also from this point you can use any computer connected to internet to work with your new git repository on github</li><li>git pull to get latest changes</li><li>git stash if git pull failed then do git pull again then git stash apply</li><li>conflict might exists or not, choose which one to keep</li><li>go to #6 or finish this task</li></ol><p>Next week will be interesting, we will talk more about client/server, how communication occured between two or more computer and how to process such request.</p><p><a href="https://gist.github.com/gunawanwijaya/ee09f6586d015510e708ce34e03e8223">https://gist.github.com/gunawanwijaya/ee09f6586d015510e708ce34e03e8223</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=124fb9dc7357" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Loops Over Recursion]]></title>
            <link>https://gunawanwijaya.medium.com/loops-over-recursion-over-loops-over-recursion-76a4ce4637a8?source=rss-5b2387e5fc79------2</link>
            <guid isPermaLink="false">https://medium.com/p/76a4ce4637a8</guid>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[loop]]></category>
            <dc:creator><![CDATA[Gunawan Wijaya]]></dc:creator>
            <pubDate>Wed, 24 Oct 2018 19:19:09 GMT</pubDate>
            <atom:updated>2018-10-24T19:42:40.798Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Loops Over Recursion Over Loops Over Recursion</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*25kbNjVnvP_scX2OPjZGTA.png" /></figure><p>Before we’re starting to get to know more about Recursion, we need to discuss last week’s homework.</p><h3>Last Week’s Homework</h3><p>define the_answer_to_life_the_universe_and_everything()? what do you get in mind if there&#39;s not much information given in a problem? go to <a href="https://google.com/">https://google.com</a> and type your problem</p><p>apparently the_answer_to_life_the_universe_and_everything() is 42, now we need to create a function that return 42,</p><pre>function the_answer_to_life_the_universe_and_everything() {<br>  return 42;<br>}</pre><p>and that’s it, we create a function that we define by the_answer_to_life_the_universe_and_everything()</p><h3>Loops VS Recursion</h3><blockquote><em>Oh boy, i’d just write a loop instead.</em></blockquote><blockquote><em>— The Unwise One</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*JNwKWmj1KCa87Z-KaF8xXQ.gif" /><figcaption>Mr. Recursion</figcaption></figure><p>There are times where loop is better and self describing (also when deadline at a stake), but there are also times when Recursion can help, provide a better readability and also reducing the amount of code that we need to write.</p><p>So how can we get all the name of the following JSON?</p><pre>var data = [<br>  { name: &quot;Hugh&quot;, age: 55, friends: [<br>    { name: &quot;John&quot;, age: 56, friends: [<br>      { name: &quot;Xavier&quot;, age: 52 },<br>      { name: &quot;Anna&quot;, age: 52, friends: [<br>        { name: &quot;Betty&quot;, age: 52, friends: [<br>          { name: &quot;Peter&quot;, age: 52, friends: [<br>            { name: &quot;Mark&quot;, age: 52 }<br>          ]}<br>        ]}<br>      ]}<br>    ]},<br>    { name: &quot;Wade&quot;, age: 54, friends: [<br>      { name: &quot;Charlie&quot;, age: 52 },<br>      { name: &quot;Selena&quot;, age: 52 }<br>    ]}<br>  ]}<br>];</pre><p>First we try to solve it by using a loops</p><pre>function getAllName(data, acc = {}) {<br>  acc.names = acc.names || [];<br>  var cdta = data.slice(0);<br>  for (var i = 0; i &lt; cdta.length; i++) {<br>    if (cdta[i].name) { acc.names.push(cdta[i].name); }<br>    if (cdta[i].friends) { cdta = cdta.concat(cdta[i].friends); }<br>    // ___________________ ^^^^   ^^^^ DANGEROUS!!<br>  }<br>  return acc;<br>}<br>getAllName(data);</pre><p>While the approach above technically not wrong (because it works), it is quite dangerous practice to mutate the currently running loop. nearly all programming language is passing a value by reference so consider to not changing a value when processing data. In this example, mutating action is only adding the array, what if taking data out from array?</p><p>Now lets try to rewrite it using recursion</p><pre>function getAllName(data, acc = {}) {<br>  acc.names = acc.names || [];<br>  var cdta = [];<br>  for (var i = 0; i &lt; data.length; i++) {<br>    if (data[i].name) { acc.names.push(data[i].name); }<br>    if (data[i].friends) { cdta = cdta.concat(data[i].friends); }<br>    // ___________________ ^^^^   ^^^^ SAFER!!<br>  }<br>  if (cdta.length &gt; 0) { return getAllName(cdta, acc); }<br>  return acc;<br>}<br>getAllName(data);</pre><h3>Lesson Learned from Recursion</h3><ul><li>Extract/Transform/Load information on known data structure like XML, JSON, etc</li><li>build from simple to complex algorithm like dijkstra to solve brachistochrone problems</li><li>Map/Reduce/Filter/Loop need to treated carefully, so no action that mutate the reference</li></ul><h3>This Week’s Homework</h3><p>given an arbitrary JSON data, e.g.</p><pre>var data = [<br>  { NAME: &quot;Hugh&quot;, age: 55, __friends: [<br>    { nAme: &quot;John&quot;, age: &quot;56&quot;, friends_: [<br>      { namE: &quot;Xavier&quot;, age: 52 },<br>      { naMe: &quot;Anna&quot;, age: 52, fri____ends: [<br>        { nAmE: &quot;Betty&quot;, age: &quot;52&quot;, __friends: [<br>          { na_me: &quot;Peter&quot;, age: 52, &quot;fr ie nds&quot;: [<br>            { Name: &quot;Mark&quot;, age: 52 }<br>          ]}<br>        ]}<br>      ]}<br>    ]},<br>    { n_ame: &quot;Wade&quot;, Age: &quot;54&quot;, friEnds: [<br>      { nam_e: &quot;Charlie&quot;, aGe: 52 },<br>      { name_: &quot;Selena&quot;, agE: 52 }<br>    ]}<br>  ]}<br>];</pre><p>note the case of key NAME and nAme, the space &quot; &quot; and underscore _, and some of the age value represented as text rather than a number, we need to fix the JSON data so that the input should be formatted like the one we used earlier, so no _ and all of the key must be presented using lowercase.</p><p>the second task is also include the minimum, maximum, and average age of all people presented in this data, so don’t forget to cast the number in text to the appropriate one.</p><pre>var expected_output = {<br>  names: [ &quot;Hugh&quot;, &quot;John&quot;, &quot;Wade&quot;, &quot;Xavier&quot;, &quot;Anna&quot;, &quot;Charlie&quot;, &quot;Selena&quot;, &quot;Betty&quot;, &quot;Peter&quot;, &quot;Mark&quot; ],<br>  ages: [ 55, 56, 54, 52, 52, 52, 52, 52, 52, 52 ],<br>  stats: { age: { min: 52, max: 56, average: 52.9 } }<br>}</pre><p><a href="https://gist.github.com/gunawanwijaya/d79d06431d8578b8dcf07cba23d834b8">https://gist.github.com/gunawanwijaya/d79d06431d8578b8dcf07cba23d834b8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76a4ce4637a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CS101 Makes Me Angry!! ]]></title>
            <link>https://gunawanwijaya.medium.com/cs101-makes-me-angry-fcfbd5224371?source=rss-5b2387e5fc79------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcfbd5224371</guid>
            <category><![CDATA[cs101]]></category>
            <category><![CDATA[flow-of-control]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[angry]]></category>
            <category><![CDATA[heart-shaker]]></category>
            <dc:creator><![CDATA[Gunawan Wijaya]]></dc:creator>
            <pubDate>Wed, 17 Oct 2018 16:54:29 GMT</pubDate>
            <atom:updated>2018-10-24T19:38:33.442Z</atom:updated>
            <content:encoded><![CDATA[<p>I remember in 2009 the time when I attend CS101 Algorithm and Programming, it was so confusing like what the hell is happening?</p><h3>Preface</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*aG10kxAOuHX9_FjvKTmV_Q.gif" /><figcaption>even Sana is angry 😠</figcaption></figure><p>Yes, I don’t have any coding experience, it was so embarrassing to ask, everyone around me seems so experience and highly skilled in front of computer. Sometimes i fake to sleep, sometimes skipping class, and often that i pretend to use my boring face to prevent any question targeted to me.</p><pre>a = 1 + 2; // okay, a is 3 (1 + 2), cool<br>a = a + a; // here is the confusing part</pre><p>The first 2 lines of code that makes me angry, I’m not stupid, but this really annoying, i know some basic linear algebra, like:</p><pre>x = 2y + 4;<br>y = (x - 4) / 2;<br>0 = 2y + 4 - x;</pre><p>So, how come a = a + a?</p><pre>a = 2a;<br>0 = 2a - a;<br>0 = a;<br>// okay, maybe a is 0?<br>// indeed if a is 0, i solved the question, but why not a = 0?</pre><p>The thing is coding is not always an algebra expression, for this type of expression is simply an assignment, how we assign a single part of memory that is accessible by us to change it.</p><pre>a = 1 + 2; // save variable a with value 3 (1 + 2)<br>a = a + a; // read a (3) add with a (3) and change a with 6 (3 + 3)</pre><p>It really takes me more than 2 weeks to change my perception about equal sign (=), from linear algebra to the computational level. In my opinion, linear algebra that can produce linear function is pretty straightforward, and can be written in computational level as a function like:</p><pre>function linear2Yplus4minusX(X=0, Y=0) {<br>  return (2 * Y) + 4 - X;<br>}</pre><h3>Flow of Control</h3><p>In computational study, there is a term of “Flow of Control”, and it consists of:</p><ul><li>Sequential</li><li>Methods</li><li>Selection</li><li>Repetition</li></ul><h4><strong>Sequential</strong></h4><p><strong>Sequential</strong> is a term when the code you write is executed by the order of writing which in common is left-to-right and top-to-bottom.</p><pre>a = 1;             // first assign 1 to a<br>a = 2;             // then assign 2 to a<br>a = (a + a) * a;   // since a = 2, the answer is 8 ((2+2)*2)</pre><h4><strong>Methods</strong></h4><p><strong>Methods </strong>or<strong> </strong>Functions is a term when some block of your code can decompose to do a certain task, this usually takes one or some arguments to make methods more general.</p><pre>function doTweet(message, user, pass){<br>  connected = checkNetwork();<br>  connection = twitterLogin(user, pass);<br>  connection.tweet(message);<br>  connection.logOut();<br>  return null;<br>}</pre><h4><strong>Selection</strong></h4><p><strong>Selection</strong> is a term when you encounter a branch of action, let say when the logged in user’s role is Admin, they can view admin page, but when role is not Admin, admin page is disabled or hidden.</p><pre>if (user.role == &quot;Admin&quot;) {<br>  adminPage.viewable = true;<br>  moderatorPage.viewable = false;<br>  if (user.age &lt; 18) {<br>    adminPage.NSFW = false;<br>  } else {<br>    adminPage.NSFW = true;<br>  }<br>} else if (user.role == &quot;Moderator&quot;) {<br>  adminPage.viewable = false;<br>  moderatorPage.viewable = true;<br>} else {<br>  adminPage.viewable = false;<br>  moderatorPage.viewable = false;<br>}</pre><p>the pattern above is quite confusing if we use many state to mutate, if we expect some default state, might be better to move the default state before the condition/branching (usually the negative value like false, 0, null)</p><pre>adminPage.viewable = false;<br>moderatorPage.viewable = false;<br>adminPage.NSFW = false;<br>if (user.role == &quot;Admin&quot;) {<br>  adminPage.viewable = true;<br>  if (user.age &gt;= 18) {<br>    adminPage.NSFW = true;<br>  }<br>} else if (user.role == &quot;Moderator&quot;) {<br>  moderatorPage.viewable = true;<br>}</pre><p>this new pattern is easier to read because we have set the default value and simply turn the switch if needed</p><h4><strong>Repetition</strong></h4><p><strong>Repetition</strong> is a term when we want to do a certain task over and over again, usually compliment the Methods with sometimes Selection involved.</p><pre>print(0 * 0);<br>print(1 * 1);<br>print(2 * 2);<br>print(3 * 3);<br>print(4 * 4);<br>print(5 * 5);<br>print(6 * 6);<br>print(7 * 7);<br>print(8 * 8);<br>print(9 * 9);</pre><p>can be expressed as a loop like:</p><pre>for (i = 0; i &lt; 10; i= i + 1) {<br>  // i = i * i // this will mutate i in some programming language<br>  print(i * i); // be careful not to mutate variable within a loop<br>}</pre><h3>Lesson Learned from CS101</h3><ul><li>be flexible and try to change your perspective</li><li>proactive and creative to “tweak” your code</li><li>Flow of Control</li></ul><h3>This Week’s Homework</h3><ul><li>define the_answer_to_life_the_universe_and_everything() ?</li><li>hint <a href="https://google.com/search?q=the+answer+to+life+the+universe+and+everything">https://google.com/search?q=the+answer+to+life+the+universe+and+everything</a></li></ul><p>Next week I will write more about loop and a little bit on recursive.</p><p><a href="https://gist.github.com/gunawanwijaya/9651156e02cf063b980fd8c559513b8b">https://gist.github.com/gunawanwijaya/9651156e02cf063b980fd8c559513b8b</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcfbd5224371" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>