<?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>Forem: Tamrat</title>
    <description>The latest articles on Forem by Tamrat (@tamrrat).</description>
    <link>https://forem.com/tamrrat</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%2F25446%2F78332eb3-2648-4dc7-856b-7e3e3f01728b.jpg</url>
      <title>Forem: Tamrat</title>
      <link>https://forem.com/tamrrat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tamrrat"/>
    <language>en</language>
    <item>
      <title>3 fundamental things I learned about React</title>
      <dc:creator>Tamrat</dc:creator>
      <pubDate>Thu, 10 Aug 2017 13:17:22 +0000</pubDate>
      <link>https://forem.com/tamrrat/3-fundamental-things-i-learned-about-react</link>
      <guid>https://forem.com/tamrrat/3-fundamental-things-i-learned-about-react</guid>
      <description>&lt;p&gt;I am learning about React and I found a talk given by Pete Hunt as one of the best “birds eye view &lt;a href="https://www.youtube.com/watch?v=x7cQ3mrcKaY&amp;amp;t=11s"&gt;introduction to React&lt;/a&gt;(even though it’s from 2013). The talk helped me really conceptualize why I was actually using React while making &lt;a href="http://www.tamrat.co/zaha-a-visual-note-taking-app/"&gt;my first React app&lt;/a&gt; :)&lt;/p&gt;

&lt;p&gt;There is an enormous amount of tutorials on React. However, a lot of them only explain the HOW of React and don’t adequately explain the WHY of React. I believe knowing the WHY in anything comes first and over time, becomes much more valuable than the HOW.&lt;/p&gt;

&lt;p&gt;Here are some notes I took from the talk:&lt;/p&gt;

&lt;h2&gt;
  
  
  Short version
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Build Components, not templates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Re-render, don’tÂ mutate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Virtual DOM is simple andÂ fast.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  React
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;React is a JavaScript library for creating user interfaces.&lt;/li&gt;
&lt;li&gt;React renders your UI and responds to events.&lt;/li&gt;
&lt;li&gt;Simply put React's basic formula is &lt;strong&gt;function(data) = View&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A JavaScript function accepts arguments and returns a value. Similarly, a React Component receives data (props) as an argument and returns a UI(view). &lt;/li&gt;
&lt;li&gt;Then the entire React application becomes &lt;strong&gt;a composition of functions&lt;/strong&gt; that together makeup the object representation of your UI(View).&lt;/li&gt;
&lt;li&gt;JSX is just an abstraction over those functions and it simply transpiles down to a JavaScript representation of a DOM object.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Building components, not templates
&lt;/h2&gt;

&lt;h3&gt;
  
  
  a. What does separation of concernsÂ actually mean?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Separation of concerns doesn't mean separating technologies (i.e. templates). It means &lt;strong&gt;reducing Coupling and increasing Cohesion&lt;/strong&gt; between the concerns regardless of technology.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coupling&lt;/strong&gt;: The degree to which each program module relies on each of the other modules. If you want to implement a feature or fix a bug and you make a change to one module or class, how often do you have to go to other parts of your module or codebase and make changes in order for that feature to work. These sort of cascading changes are symptoms of coupling and that’s what makes software hard to maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cohesion&lt;/strong&gt;: The degree to which elements of a module belong together. It is based on the single responsibility principle and basically means grouping related functionality into modules. The litmus test is to ask “does this function make sense? or “Is this function doing a lot of stuff and can you refactor it into other pieces?”&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  b. A framework cannot know how to separate your concerns forÂ you.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It should only provide powerful and expressive tools for the user to do it correctly. This powerful and expressive tool is a &lt;strong&gt;React Component&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React Component&lt;/strong&gt; = A &lt;strong&gt;highly cohesive&lt;/strong&gt; building block for UIs, &lt;strong&gt;loosely coupled&lt;/strong&gt; with other components.&lt;/li&gt;
