<?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[Korbit Engineering - Medium]]></title>
        <description><![CDATA[Trade digital assets. Transfer money globally. Engineer the future. - Medium]]></description>
        <link>https://medium.com/korbit-engineering?source=rss----46f19e2434c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Korbit Engineering - Medium</title>
            <link>https://medium.com/korbit-engineering?source=rss----46f19e2434c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:03:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/korbit-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[let과 const는 호이스팅 될까?]]></title>
            <link>https://medium.com/korbit-engineering/let%EA%B3%BC-const%EB%8A%94-%ED%98%B8%EC%9D%B4%EC%8A%A4%ED%8C%85-%EB%90%A0%EA%B9%8C-72fcf2fac365?source=rss----46f19e2434c---4</link>
            <guid isPermaLink="false">https://medium.com/p/72fcf2fac365</guid>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[hoisting]]></category>
            <category><![CDATA[const]]></category>
            <dc:creator><![CDATA[yocee57]]></dc:creator>
            <pubDate>Fri, 29 Sep 2017 13:04:40 GMT</pubDate>
            <atom:updated>2017-09-29T13:04:40.413Z</atom:updated>
            <content:encoded><![CDATA[<p>let 또는 const가 호이스팅 되는지 여부를 알아보기 전에 호이스팅과 Temporal Dead Zone(TDZ)이란 개념에 대해 알아보겠다.</p><h3>Hoisting</h3><p>let 또는 const가 호이스팅 되는지 여부를 알아보기 전에 호이스팅과 Temporal Dead Zone(TDZ)이란 개념에 대해 알아보겠다.<br>호이스팅은 말 그대로 끌어올려진다는 의미를 가진다. 스코프 안의 어디에서든 변수 선언은 최상위에서 선언된 것과 동등하다.<br>아래 예제에서 출력되는 x는 outer scope가 아닌 undefined이다.</p><pre>var x = &#39;outer scope&#39;;</pre><pre>(function() {<br>  console.log(x); // undefined<br>  var x = &#39;inner scope&#39;;<br>}());</pre><p>스코프 안에서 선언된 변수는 항상 최상위에 선언한 것과 동등한 의미를 가지기 때문이다. 즉, 위 코드는 아래와 같은 의미를 지닌다.</p><pre>var x = &#39;outer scope&#39;;</pre><pre>(function() {<br>  var x;</pre><pre>  console.log(x); // undefined<br>  x = &#39;inner scope&#39;;<br>}());</pre><p>여기서 끝나는 것이 아니다. 변수가 선언되기 전에 변수를 사용할 수도 있다.</p><pre>foo = &#39;bar&#39;;<br>var foo;</pre><pre>// 위는 아래와 같은 의미를 가진다.<br>var foo;<br>foo = &#39;bar&#39;;</pre><h3>Temporal Dead Zone</h3><h4>var와 let/const의 비교로 보는 TDZ</h4><pre>console.log(x); // throws a ReferenceError<br>const x = &#39;hey&#39;;</pre><p>var와 let/const선언에 대한 범위의 차이 중 하나는 let/const가 TDZ에 의해 제약을 받는다는 것이다.<br>즉, 변수가 초기화되기 전에 액세스하려고 하면, var처럼 undefined를 반환하지 않고, ReferenceError가 발생한다. 이는 코드를 예측가능하고 잠재적 버그를 쉽게 찾아낼 수 있도록 한다.</p><p>위 예제를 보면, let/const선언은 호이스팅을 수행하지 않는다고 생각할 수 있다.<br>하지만 이는 잘못된 것이며, Hoisting에 관한 예제 코드에서 var를 const으로 바꾸면, 어떤 일이 발생하는지 살펴본다.</p><pre>const x = &#39;outer scope&#39;;</pre><pre>(function() {<br>  console.log(x);<br>  const x = &#39;inner scope&#39;;<br>}());</pre><p>console.log(x);는 TDZ에 의해 ReferenceError를 발생하게 된다.<br>이는, let/const 선언은 호이스팅을 수행하기 때문이다.<br>undefined를 반환하는 var와는 달리, 초기화되기 전에 액세스할 때 에러가 발생한다.</p><h4>TDZ 살펴보기</h4><p>let/const선언은 실행중인 실행 컨텍스트의 어휘적 환경(Lexical Environment)으로 범위가 지정된 변수를 정의한다.<br>변수는 그들의 어휘적 환경에 포함될 때 생성되지만, 어휘적 바인딩이 실행되기 전까지는 액세스할 수 없다.<br>새로운 범위에 진입할 때마다 지정된 범위에 속한 모든 let/const바인딩이 지정된 범위 내부의 코드가 실행되기 전에 실행된다. (즉, let/const선언이 호이스팅된다.)<br>어휘적 바인딩이 실행되기 전까지 액세스할 수 없는 현상을 TDZ라고 한다.</p><pre>// const x를 실행하기 전에 x에 접근하면, TDZ에 의해 ReferenceError가<br>발생하게 된다.<br>// console.log(x);</pre><pre>const x = 42;<br>// 위 코드 실행 이후에는 x에 접근할 수 있다.<br>console.log(x);</pre><p>어휘적 바인딩에 의해 초기화되며 정의된 변수는 변수가 만들어질 때가 아닌, 값이 해당 초기화 구문 어휘적 바인딩이 실행될 때 값을 할당받는다.<br>let/const선언의 어휘적 바인딩에 초기화 구문이 없으면, 어휘적 바인딩을 실행할 때, 변수에 undefined가 할당된다.</p><pre>let x; // 이는 let x = undefined; 와 같다.<br>// const 키워드는 반드시 선언과 동시에 값을 할당해야 한다.<br>// const x; Uncaught SyntaxError: Missing initializer in const declaration</pre><p>let/const변수는 초기화 구문이 완전히 실행된 이후에 우변이 실행되고 그 결과 값이 선언된 변수에 할당된 후 초기화된다. 우변에서 let/const로 선언된 변수를 사용하는 경우, 우변은 변수를 읽으려고 시도하지만 초기화 구문이 아직 완전히 실행되지 않은 상태이므로, ReferenceError가 발생한다.</p><pre>const x = x; // ReferenceError</pre><pre>const a = f(); // ReferenceError</pre><pre>const b = 2;<br>function f() {<br>  return b;<br>}</pre><p>디폴트 파라미터(Default Parameters)에서도 TDZ가 적용되는데, 디폴트 파라미터는 주어진 함수의 해당 범위와 내부 범위 사이에 있는 중간 범위에서 실행된다.</p><pre>(function(a, b = a) {<br>  a === 1; // true<br>  b === 1; // true<br>}(1, undefined));</pre><pre>// 디폴트 파라미터는 왼쪽에서 오른쪽으로 실행되며, a의 초기화 구문이 b를 읽을 때, b는 TDZ에 있다.<br>// 따라서, ReferenceError가 발생한다.<br>(function(a = b, b) {}(undefined, 1)); // ReferenceError</pre><pre>// a는 a의 초기화구문이 a를 읽으려고 할 때, TDZ에 있으므로, ReferenceError가 발생한다.<br>(function(a = a) {}()); // ReferenceError</pre><p>class에서도 TDZ가 적용된다. 상위 생성자를 호출하기 전에 this에 액세스하려고 하는 하위 클래스의 생성자는 ReferenceError를 발생시킨다. 하위 클래스의 생성자가 super();를 호출하지 않는 한, this 바인딩은 초기화되지 않은 것으로 간주된다. 하위 클래스 생성자에 super();가 없으면, 생성자는 암시적으로 return this;를 시도한다.</p><pre>class A extends B { // ReferenceError<br>  /* ... */<br>}</pre><pre>class B {<br>  /* ... */<br>}</pre><p>TDZ는 초기화되지 않은 바인딩에 액세스하려는 경우, 예기치 않은 결과를 내는 대신에 개발자에게 에러 피드백을 제공하기 때문에 유용하게 사용된다.</p><h3>결론</h3><p>let/const선언 변수는 호이스팅되지 않는 것이 아니다. 스코프에 진입할 때 변수가 만들어지고 TDZ(Temporal Dead Zone)가 생성되지만, 코드 실행이 변수가 실제 있는 위치에 도달할 때까지 액세스할 수 없는 것이다. let/const변수가 선언된 시점에서 제어흐름은 TDZ를 떠난 상태가 되며, 변수를 사용할 수 있게 된다.</p><h3>참고</h3><ul><li><a href="http://jsrocks.org/2015/01/temporal-dead-zone-tdz-demystified">JS ROCKS : TEMPORAL DEAD ZONE (TDZ) DEMYSTIFIED</a></li><li><a href="https://tc39.github.io/ecma262/#sec-let-and-const-declarations">TC39 Github pages : Section 13.3</a></li><li><a href="https://dzone.com/articles/learning-es6-using-let-const-and-temporal-dead-zon">DZone : Learning ES6: Using let, const, and Temporal Dead Zone</a></li><li><a href="https://ponyfoo.com/articles/es6-let-const-and-temporal-dead-zone-in-depth">Pony Foo : ES6 Let, Const and the “Temporal Dead Zone” (TDZ) in Depth</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72fcf2fac365" width="1" height="1" alt=""><hr><p><a href="https://medium.com/korbit-engineering/let%EA%B3%BC-const%EB%8A%94-%ED%98%B8%EC%9D%B4%EC%8A%A4%ED%8C%85-%EB%90%A0%EA%B9%8C-72fcf2fac365">let과 const는 호이스팅 될까?</a> was originally published in <a href="https://medium.com/korbit-engineering">Korbit Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[함수형 프로그래밍이란?]]></title>
            <link>https://medium.com/korbit-engineering/%ED%95%A8%EC%88%98%ED%98%95-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D%EC%9D%B4%EB%9E%80-e7f7b052411f?source=rss----46f19e2434c---4</link>
            <guid isPermaLink="false">https://medium.com/p/e7f7b052411f</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[yocee57]]></dc:creator>
            <pubDate>Fri, 22 Sep 2017 06:21:48 GMT</pubDate>
            <atom:updated>2017-09-22T06:21:47.467Z</atom:updated>
            <content:encoded><![CDATA[<p>함수형 프로그래밍은 순수한 함수를 작성하고, 공유된 상태와 변경 가능한 데이터 및 부작용을 피하여 소프트웨어를 작성하는 프로세스이다.<br>함수형 프로그래밍은 명령형이 선언형이며, 애플리케이션의 상태는 순수한 함수를 통해 전달된다.<br>애플리케이션의 상태가 공유되고, 객체의 메소드와 사용되는 객체 지향 프로그래밍과는 대조된다.</p><h3>함수형 프로그래밍의 장점</h3><p>함수형 코드는 명령형이나 객체지향 코드보다 간결하고 예측하기 쉬우며, 이에 따라 테스트가 더 쉬워진다.</p><h3>Pure functions</h3><p>함수형 프로그래밍에서 중요한 핵심은 함수는 부작용이 없어야 하며, 외부의 상태에 종속되지 않아야 한다.<br>즉, 함수는 입력을 받고 출력을 반환함에 있어 외부의 값에 접근하지 않아야 한다.<br>다음 예제를 통해 순수함수와 순수함수가 아닌 함수에 대해 알아보겠다.</p><pre>/* pure function */<br>const double = num =&gt; (num * 2);</pre><pre>/* impure function */<br>const operand = 2;<br>const multiple = num =&gt; (num * operand);</pre><p>double의 입력이 2라면, 해당 함수의 반환값은 항상 4이다.<br>반면, multiple의 입력이 2로 고정되어도 함수 외부의 operand가 다른 2가 확실하지 않다면 반환 값을 4라고 예상하기 힘들다.</p><h3>Higher Order Functions</h3><p>HOC(Higher Order Functions)는 다른 함수를 인자로 사용하거나 함수를 반환하는 함수, 또는 두 가지 특징을 모두 가진 함수이다.<br>고차 함수는 다음과 같은 경우 주로 사용된다.</p><ul><li>콜백 함수, 프로미스, 모나드 등을 사용하여, 동작과 효과 또는 비동기 흐름 제어를 추상화하거나 격리한다.</li><li>다양한 데이터 유형에 대해 작동할 수 있는 유틸리티 생성한다.</li><li>함수를 부분적으로 인수에 적용하거나 재사용 또는 함수 조합을 위한 커리함수를 작성한다.</li><li>함수 목록을 가져오고, 해당 입력 함수의 조합을 반환한다.</li></ul><p>다음은 사용 예제이다.</p><pre>const isEven = x =&gt; !(x % 2);</pre><pre>const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];<br>const evenNumbers = numbers.filter(isEven);</pre><pre>console.log(evenNumbers); // 2, 4, 6, 8, 10</pre><p>isEven은 배열을 처리하는 로직이 필요 없으며, 배열을 순환하면서 재사용된다.</p><h3>Currying</h3><p>커링은 여러 인자를 받는 함수를 인자 하나씩 사용하여 함수 순서를 실행할 수 있도록 변환하는 것을 말한다.<br>이는 람다 표현식과 클로저를 통해 쉽게 구현할 수 있다.</p><pre>/* not curried function */<br>function sumOfThreeThings(x, y, z) {<br>  return x + y + z;<br>}</pre><pre>sumOfThreeThings(1, 2, 3); // 6</pre><pre>/* curried function */<br>const sumOfThreeThings = x =&gt;<br>  y =&gt;<br>    z =&gt;<br>      x + y + z;<br>sumOfThreeThings(1)(2)(3); // 6</pre><h3>Auto-currying</h3><p><a href="https://github.com/lodash/lodash">lodash</a>와 <a href="https://github.com/ramda/ramda">Ramda</a>는 curry메소드를 가지고 있다. 이는 여러개의 인수를 가지는 함수를 커링된 함수로 만들어준다.</p><pre>// use lodash or ramda<br>const curry = _.curry || R.curry;</pre><pre>// given function that add 2 parameters<br>const add = (x, y) =&gt; x + y</pre><pre>// transfired function<br>const curriedAdd = curry(add);</pre><pre>// results<br>curriedAdd(1)(2) // 3<br>curriedAdd(1) // (y) =&gt; 1 + y<br>curriedAdd(1, 2) // 3</pre><h3>Function composition</h3><p>합성함수는 말그대로 두 가지 이상의 함수가 합성되었음을 뜻한다.<br>두 함수 f와 g가 있고 f(g(x))와 같이 사용된다고 할 때, 이를 수식 f ∘ g(x)과 같이 표현할 수 있다.<br>다음은 합성함수의 예시이다.</p><pre>const compose = (f, g) =&gt; x =&gt; f(g(x));</pre><pre>const add = x =&gt; y =&gt; x + y;<br>const pow = x =&gt; y =&gt; y ** x;</pre><pre>const add2 = add(2);<br>const square = pow(2);</pre><pre>const add2ThenSqaure = compose(square, add2);</pre><pre>add2ThenSquare(10); // 144 </pre><h3>Point free notation</h3><p>Point free는 함수를 작성할 때, 매개변수를 정의하지 않는 것이다.<br>이는 함수를 더욱 간결하게 해준다.<br>다음은 point free한 함수에 대한 예이다.</p><pre>const map = fn =&gt; list =&gt; list.map(fn);<br>// or use lodash/fp<br>// import { map } from &#39;lodash/fp&#39;;</pre><pre>const add = x =&gt; y =&gt; x + y;</pre><pre>/* function without point-free */<br>const incrementAll = numbers =&gt; map(add(1))(numbers);</pre><pre>/* function with point-free */<br>const incrementAllWithPointFree = map(add(1));</pre><pre>incrementAll([1, 2, 3]); // [2, 3, 4]<br>incrementAllWithPointFree([1, 2, 3]); // [2, 3, 4]</pre><p>불필요한 매개변수를 사용하지 않으므로 매개변수에 대한 이름들에 대해 생각하지 않아도 되며, 코드가 훨씬 간결해진다.</p><h3>Recursion</h3><p>재귀 함수는 어느 조건을 만족할 때까지 자기 자신을 호출하는 함수이다.<br>자바스크립트는 반복을 할 때, for, while 등의 반복문을 사용하지만, 함수형 프로그래밍에서는 반복문 대신 재귀를 사용한다.<br>아래 예제는 동일한 루프 회수와 값을 얻게되는 반복문과 재귀함수이다.<br>기존의 어떤 값을 수정하는 것이 아니라, 기존 값으로 새로운 값을 계산하고 이를 사용한다.</p><pre>/* sum 1..10 with loop */<br>let sum = 0;<br>for (let i = 1; i &lt;= 10; i++) {<br>  sum += i + 1;<br>}<br>console.log(acc); // 55</pre><pre>/* sum 1..10 with recursion */<br>sumRange = ({ start, end }) =&gt;<br>  (sum) =&gt; {<br>    if (start &gt; end) {<br>      return sum;<br>    }<br>    return sumRange({ start: start + 1, end })(sum + start);<br>  };</pre><pre>sumRange({ start: 0, end: 10 })(0);</pre><p>재귀는 for, while 등의 반복문을 대체할 수 있을 뿐만 아니라, 훨씬 유용하다. 특히 분할 및 정복 알고리즘을 구현하는 데 매우 유용하다.<br>가장 대표적인 재귀 함수 사용 예는 팩토리얼(!)이다.</p><pre>const factorial = n =&gt;<br>  n ?<br>    n * factorial(n - 1) :<br>    1;</pre><h4>재귀의 단점</h4><p>꼬리재귀 최적화가 되어있지 않은 언어에서는 재귀 사용 시 단점들이 있다.</p><ul><li>반복문에 비해 속도가 느리다.</li><li>스택을 사용하기 때문에 반복이 많아질 경우, 스택오버플로우가 발생될 수도 있다.</li></ul><p>ES2015의 strict mode는 TCO(Tail Call Optimization)를 제공하지만, ES5는 그렇지 않다.<br>따라서, ES5에서 일반 반복대신 재귀를 사용하는 것은 성능 상의 이슈를 가질 수 있다.</p><h3>Monads</h3><p>Monad는 of와 chain이 있는 객체이다.(chain은 중첩된 객체를 un-nenesting하는 점을 제외하면, map과 같다.)</p><pre>// Implementation<br>Array.prototype.chain = function (f) {<br>  return this.reduce((acc, it) =&gt; acc.concat(f(it)), []);<br>}</pre><pre>// Usage<br>Array.of(&#39;cat,dog&#39;, &#39;fish,bird&#39;).chain(e =&gt; e.split(&#39;,&#39;)); // [&#39;cat&#39;, &#39;dog&#39;, &#39;fish&#39;, &#39;bird&#39;]</pre><pre>// Difference with map<br>Array.of(&#39;cat,dog&#39;, &#39;fish,bird&#39;).map(e =&gt; e.split(&#39;,&#39;)); // [[&#39;cat&#39;, &#39;dog&#39;], [&#39;fish&#39;, &#39;bird&#39;]]</pre><h3>함수형 자바스크립트</h3><p>자바스크립트는 유연하다. 함수형, 객체지향형 패러다임의 특징을 모두 가지고 있다.<br>함수형 패러다임으로 코드를 작성할 수 있지만 이상적인 함수형 프로그래밍을 하긴 어렵다. 하지만, 다양한 라이브러리를 통해 이를 보완할 수 있다.</p><h3>불변성</h3><p>위에서 말했듯이 함수형 프로그래밍에서는 부작용이 없어야 한다.<br>따라서, 변수를 없애고 모든 값을 상수로 만들기 위해 ES2015의 const를 사용할 수 있다.<br>const는 객체가 아닌 값에 대해서는 충분하지만, 객체에서는 충분하지 않다.</p><pre>const arr = [1, 2, 3];</pre><pre>arr.push(4);<br>arr.unshift(0);</pre><pre>console.log(arr); // [0, 1, 2, 3, 4]</pre><pre>const obj = { x: 1, y: 2 };</pre><pre>delete obj.x;<br>obj.y = 5;<br>obj.z = 0;</pre><pre>console.log(obj); // { y: 5, z: 0 };</pre><p>const로 선언되었지만, arr와 obj는 변경되었다. 이를 방지하기 위해, <a href="https://github.com/facebook/immutable-js">Immutable.js</a> 등의 라이브러리를 사용하거나, <a href="https://developer.mozilla.org/cs/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze">Object.freeze</a> 메소드를 사용할 수 있다.</p><h4>Object.freeze</h4><p>다음은 Object.freeze의 사용 예제이다.</p><pre>const arr = Object.freeze([1, 2, 3]);<br>// arr.push(4); throw error<br>// arr.unshift(0); throw error</pre><pre>const obj = Object.freeze({ x: 1, y: 2 });<br>// delete obj.x; throw error<br>// obj.y = 5; throw error<br>// obj.z = 0; throw error</pre><p>하지만 Object.freeze는 깊은 곳 까지 불변성을 가지게 하지는 못한다. 이 때, <a href="https://github.com/substack/deep-freeze">deep-freeze</a>를 사용할 수도 있다.</p><h4>lodash/fp</h4><p>다음은 fp.set을 통한 객체 사용의 예제이다.<br>Immutablity.js나 Object.freeze를 사용하지 않으면 객체의 불변성을 보장할 수는 없지만, 객체를 직접 사용하는 경우를 만들지 않음으로써, 객체의 불변성을 보장할 수 있다.</p><pre>import fp from &#39;lodash/fp&#39;;<br>const { set } = fp;<br>// const { set, flow } = fp;</pre><pre>const obj = { x: 1, y: { innerY: 2 } };<br>const newObj = set(&#39;y.innerY&#39;, 42)(set(&#39;z&#39;, 3)(obj));<br>// of use flow<br>// const newObj = flow(fp.set(&#39;y.innerY&#39;, 42), fp.set(&#39;z&#39;, 3))(obj);</pre><pre>console.log(obj); // { x: 1, y: { innerY: 2 } }<br>console.log(newObj); // { x: 1, y: { innerY: 42 }, z: 3 }</pre><h4>Spread operator</h4><p>ES2016의 ...를 통해 객체를 변경을 피할 수도 있다.</p><pre>const obj = { x: 1, y: 2 };<br>const newObj = { ...obj, z: 3 };</pre><pre>console.log(obj); // { x: 1, y: 2 }<br>console.log(newObj); // { x: 1, y: 2, z: 3 }</pre><h3>커링</h3><pre>const f = a =&gt; b =&gt; c =&gt; d =&gt; e =&gt; a + b + c + d + e;<br>f(1)(2)(3)(4)(5);</pre><p>이 커링된 함수는 ()가 너무 많다. 이를 개선하기 위해 위에서 언급한 lodash나 ramda를 사용할 수 있다.</p><pre>const curry = _.curry || R.curry;<br>const f = curry((a, b, c, d, e) =&gt; a + b + c + d + e;</pre><pre>f(1)(2)(3)(4)(5); // 15<br>f(1)(2, 3, 4, 5); // 15<br>f(1, 2)(3)(4, 5); // 15<br>f(1, 2, 3, 4, 5); // 15</pre><h3>합성함수</h3><p>합성함수 예제에서 const compose = (f, g) =&gt; x =&gt; f(g(x));와 같이 함수를 합성했지만, ramda의 compose함수를 사용할 수도 있다.</p><pre>const composedFunction = R.compose(x =&gt; x + 5, x =&gt; x * 10);</pre><h3>참고</h3><ul><li><a href="https://medium.com/javascript-scene/master-the-javascript-interview-what-is-functional-programming-7f218c68b3a0">Master the JavaScript Interview: What is Functional Programming?</a></li><li><a href="https://www.airpair.com/javascript/posts/mastering-es6-higher-order-functions-for-arrays">Mastering ES6 higher-order functions for Arrays</a></li><li><a href="https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf">Why Functional Programming Matters</a></li><li><a href="http://2ality.com/2015/06/tail-call-optimization.html">Tail call optimization in ECMAScript 6</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7f7b052411f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/korbit-engineering/%ED%95%A8%EC%88%98%ED%98%95-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D%EC%9D%B4%EB%9E%80-e7f7b052411f">함수형 프로그래밍이란?</a> was originally published in <a href="https://medium.com/korbit-engineering">Korbit Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React, JSX and ES6 as a template language]]></title>
            <link>https://medium.com/korbit-engineering/react-jsx-and-es6-as-a-template-language-159adc833c15?source=rss----46f19e2434c---4</link>
            <guid isPermaLink="false">https://medium.com/p/159adc833c15</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Bertrand Boustany]]></dc:creator>
            <pubDate>Thu, 23 Feb 2017 04:28:36 GMT</pubDate>
            <atom:updated>2017-02-26T06:57:57.203Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9j27CE0hp1ZnNTIP033e2w.png" /></figure><p>The last few years have seen an important popularity increase of front-end rendering frameworks and what once was a cosmetic paint coating using handwritten HTML and CSS became an abstracted JavaScript process that renders HTML and CSS. The benefits of client-side HTML rendering are plenty but one down side is the rise of complexity for web integrators.</p><p>What used to be rendered on the server using a template language (here <a href="https://mustache.github.io/">moustache</a>)…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b2f664c437f8c1c8489d131e068f75c/href">https://medium.com/media/9b2f664c437f8c1c8489d131e068f75c/href</a></iframe><p>…became a very noisy JavaScript module…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6066747348f6024171441dece867e51/href">https://medium.com/media/d6066747348f6024171441dece867e51/href</a></iframe><p>The majority of the content of this file is keywords and software development notions (module, object, function, point dereference…).</p><p>Using ES6 syntactic sugars and react functional component we can greatly reduce this noise.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/420f12e1185c2f2ee94f22e035edf34d/href">https://medium.com/media/420f12e1185c2f2ee94f22e035edf34d/href</a></iframe><p>What happened here? Technically speaking, we <a href="https://developer.mozilla.org/en/docs/web/javascript/reference/statements/export">export as default</a> an <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function</a> that <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructures</a> its only argument (props) and returns some <a href="https://facebook.github.io/react/docs/jsx-in-depth.html">JSX</a>. The result is a much more simple syntax closer to a template.</p><p>But does this scale?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47a0fb1a3e6ea3d65791c325e876629a/href">https://medium.com/media/47a0fb1a3e6ea3d65791c325e876629a/href</a></iframe><p>The benefit of this notation is that we get a declarative block at the top of the file that lists the needed properties and a template block at the bottom that uses the properties.</p><p>At <a href="https://www.korbit.co.kr/">Korbit</a> we have been using this component style for <a href="https://hyphen.to/">hyphen.to</a>. This static website can be maintained by developers and non-developers alike.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=159adc833c15" width="1" height="1" alt=""><hr><p><a href="https://medium.com/korbit-engineering/react-jsx-and-es6-as-a-template-language-159adc833c15">React, JSX and ES6 as a template language</a> was originally published in <a href="https://medium.com/korbit-engineering">Korbit Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>