<?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 Natchapol Srisang on Medium]]></title>
        <description><![CDATA[Stories by Natchapol Srisang on Medium]]></description>
        <link>https://medium.com/@utopiabeam?source=rss-e117676ac415------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*L6ZKV551mI91LEreq3sapg.jpeg</url>
            <title>Stories by Natchapol Srisang on Medium</title>
            <link>https://medium.com/@utopiabeam?source=rss-e117676ac415------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 02:57:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@utopiabeam/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[[Review] Lost in SCB Open Banking Hackathon สไตล์ dev]]></title>
            <link>https://medium.com/@utopiabeam/review-lost-in-scb-open-banking-hackathon-%E0%B8%AA%E0%B9%84%E0%B8%95%E0%B8%A5%E0%B9%8C-dev-4e29988711c5?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e29988711c5</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[review]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Mon, 24 Jun 2019 10:05:21 GMT</pubDate>
            <atom:updated>2020-08-05T05:05:15.465Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IAtnC7iJLPalFyKmVDKrIA.jpeg" /><figcaption>แค่ชื่อทีมก็ชนะแล้ว 55555</figcaption></figure><p>ตอนแรกที่เห็น<a href="https://www.facebook.com/scb.thailand/posts/10157188625293545/">โพสประกาศ</a>งานนี้ก็ไม่ได้อยากมาอะไรเพราะน่าจะออกแนว business ซึ่งไม่ใช่สาย dev อย่างผม และผมก็ไม่ชอบงานแบบนี้เท่าไหร่ แต่พอโดนรุ่นพี่ล่อซื้อแบบ 100% ก็เลยคิดว่าควรจะลองก่อนที่จะไม่ชอบ สุดท้ายก็ตกลงเข้าทีมกับ<a href="https://web.facebook.com/WhatTheFar1999">พี่ฟา</a> <a href="https://web.facebook.com/piriyapong.lao">พี่เปียว</a> และ<a href="https://web.facebook.com/naisk133">พี่นัย</a>นั่นเอง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VktvoiXazsIjjKWb7c3xJw.jpeg" /><figcaption>โฉมหน้าทีม SCB Hackthon winner แบบชัด ๆ</figcaption></figure><p>เรื่องราวจะเป็นยังไงเชิญอ่านต่อได้ที่</p><p><a href="https://utopiabeam.dev/blog/scb-hackathon">Lost in SCB Open Banking Hackathon สไตล์ dev | UtopiaBeam</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e29988711c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Big-O Notation — โอไม่โอดูยังไง]]></title>
            <link>https://medium.com/@utopiabeam/big-o-notation-%E0%B9%82%E0%B8%AD%E0%B9%84%E0%B8%A1%E0%B9%88%E0%B9%82%E0%B8%AD%E0%B8%94%E0%B8%B9%E0%B8%A2%E0%B8%B1%E0%B8%87%E0%B9%84%E0%B8%87-2862262c51db?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/2862262c51db</guid>
            <category><![CDATA[math]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[complexity-analysis]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Sun, 19 May 2019 06:11:24 GMT</pubDate>
            <atom:updated>2020-08-05T05:02:26.183Z</atom:updated>
            <content:encoded><![CDATA[<h3>Big-O Notation — โอไม่โอดูยังไง</h3><p>สำหรับคนที่เคยอ่านและศึกษาเกี่ยวกับ Algorithm น่าจะต้องเคยเห็นเจ้าสัญลักษณ์ตัวโอใหญ่มาบ้าง (อย่าคิดเยอะ เดี๋ยวไม่โอ!) แต่อาจจะไม่เข้าใจว่ามันคืออะไร ทำไมต้องมี แล้วมันบอกอะไรได้บ้าง ยิ่งคนที่ไม่เคยพบเจอ Algorithm ยิ่งแล้วใหญ่ ทั้ง ๆ ที่เป็น concept ที่เข้าใจง่ายและมีประโยชน์มากเลยทีเดียว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*9v6rlIUsT71hfx4A11Qjkw.png" /></figure><p>ดังนั้น บทความนี้จะช่วยอธิบายที่มาที่ไปตั้งแต่ Basic ยัน Advance เลยทีเดียว ซึ่งอาจจะอาศัยพลังแห่งคณิตศาสตร์เล็กน้อย ถ้าใครไม่ชอบคณิตฯ ก็ทำใจร่ม ๆ เข้าไว้นะครับ (＾ω＾)</p><p>เนื้อหาแบ่งเป็น 3 parts</p><ul><li>Part 1: Why Big-O? [Easy]</li><li>Part 2: What is Big-O? [Hard]</li><li>Part 3: How to find “good” Big-O? [Medium]</li></ul><p>ถ้าพร้อมแล้วก็ไปอ่านต่อกันในนี้เลย</p><p><a href="https://utopiabeam.dev/blog/big-o-notation">Big-O Notation - โอไม่โอดูยังไง | UtopiaBeam</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2862262c51db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Review] นั่งโง่ ๆ กับงาน Stupid Hackathon Thailand #3]]></title>
            <link>https://medium.com/@utopiabeam/review-%E0%B8%99%E0%B8%B1%E0%B9%88%E0%B8%87%E0%B9%82%E0%B8%87%E0%B9%88-%E0%B9%86-%E0%B8%81%E0%B8%B1%E0%B8%9A%E0%B8%87%E0%B8%B2%E0%B8%99-stupid-hackathon-thailand-3-d3502c536312?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3502c536312</guid>
            <category><![CDATA[dev]]></category>
            <category><![CDATA[stupidhackth]]></category>
            <category><![CDATA[review]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Sun, 21 Apr 2019 15:01:17 GMT</pubDate>
            <atom:updated>2020-08-05T05:01:26.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwdRpq9R3IhMMPwRYCKp6w.jpeg" /></figure><p><strong><em>[คำเตือน: มีศัพท์เทคนิคค่อนข้างเยอะ ถ้าไม่ใช่สาย dev อาจไม่เข้าใจนะครับ]</em></strong></p><p>บอกก่อนเลยว่านี่เป็นงาน Hackathon ครั้งแรกในชีวิตเลยก็ว่าได้ (ไม่นับในชมรมอ่ะนะ) ก็เลยรู้สึกตื่นเต้นและอยากมาเล่าประสบการณ์ในงาน ว่าแล้วก็ตามไปอ่านในนี้เลย</p><p><a href="https://utopiabeam.dev/blog/stupid-hackathon-thailand-3">นั่งโง่ ๆ กับงาน Stupid Hackathon Thailand #3 | UtopiaBeam</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3502c536312" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Callback, promise, async/await วายร้าย(?) แห่ง JavaScript]]></title>
            <link>https://medium.com/thinc-org/callback-promise-async-await-%E0%B8%A7%E0%B8%B2%E0%B8%A2%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%A2-%E0%B9%81%E0%B8%AB%E0%B9%88%E0%B8%87-javascript-f5a842e59d9e?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5a842e59d9e</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Sun, 06 Jan 2019 10:12:23 GMT</pubDate>
            <atom:updated>2019-07-02T04:09:23.792Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript เป็นภาษายอดนิยมสำหรับการพัฒนาเว็บไซต์ เนื่องจากสามารถพัฒนาได้ทั้ง frontend และ backend เหมือนกับยิงปืนนัดเดียวได้นกสองตัว ข้อดีอีกข้อคงเป็นการเขียนที่ง่าย(?) สำหรับเบื้องต้น แต่สำหรับคนที่ไม่เข้าใจคอนเซปต์คร่าวๆ ว่าเบื้องหลัง JavaScript ทำงานยังไงก็อาจจะหืดขึ้นคอได้เมื่อต้องทำงานซับซ้อน แต่อย่ากังวลไป เพราะในบทความนี้เราจะได้สัมผัสกับคอนเซปต์สำคัญของ Javascript ไปด้วยกัน</p><blockquote><strong>Note: บทความนี้ไม่เหมาะสำหรับคนที่ไม่เคยเขียนหรือไม่เข้าใจ syntax เบื้องต้นของ JavaScript แนะนำว่าควรศึกษาก่อนคร่าวๆ ก่อนแล้วค่อยกลับมาอ่านนะครับ</strong></blockquote><p>ถ้าพร้อมแล้วก็อย่ารอช้า ไปเริ่มกันเลย!!</p><h3>Basic of JavaScript</h3><p>อย่างแรกที่เราควรเข้าใจคือ JavaScript เกิดมาเพื่อ frontend สำหรับการทำ dynamic content หรือการเปลี่ยน content บนหน้าเว็บโดยที่ไม่ต้อง refresh ทำให้การทำงานแบบ parallel มีความสำคัญ ตัวอย่างง่ายๆ เช่น Facebook ในหน้า News Feed จะต้องโหลดโพสทั้งหมดกับหน้าตาของเว็บไปพร้อมๆ กันได้ ถ้าไม่งั้นหน้าเว็บอาจจะต้องรอโหลดโพสจำนวนมหาศาล ทำให้เราเห็นหน้าขาวๆ จนกว่าโพสจะโหลดเสร็จ</p><blockquote>ด้วยเหตุผลนี้ JavaScript จึงทำงานแบบ Asynchronous</blockquote><p>คำว่า Asynchronous หมายถึงการทำให้โค้ดสามารถรันแยกกันได้ ซึ่งจะขัดกับสามัญสำนึกของคนที่เคยเขียน C++, Java หรือ PHP มาแน่ๆ</p><p>เพื่อให้เห็นภาพง่ายๆ เรามาดูตัวอย่างเบสิคๆ กัน</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8f9396231c941a5ac83e5b830cf8dcf/href">https://medium.com/media/e8f9396231c941a5ac83e5b830cf8dcf/href</a></iframe><p>จากโค้ดข้างบน เมื่อลองรันจะได้ผลลัพธ์ดังนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdQdFE3gfYbQ9sy4bGHBww.png" /></figure><p>จะเห็นว่าผลลัพธ์ไม่ได้น่าตกใจอะไร ทีนี้ลองดูโค้ดข้างล่างนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5398f311c823346e6835836aeaa4b2c7/href">https://medium.com/media/5398f311c823346e6835836aeaa4b2c7/href</a></iframe><p>ผลลัพธ์ที่ได้เมื่อรัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtCoMSSeApBA_vXQXgNKSQ.png" /></figure><p>อ้าว! ทำไม 3 ถึง log ก่อน 2 ล่ะ นั่นก็เพราะคำสั่ง setTimeout ทำให้คำสั่ง console.log(2) ถูกเรียกช้าไป 500 ms และด้วยธรรมชาติของ JavaScript มันจะรันคำสั่ง console.log(3) ก่อนโดยไม่รอ แล้วค่อยกลับไปเรียกคำสั่ง console.log(2) ทีหลัง</p><p>Feature นี้ของ JavaScript เป็นทั้งข้อดีและข้อเสียในเวลาเดียวกัน ข้อดีคือทำให้การทำงานด้าน frontend และอื่นๆ ที่ทำงานพร้อมกันได้ทำงานอย่างรวดเร็ว แต่ข้อเสียที่ใหญ่หลวงที่สุดคงจะเป็นตามตัวอย่างข้างล่าง</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/172b355bf66de77d730ee4da1d297692/href">https://medium.com/media/172b355bf66de77d730ee4da1d297692/href</a></iframe><p>ในที่นี้ฟังก์ชัน getUserName(id) ต้องการชื่อของ user ที่มี id ตามที่ระบุ ถ้าฟังก์ชัน getUserById(id) ใช้เวลานาน (ซึ่งส่วนใหญ่จะเป็นอย่างงั้น) ทำให้ฟังก์ชัน getUserName ข้ามไปทำคำสั่ง return ก่อน และทำให้ผลลัพธ์ที่ได้เป็น undefined เนื่องจากยังหา user ไม่ทันเจอก็ return ซะแล้ว…</p><p>สรุปคือ การทำงานแบบ Asynchronous มีปัญหากรณีที่เราต้องการผลลัพธ์จากโค้ดที่ใช้เวลานานไปใช้ต่อนั่นเอง</p><p>แล้วจะแก้ปัญหานี้ยังไง!! เราจะมาดูวิธีการแก้ปัญหานี้ไปพร้อมๆ กันเลย</p><p>(ปล. ความจริงแล้ว JavaScript รันแบบ Synchronous นั่นแหละ เพียงแต่ทำให้เหมือน Asynchronous ได้ อ่านเพิ่มเติมเวอร์ชั่นอังกฤษ<a href="https://medium.com/@kvosswinkel/is-javascript-synchronous-or-asynchronous-what-the-hell-is-a-promise-7aa9dd8f3bfb">ที่นี่</a>เลย)</p><h3>1. Callback function</h3><p>Callback คืออะไร? ถ้าพูดแบบง่ายๆ callback คือ function ที่จะถูกเรียกหลัง function อื่นทำงานเสร็จ ทำให้การทำงานเป็นแบบ synchronous นั่นเอง</p><p>หน้าตาของการใช้ callback จะเป็นประมาณนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b617bf8e7876c16000b729b407a37b08/href">https://medium.com/media/b617bf8e7876c16000b729b407a37b08/href</a></iframe><p>จากที่ตัวอย่างที่แล้ว getUserName จะไม่รอ getUserById แล้วทำคำสั่ง return เลย ตัวอย่างนี้เราเลยจับ return ใส่ใน callback ซะ เพื่อบอกว่าให้ทำ getUserById ก่อนนะแล้วค่อยเอาผลลัพธ์ไปทำต่อ (ในที่นี้ผลลัพธ์คือ user นั่นเอง)</p><p>เนื่องจากใน JavaScript จะมอง function เป็น object ด้วย ทำให้เราสามารถส่ง function เป็น parameter และ return กลับมาได้ด้วย ซึ่งจะเรียก function ที่ทำอย่างงั้นได้ว่า <strong><em>higher-order function</em></strong> นั่นเอง</p><p>และแน่นอน ถ้าใครรู้เรื่อง arrow function อยู่แล้ว callback เราก็สามารถเป็น arrow function ได้เลย</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dba21baf9a3f8fd62513d709341aed78/href">https://medium.com/media/dba21baf9a3f8fd62513d709341aed78/href</a></iframe><p>ที่สำคัญ callback ยังซ้อนกันได้ด้วยนะ!! แปลว่า ใน callback ก็มี callback อีกอันที่มี callback ที่มี callback ไปเรื่อยๆ ได้</p><p>สมมติว่าเราต้องการเลขประจำตัวนักเรียนจากชื่อ-นามสกุลเพื่อไปหาว่านักเรียนอยู่ห้องไหนและครูประจำชั้นเป็นใคร หน้าตาโค้ดก็จะประมาณนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/733e9b066a55941c0112ed4a6c04da38/href">https://medium.com/media/733e9b066a55941c0112ed4a6c04da38/href</a></iframe><p>อันนี้แค่น้ำจิ้มนะครับ ถ้ามันซ้อนกันมากกว่านี้ล่ะก็ รับรองนรกมาเยือนแน่นอน อาการป่วยแบบนี้เรียกว่า <strong><em>callback hell</em></strong> (ไม่ได้ล้อเล่นนะ เค้าเรียกกันอย่างงี้จริงๆ) ถ้าไม่รีบรักษาจะมีโรคแทรกซ้อนตามมาอีกหลายอย่าง เช่น</p><ul><li>โค้ดอ่านยาก ไม่รู้เรื่อง (ตัวอย่างนี้แค่สามชั้นก็ตายแล้วครับ)</li><li>การดักจับ error ทำยากมากๆๆๆๆๆๆ</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-OlfkC2Y1zg9m8S4rUlWQ.png" /><figcaption>สู่ความเวิ้งว้างอันไกลโพ้นนนนนนนน….</figcaption></figure><p>เพราะงั้น เลิกเหอะนะ การเขียนโค้ดแบบเนี่ย!!</p><p>แล้วจะทำไงล่ะ ไปดูกันต่อสิ…</p><h3>2. Promise</h3><p>เอาแบบง่ายๆ promise คือ object พิเศษที่เก็บ asynchronous operation บางอย่างที่<strong><em>เดี๋ยวจะทำเสร็จแน่ๆ นะ</em></strong> เปรียบเทียบกับสัญญาคลาสสิคในหนังอย่าง <em>“ถ้าสงครามนี้จบ ข้าจะกลับมาแต่งงานกับเจ้า !”</em> (Death flag ชัดๆ) ถ้าไม่มีสัญญานี้เจ้าสาวคงไม่รอแล้วไปแต่งกับคนอื่นชัวร์ แต่พอมีสัญญาแล้วก็แปลว่าเจ้าสาวจะรอเรากลับมาแน่นอน (ถึงแม้ส่วนใหญ่จะตายในสนามรบก็เหอะ…)</p><p>นอกเรื่องมาไกล ลองดูจากตัวอย่างที่แล้วดีกว่า</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/172b355bf66de77d730ee4da1d297692/href">https://medium.com/media/172b355bf66de77d730ee4da1d297692/href</a></iframe><p>จากตัวอย่างนี้ getUserById จะ return เป็น promise ที่เมื่อรันเสร็จแล้วจะได้ข้อมูล user มา ดังนั้น user ไม่ได้เก็บข้อมูล user อยู่ <strong>แต่เก็บ promise ของ </strong><strong>getUserById นั่นเอง</strong></p><p>ถ้าอยากได้ผลลัพธ์หลัง promise รันเสร็จจะทำยังไงล่ะ? ก็เรียกใช้ฟังก์ชัน then() ซะสิ!!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d675d5be35ad56af64fceaccaff59e11/href">https://medium.com/media/d675d5be35ad56af64fceaccaff59e11/href</a></iframe><p>แบบโค้ดนี้เลย สังเกตว่าฟังก์ชันใน .then() ก็คือ callback function นั่นแหละ แต่เราเอาออกมาเขียนข้างนอกฟังก์ชัน getUserById เพื่อให้อ่านง่าย</p><p>แน่นอนว่าเราสามารถ chain .then() ต่อๆ กันได้ แบบนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67d2a8d13424d82a3d24bcdeec57a022/href">https://medium.com/media/67d2a8d13424d82a3d24bcdeec57a022/href</a></iframe><p>จะเห็นว่าโค้ดอ่านง่ายขึ้นเยอะ เพราะโค้ดแยกฟังก์ชันชัดเจนมากขึ้น และการ catch error ก็จะง่ายขึ้นโดยใช้ .catch() แบบนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d4bba662909b24337388efe148fbb6c/href">https://medium.com/media/3d4bba662909b24337388efe148fbb6c/href</a></iframe><p>แต่!!! ฟังก์ชันไม่จำเป็นต้อง return promise เสมอไป เช่น getUserById อาจจะไม่ได้ return promise ก็ได้ เพราะงั้นถ้าจะใช้ท่านี้ก็ต้องทำให้ getUserById เป็น promise ซะก่อน</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59e810e79ba46518f9c7ddee336ecd26/href">https://medium.com/media/59e810e79ba46518f9c7ddee336ecd26/href</a></iframe><p>จากโค้ดข้างบนจะเห็นว่าการสร้าง promise ต้องใช้ฟังก์ชันสองตัว คือ resolve กับ reject โดย resolve เป็น callback เมื่อทำงานเสร็จ ส่วน reject คือ callback เมื่อเกิด error ขึ้น</p><p>ปัญหาของ promise คือ<strong>การดักจับ error</strong> จริงอยู่ที่เรามี .catch ไว้ดักจับ error อยู่แล้ว แต่เราไม่สามารถ .then ต่อจาก .catch ได้ ทำให้เวลามี error เข้า .catch จะไม่รู้เลยว่ามาจาก promise ตัวไหนใน chain</p><h3><strong>3. Async/Await</strong></h3><p>ฟีเจอร์ใหม่ใน ES2017 พระเอกขี่ม้าขาวที่จะทำให้โค้ด clean ขึ้นทันตาเห็น เพราะ async/await ทำให้เราเขียนโค้ดแบบ synchronous ได้เลย</p><p>วิธีการใช้ async ก็ง่ายมาก แค่นี้…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09608a4bf984170f833503ca92b68186/href">https://medium.com/media/09608a4bf984170f833503ca92b68186/href</a></iframe><p>ข้อที่ต้องจำไว้อย่างนึงคือ <strong>async function จะ return promise </strong>เสมอ ดังนั้นเราสามารถ getUserName().then() หรือ .catch() อย่างงี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2e20d0842cea48423c2d6ee0e99e7fa/href">https://medium.com/media/d2e20d0842cea48423c2d6ee0e99e7fa/href</a></iframe><p>แต่จะคูลให้สุดต้องใช้ await ด้วย ตามนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f76f87b981b3ce1bd832731187fb1c95/href">https://medium.com/media/f76f87b981b3ce1bd832731187fb1c95/href</a></iframe><p>await ใช้ได้ในเฉพาะ async function เท่านั้น โดยใส่ await หน้า async function เพื่อให้ฟังก์ชันหยุดการทำงานจนกว่า async function นั้นจะทำงานเสร็จ หรือพูดอีกแบบคือ await คือการสั่งให้ resolve promise ก่อนจะไปต่อนั่นเอง</p><p>การ handle error ก็ง่ายมาก ใช้วิธีคลาสสิคอย่าง try/catch ได้เลย</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcfa528a4f8a47d2aabc6232404a9bd2/href">https://medium.com/media/fcfa528a4f8a47d2aabc6232404a9bd2/href</a></iframe><p>อย่างที่เห็น ด้วยพลังแห่ง async/await โค้ดของเราจะดู clean และเขียนง่ายขึ้นมาทันที เหมือนกับที่เราเขียน synchronous code เลย</p><p>จริงๆ แล้วเรื่องนี้มีประเด็นที่น่าพูดถึงอีกมาก แต่อยากให้ลองไปศึกษากันเอง (จริงๆ คือขี้เกียจใส่มาเพราะมันเยอะ = =) เพราะเป็น concept ที่สำคัญมากเวลาทำงานกับ JavaScript และ TypeScript</p><p>สำหรับบทความนี้ก็จบเพียงเท่านี้นะครับ ใครมีข้อสงสัยสามารถถามใน comment ด้านล่างได้เลยนะครับ เจอกันบทความหน้าครับ (&gt; &lt;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5a842e59d9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thinc-org/callback-promise-async-await-%E0%B8%A7%E0%B8%B2%E0%B8%A2%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%A2-%E0%B9%81%E0%B8%AB%E0%B9%88%E0%B8%87-javascript-f5a842e59d9e">Callback, promise, async/await วายร้าย(?) แห่ง JavaScript</a> was originally published in <a href="https://medium.com/thinc-org">Thinc.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thinc. First Code Backend (Part I: Basic RESTful API)]]></title>
            <link>https://medium.com/thinc-org/thinc-first-code-backend-part-i-basic-restful-api-6c7eed0899a8?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c7eed0899a8</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Fri, 28 Sep 2018 15:17:42 GMT</pubDate>
            <atom:updated>2018-10-03T09:02:13.949Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IaJU6EFV_kTspVAuyBi-7g.jpeg" /></figure><p>In the present, websites and applications are essential to our daily lives, but how are those websites and apps created? If you don’t know, that’s perfect! We gonna talk about that in this blog.</p><h3>Overview</h3><p>Most of websites and apps contain two parts, <strong>Client-side </strong>(which is user interface)<strong> </strong>and <strong>Server-side </strong>(which controls scripts and data), or called <strong>Frontend</strong> and <strong>Backend</strong> respectively. As shown in the picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*sW6sVxsofFz84G86lf9CbQ.jpeg" /><figcaption>Overview of webs and apps architecture</figcaption></figure><p>Now it’s time to talk about server-side. It consists of <strong>Database</strong> and <strong>API</strong>. We might familiar with database, it is a place to keep the data (easy =v=), but what is API?</p><p>And that is what we gonna learn in this blog.</p><h3>What is API?</h3><p>API stands for Application Programming Interface, it is an intermediate layer between client-side and database to avoid direct connection to the database.</p><p>Imagine a web or app as a restaurant. What if there are only customers and cooks without waiters? How can customers order the food? One way to do that is walking to the kitchen to tell the cooks directly, but that sounds weird (really weird) because this can cause many problems, for example, the customers may steal some equipments from the kitchen. This can be messy!</p><p>However, if there are waiters, the problems are solved. Customers just order the food to the waiters and they will bring the order to the kitchen for you. Customers don’t need to know how the waiters tell the cooks, but they know that they will get the food.</p><p>In this scenario, customers are <strong>client-sides </strong>that want to connect to the kitchen, which is similar to <strong>database</strong>, by ordering to the waiters, which are <strong>APIs. </strong>You can see what will happen if client-side is directly connected to the database, right?</p><p>Note that APIs have many types, but the one we gonna talk about is called <strong>RESTful APIs</strong> (Don’t be sad if you don’t know what it is, you just need to know what it’s called).</p><h3>Implementation</h3><p>We just learn that APIs act as an interface for client-side to connect to the database, but how exactly do we implement them? Well, that’s surprisingly easy, because APIs are actually functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*nKzExlULPj8STKwGMnQ25g.jpeg" /><figcaption>APIs implementation (just normal functions…)</figcaption></figure><p>In the picture, we have four functions. All we need to do is implementing these functions, and now we are ready to use these APIs.</p><p>One more thing to do is to tell the client-side how to use them. In order to access these APIs, we need to tell them the <strong>routes or endpoints </strong>which usually look like URLs, as shown in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*JpmAHSYv--2VWYEmLjXxow.jpeg" /><figcaption>Routes or endpoints of APIs.</figcaption></figure><p>Now the APIS are completed. You can call these APIs by accessing the correspond routes. For example, if you want to use getUser function, you can access it via /api/user/get/:id where id is ID of the user you want. Some routes may require additional data, for instance, when you want to create new user, at least you need to send username, password, and other information of that user. In this case, you may send them with user.json file when calling /api/user/create. Note that the data required are implied in the parameters of functions.</p><h3>Conclusion</h3><p>Hopefully at this point, you have the concept of basic websites and applications architecture, especially server-side development, and how to implement APIs. In the next part, we gonna take you to the tour of backend development with a simple tutorial.</p><p>For further detail in Thai, please read from this article.</p><p><a href="https://nuuneoi.com/blog/blog.php?read_id=906">NuuNeoI - โครงสร้างพื้นฐาน(มาก)ของการติดต่อแอป ฯ กับ Database ฝั่ง Server สำหรับผู้เริ่มต้น</a></p><p>Finally, I hope everyone loves this blog, if you have any questions with regard to this topic, feel free to ask me in <a href="https://www.facebook.com/natchapolsrisang">Facebook</a> or in the comment below.</p><blockquote>Keep calm and stay coding!</blockquote><h3>Coming next…</h3><p><a href="https://medium.com/thinc-org/thinc-first-code-back-end-6f6abd1534f4">Thinc. First Code Backend (Part II: Express.js)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c7eed0899a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thinc-org/thinc-first-code-backend-part-i-basic-restful-api-6c7eed0899a8">Thinc. First Code Backend (Part I: Basic RESTful API)</a> was originally published in <a href="https://medium.com/thinc-org">Thinc.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Internship] When computer engineer student became intern 1st time.]]></title>
            <link>https://medium.com/donuts-bangkok-family/internship-when-computer-engineer-becomes-intern-1st-time-c0f39841bd01?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0f39841bd01</guid>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[review]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Tue, 31 Jul 2018 02:17:04 GMT</pubDate>
            <atom:updated>2018-08-01T06:04:05.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3QZOYAODO5xB5bgJ8DHyQ.jpeg" /></figure><p><a href="https://medium.com/donuts-bangkok-family/internship-%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B9%80%E0%B8%94%E0%B9%87%E0%B8%81%E0%B8%A7%E0%B8%B4%E0%B8%A8%E0%B8%A7%E0%B8%B0%E0%B8%84%E0%B8%AD%E0%B8%A1%E0%B8%9D%E0%B8%B6%E0%B8%81%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B9%81%E0%B8%A3%E0%B8%81-a368489a457e">[Internship] เมื่อเด็กวิศวะคอมฝึกงานครั้งแรก</a></p><p>Few months ago, while I was doing a project with my friend, there was a person contacted me in Facebook. She said she is from Donuts and saw my skill in SPOJ account (which surprised me how did she find it), so she offered me an internship. Since I was learning about web developing, I accepted the invitation. And so, the epic intern began…</p><h3>But before that…</h3><p>Of course, there was a test. The test was sent via email, consists of 5 problems which cover the data structures and algorithms topics. There are various kind of problems, from normal coding to debugging, with no feedback (similar to Codeforces contest). Since the problems resemble those in Olympaid camp (the difficulty is about 2nd POSN camp), it was not hard to get full marks. (In fact, I was worried a bit because it’d been a while since I practiced on those kinds of problems).</p><p>After finishing my test, she (the same person that contacted me) told me that her boss wanted to have lunch with me. At first, I was worried because I thought this would be an interview. However, it was more relaxed than I thought. We just had some talk about works and fields of interest, then I began my internship many months later.</p><h3>What did I do here?</h3><p>There are mainly 4 projects in Donuts BKK, including Sistacafe, Estopolis, Jobcan, and Vibie, and many positions for each project, such as front-end developer, back-end developer, UX/UI designer and much more. In the beginning I chose to work in Jobcan, but there was no jobs now. Therefore, I decided to work as back-end developer in Estopolis, which is about real estates marketing.</p><h3>It began since the first day…</h3><p>Not sure whether I was lucky or unlucky, because the first day I started my internship (1/7/2018) was the first day the office was relocated and we needed to set the new office, so it was quite chaotic. Also, the last day being an intern (31/7/2018) is the day we needed to deploy our new features.</p><p>The first impression is that the office was smaller than I thought (I just imagined a very big office before I came here), but I prefer this way because the less people, the merrier it would be (or not…?). Moreover, seniors are very friendly and easygoing, which is what I like.</p><h3>After that…</h3><p>I was quickly familiar with this company so that I forgot the pressure I felt on the first day. Thanks to the relaxing atmosphere.</p><p>On the second day there was already a task for me, and the complexity was increasing for every tasks. When I worked, I had to open the documentations and Stackoverflow (the god realm of all developers), and I think the most effective way to learn is to <strong>learn from seniors’ codes</strong>. This is an essential skill for every developers.</p><p>We had meetings about the project almost everyday. Some days I came to work just for meetings and not coding. I was flustered and stayed silent on the first few days, but then started to suggest more ideas over time.</p><h3>Impression in Donuts BKK</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10HnbFKJ_vEC11RioKCFbw.jpeg" /><figcaption>The front of the office (so many meeting rooms.)</figcaption></figure><h4>1. Very comfortable open workplace.</h4><p>Not too crowded and good air flow. Perfect for creative thinking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSAztah7y25Bp3AmRdcPfg.jpeg" /><figcaption>Snack corner is real! (It’s completely out of stock = =)</figcaption></figure><h4>2. Free drinks. Free snacks. Free kitchen.</h4><p>Not surprising if I gain weight after internship, because there is a snacks corner which is replenish every half month. Truly first come first serve.</p><h4>3. Seniors are very friendly and easygoing.</h4><p>As mentioned before, every seniors are willing to help me when I was in trouble. Sometimes with snacks (the root of abundance)</p><h4>4. Came as intern, work as staff.</h4><p>Although being an intern, team members regarded me as a real part-time/full-time employee, maybe because the company wasn’t that big. But of course, the tasks I got were minor tasks since I was in learning period.</p><h3>What about something I didn’t like?</h3><h4>1. The restroom</h4><p>Here was a new office, so new that the restroom wasn’t well-constructed yet…</p><h4>2. So many dusts!!</h4><p>Where did these dusts come from? (Breathing the fresh air, full of dusts.)</p><h4>3. The monitor</h4><p>The ancient monitor with distorted color. Might have some headache when reading codes from the screen.</p><h3>What I learned so far?</h3><p>Probably the most important topic, because they are the reasons I came here.</p><h4>1. Developer skills</h4><p>This one is pretty obvious, and the most technical stuffs. There were so much different between before &amp; after, including new frameworks and concepts which can be applied to other projects. Let me list them here so you can search for more information.</p><ul><li>What is MVC (<a href="http://www.tutorialsteacher.com/mvc/mvc-architecture"><em>http://www.tutorialsteacher.com/mvc/mvc-architecture</em></a>)</li><li>Laravel framework (<a href="https://laravel.com/"><em>https://laravel.com</em></a>). I mainly focus on <strong>Database</strong> and <strong>Eloquent ORM</strong> topics.</li><li>Database normalization (<a href="https://www.studytonight.com/dbms/database-normalization.php"><em>https://www.studytonight.com/dbms/database-normalization.php</em></a>). The most practical one is <strong>3NF.</strong></li><li>Writing API docs using Postman.</li></ul><p>Nevertheless, excellent frameworks and fabulous languages are nothing if you don’t understand the concepts and basics, which I experienced it myself. When I understood the core concepts, the following topics will be intuitive. So remember:</p><blockquote>Concepts are the foundation of everything.</blockquote><h4>2. Communication skills</h4><p>Achieved when reviewing codes with seniors. I had to explain why we developed this feature, what do these codes do, what are the potential bugs, is it support future growth, and more. It is crucial when working with team and working on large-scale project. Furthermore, this helps us identify points we don’t understand in short amount of time.</p><h4>3. We need to be thoughtful before doing something.</h4><p>If the new feature we are developing will not make much impact to users or customers, then it is not rational to waste resources to develop it, not only programs, but also marketing campaigns or new products. Therefore, we must consider from many perspectives and doing researches before deciding.</p><h4>4. There are many skillful people out there, go to find them!</h4><p>You can buy almost everything in the world, but not knowledge and experiences. The only way to obtain them is to really do it and find the person who did it before. Fortunately, here had many experienced people to give you some useful advises and exchange knowledge and experiences. (I was mostly a good listener because I didn’t know much about these stuffs.)</p><h4>5. BTS is so terrible, very terrible, extremely terrible.</h4><p>Not quite related to the job, but you will learn the hardship about going to work by BTS. It is unpredictable and crowded, especially in the morning.</p><p>And finally…</p><h4>6. Knowing strong points and weak points.</h4><p>This can help you decide your future plan, because by being an intern, you will find another you which you don’t know before.</p><p>To summarize, if you want to come out from your comfort zone, this is a very good place to start.</p><blockquote>Because experience is achieved by doing.</blockquote><h3>Bonus!! If you want an offer… (For computer Olympaid students)</h3><p>The reason I got an offer is because of many online judge websites (SPOJ for me). Therefore, <strong>practicing in various websites increases the chance for recruiters to discover you. </strong>As for Donuts BKK, there is no need to worry about the test, like I said before. You just need some basic knowledge about web developing.</p><p>Also, don’t forget to include your contact information, or else they cannot reach you.</p><p>For those who are interested in internship with Donuts BKK, follow <a href="http://donuts-bkk.com/jobs/">this link</a> for more information and register from the website or email: hr@donuts-bkk.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0f39841bd01" width="1" height="1" alt=""><hr><p><a href="https://medium.com/donuts-bangkok-family/internship-when-computer-engineer-becomes-intern-1st-time-c0f39841bd01">[Internship] When computer engineer student became intern 1st time.</a> was originally published in <a href="https://medium.com/donuts-bangkok-family">Donuts Bangkok Family</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Internship] เมื่อเด็กวิศวะคอมฝึกงานครั้งแรก]]></title>
            <link>https://medium.com/donuts-bangkok-family/internship-%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B9%80%E0%B8%94%E0%B9%87%E0%B8%81%E0%B8%A7%E0%B8%B4%E0%B8%A8%E0%B8%A7%E0%B8%B0%E0%B8%84%E0%B8%AD%E0%B8%A1%E0%B8%9D%E0%B8%B6%E0%B8%81%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B9%81%E0%B8%A3%E0%B8%81-a368489a457e?source=rss-e117676ac415------2</link>
            <guid isPermaLink="false">https://medium.com/p/a368489a457e</guid>
            <category><![CDATA[review]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[internships]]></category>
            <dc:creator><![CDATA[Natchapol Srisang]]></dc:creator>
            <pubDate>Thu, 26 Jul 2018 07:32:22 GMT</pubDate>
            <atom:updated>2020-08-04T06:31:03.490Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3QZOYAODO5xB5bgJ8DHyQ.jpeg" /></figure><p><a href="https://medium.com/donuts-bangkok-family/internship-when-computer-engineer-becomes-intern-1st-time-c0f39841bd01">[Internship] When computer engineer becomes intern 1st time.</a></p><p>ย้อนกลับไปหลายเดือนก่อน ขณะกำลังนั่งทำงานกับเพื่อนอยู่ จู่ๆ ก็มีคนติดต่อมาทาง Facebook บอกว่ามาจากบริษัท Donuts BKK เห็นฝีมือเราใน SPOJ (ซึ่งก็งงๆ ว่าเจอได้ไง) ก็เลยอยากให้มาลองฝึกงาน ด้วยความที่ตอนนั้นเพิ่งเริ่มมาจับงานด้าน Web development เลยรู้สึกว่าน่าจะดีถ้าได้มาฝึกงาน (บวกกับเพื่อนๆ และพี่ๆ โหดจัดกันมากเลยไม่อยากแพ้) ก็เลยตอบตกลง และแล้วมหากาพย์การฝึกงานก็เริ่มขึ้น…</p><p>อ่านต่อได้ที่นี่ครับ</p><p><a href="https://utopiabeam.dev/blog/internship-1st-time">เมื่อเด็กวิศวะคอมฝึกงานครั้งแรก | UtopiaBeam</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a368489a457e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/donuts-bangkok-family/internship-%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B9%80%E0%B8%94%E0%B9%87%E0%B8%81%E0%B8%A7%E0%B8%B4%E0%B8%A8%E0%B8%A7%E0%B8%B0%E0%B8%84%E0%B8%AD%E0%B8%A1%E0%B8%9D%E0%B8%B6%E0%B8%81%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B9%81%E0%B8%A3%E0%B8%81-a368489a457e">[Internship] เมื่อเด็กวิศวะคอมฝึกงานครั้งแรก</a> was originally published in <a href="https://medium.com/donuts-bangkok-family">Donuts Bangkok Family</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>