&lt;li&gt;React uses components to separate our concerns with the full power of JavaScript and not crippled with a templating language.&lt;/li&gt;
&lt;li&gt;React Components are &lt;strong&gt;reusable, composable and unit testable&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Re-render the whole app on every update
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This is the key design decision that makes React awesome.&lt;/li&gt;
&lt;li&gt;Building UIs is hard because there is so much state. Lots of UI elements, design iteration, crazy environments, mutable DOM, user input, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data changing over time is the root of all evil&lt;/strong&gt;. It is really hard to reason about.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Our intellectual powers are rather geared to master static relations and our powers to visualize processes evolving in time are relatively poorly developed. For that reason we should do our utmost to &lt;strong&gt;shorten the conceptual gap between the static program and the dynamic process&lt;/strong&gt;, to make the correspondence between the program(spread out in text space) and the process (spread out in time) as trivial as possibleâ€Š–â€ŠDijkstra&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;In short, Dijkstra is saying that it is really hard for us to think of processes over time but it’s fairly straightforward for us to trace the flow of a program.&lt;/li&gt;
&lt;li&gt;So we should take processes that go over time and build abstractions that make them look like programs that execute in a single point of time.&lt;/li&gt;
&lt;li&gt;It was easier in the 90’s: when data changes just refresh the page.&lt;/li&gt;
&lt;li&gt;Now with React when the data changes, &lt;strong&gt;React re-renders the entire component&lt;/strong&gt;. This makes it really easy for us to think about what state our application is in. &lt;/li&gt;
&lt;li&gt;That is, React components describe your UI at any point in time, just like a server-rendered app.&lt;/li&gt;
&lt;li&gt;Re-rendering on every change makes things simple. Every place data is displayed is guaranteed to be up-to-date without an explicit DOM operationâ€Š–â€Ševerything is declarative.&lt;/li&gt;
&lt;li&gt;However, re-rendering on every change is an expensive operation! And that’s why React also comes with a &lt;strong&gt;Virtual DOM&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. VirtualÂ DOM
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;VirtualÂ DOM makes re-rendering on every change fast.&lt;/li&gt;
&lt;li&gt;You can’t just throw out the DOM and rebuild it on each update.&lt;/li&gt;
&lt;li&gt;Virtual DOM is built to optimize for performance and memory footprint when performing a re-rendering.&lt;/li&gt;
&lt;li&gt;On every update, React builds a new virtual DOM subtree and diffs it with the old one. Then it computes the minimal set of DOM mutations and puts them in a queue and finally batch executes all updates.&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
    </item>
    <item>
      <title>Blogging Driven Learning</title>
      <dc:creator>Tamrat</dc:creator>
      <pubDate>Mon, 24 Jul 2017 17:16:31 +0000</pubDate>
      <link>https://forem.com/tamrrat/blogging-driven-learning</link>
      <guid>https://forem.com/tamrrat/blogging-driven-learning</guid>
      <description>&lt;p&gt;When I seriously started learning programming about 8 months ago, I had a hard time memorizing important concepts that I was learning. The process went something like this:&lt;/p&gt;

&lt;p&gt;Learn about some JavaScript concept. Let's say clousures.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See it used on a tutorial some days later.&lt;/li&gt;
&lt;li&gt;Try to recall what closure is but fail.&lt;/li&gt;
&lt;li&gt;Google around and discover 4 more slightly different explanations of what clousureÂ is.&lt;/li&gt;
&lt;li&gt;Get frustrated, give up on trying to really understand clousure and move on with the rest of the tutorial.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I knew this was not going to be sustainable. It all changed when I watched &lt;a href="https://www.udemy.com/understand-javascript/"&gt;this course on Udemy&lt;/a&gt;Â (only $10 at the time!). What is so great about the course is that it throughly explains in detail, all the other concepts needed to explain one concept. It felt like reading a good story. &lt;/p&gt;

&lt;p&gt;I started writing a blog post to help me memorize the concepts.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.tamrat.co/notes-on-javascript-understanding-the-weird-parts/"&gt;The post&lt;/a&gt; ended up being 1500 words long! This might not be a lot for regular bloggers, but for me, I hadn't bloggedÂ 1500 words in total before.&lt;/p&gt;

&lt;p&gt;For each concept learned, I created my own example/implementation of it. The point was not to fully understand all the concepts, rather it was to document each concept and concretize it in my own terms.&lt;/p&gt;

&lt;p&gt;This meant that every time I forget what a concept entailed, I no longer frantically google it. Rather, I comeback to my blog post and acclimate myself again and again. If I have learned something new in between, then I modified the blog post accordingly. The repetition of this process allowed for concepts to sink in my head organically. This way, I no longer solely relied on memory retention.&lt;/p&gt;

&lt;p&gt;I've repeated this Blogging Driven Learning methodÂ a few times now and it's been working great!Â &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I wrote this &lt;a href="http://www.tamrat.co/notes-on-node-js/"&gt;to learn about Node JS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;I am also currently doing a series on Data structures and Algorithm in Javascript: &lt;a href="http://www.tamrat.co/list-adt-data-structures-algorithms-in-javascript-p-1/"&gt;Lists&lt;/a&gt;, &lt;a href="http://www.tamrat.co/stacks-data-structures-algorithms-in-javascript-p-2/"&gt;Stacks&lt;/a&gt;,Â &lt;a href="http://www.tamrat.co/queues-data-structures-algorithms-in-javascript-p-3/"&gt;Queues&lt;/a&gt;,Â &lt;a href="http://www.tamrat.co/linked-list-data-structures-algorithms-in-javascript-p-4/"&gt;Linked Lists&lt;/a&gt; and more coming soon!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So in the end blogging has become a reliableÂ cheat sheet / documentation written for myself. And now my blog is full of unpublished drafts about all kind of topics (programming, meditation, architecture...) that I plan to explain to myself using the same method.&lt;/p&gt;

&lt;p&gt;There is of course another dimension to blogging: It's Public! In fact that is the scary part in all of this, specially writing about technical topics. The most important realization that helped me get over this fear is the fact that I'm really blogging for myself. It justÂ so happens that other people can also see what I write.&lt;/p&gt;

&lt;p&gt;If other people find what I write useful, great! However, as far as I'm concerned, my blog has an intended grand audience of one person.&lt;/p&gt;

&lt;p&gt;p.s. If you are looking for a fronend dev who's always eager to learn ðŸ˜‰, ping me &lt;a class="mentioned-user" href="https://dev.to/tamrrat"&gt;@tamrrat&lt;/a&gt;
! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Notes on the World Wide Web and the Internet</title>
      <dc:creator>Tamrat</dc:creator>
      <pubDate>Thu, 13 Jul 2017 22:46:09 +0000</pubDate>
      <link>https://forem.com/tamrrat/notes-on-the-world-wide-web-and-the-internet</link>
      <guid>https://forem.com/tamrrat/notes-on-the-world-wide-web-and-the-internet</guid>
      <description>

&lt;p&gt;It dawned on me that while learning to program for the web, I've never taken a step back to actually understand some of the most fundamental concepts of the web. So I decided to fix it...by furiously googling on the internets of course! :) I also took some notes...&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;World Wide Web&lt;/strong&gt; is a magical place where all the interlinked &lt;strong&gt;web resources&lt;/strong&gt; live. Each resource is identifiable by a Uniform Resource Locator (URL) and accessible via the Internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource&lt;/strong&gt; - an entity that can be identified, named or addressed in any way whatsoever, on the Web.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Internet&lt;/strong&gt; - is a network of interconnected computers that communicate using a host of protocols.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Server Model&lt;/strong&gt; - is one model that dictates how computers interact with each other over the internet. Typically the client initiates the communication with a &lt;strong&gt;request&lt;/strong&gt; for a resource or a service and the server provides a &lt;strong&gt;response&lt;/strong&gt;. The browser is one such client that users use to communicate with a server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IP (Internet Protocol)&lt;/strong&gt; - is a unique address that identifies each interconnected computer in the client server model. But before the client and server exchange a request and a response, they need to establish a connection with each other in a process called Three-Way Handshake.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Three-Way Handshake&lt;/strong&gt; - in simple terms, first the client sends a Synchronize packet to the server. The server then sends a Synchronize Acknowledgment to the client. Finally, the client sends back an Acknowledgment and the process is done. After identifying each other, the client and server can nowÂ open a &lt;strong&gt;socket connection&lt;/strong&gt; between them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port number&lt;/strong&gt; - is a number that identifies the specific program on the computer that is making the request/response. The client and server can now send information back and forth across the socket connection using this Port number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Packets&lt;/strong&gt; - the information being sent back and forth is not sent all at once. It is split into small packets of data and sent across the socket from one computer to another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TCP ( Transmission Control Protocol )&lt;/strong&gt; is the protocol that specifies the way in which the splitting of the information into &lt;strong&gt;small packets&lt;/strong&gt; is conducted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP&lt;/strong&gt; is the protocol that defines how &lt;strong&gt;each individual packet&lt;/strong&gt; of information transmitted over the socket should be structured.&lt;/p&gt;

&lt;p&gt;HTTP also consists of &lt;strong&gt;verbs&lt;/strong&gt; that indicate a type of action to be performed on a specific resource. Most common verbs are the GET, POST, PUT and DELETE verbs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;URL&lt;/strong&gt; - is simply a web address that points to a specific resource in a network.&lt;/p&gt;

&lt;p&gt;To sum it up, when we type in a &lt;strong&gt;URL&lt;/strong&gt; and hit enter on our &lt;strong&gt;Internet&lt;/strong&gt; connected browser (&lt;strong&gt;client&lt;/strong&gt;), we are telling the browser that somewhere in the &lt;strong&gt;World Wide Web&lt;/strong&gt; there exists a &lt;strong&gt;resource&lt;/strong&gt; at this URL address, can you please &lt;strong&gt;GET&lt;/strong&gt; it?&lt;/p&gt;

&lt;p&gt;The browser then makes an &lt;strong&gt;HTTP request&lt;/strong&gt; to the specified &lt;strong&gt;server&lt;/strong&gt;. The server then &lt;strong&gt;responds&lt;/strong&gt; with a resource in the form of HTML, which might prompt other requests for images and css. After it receives the response, the browser then proceeds to render the webpage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representational State Transfer (REST)&lt;/strong&gt; - is a set of stylistic architectural principles to guide application development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representation&lt;/strong&gt; - Whenever a server responds with a requested resource, what we get back is not actually the resource object itself. Rather, the server gives us only a &lt;strong&gt;representation of the current state(data) of a resource object&lt;/strong&gt; in a specific format, perhaps JSON. But the response could've also been in an HTML or an XMl format.&lt;/p&gt;

&lt;p&gt;In a similar manner when a client makes a request. The request is a &lt;strong&gt;representation of the desired state of the resource&lt;/strong&gt;. The &lt;strong&gt;HTTP verb&lt;/strong&gt; included in the request tells the server the desired action to be applied to change the state of the resource (GET, PUT, DELETE...).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;REST&lt;/strong&gt; is then a set of rules on how a client and a server can &lt;strong&gt;transfer&lt;/strong&gt; the &lt;strong&gt;state&lt;/strong&gt; of a resource via &lt;strong&gt;representation&lt;/strong&gt;.Â When a user interacts with a resource like clicking a link, another request is triggered to transfer the next state of the resource.&lt;/p&gt;


</description>
      <category>webdeveloper</category>
      <category>beginners</category>
      <category>frontend</category>
      <category>http</category>
    </item>
  </channel>
</rss>
