Artwork

محتوای ارائه شده توسط Christoph Neumann and Nate Jones, Christoph Neumann, and Nate Jones. تمام محتوای پادکست شامل قسمت‌ها، گرافیک‌ها و توضیحات پادکست مستقیماً توسط Christoph Neumann and Nate Jones, Christoph Neumann, and Nate Jones یا شریک پلتفرم پادکست آن‌ها آپلود و ارائه می‌شوند. اگر فکر می‌کنید شخصی بدون اجازه شما از اثر دارای حق نسخه‌برداری شما استفاده می‌کند، می‌توانید روندی که در اینجا شرح داده شده است را دنبال کنید.https://fa.player.fm/legal
Player FM - برنامه پادکست
با برنامه Player FM !

Episode 004: Atomic Curls

22:40
 
اشتراک گذاری
 

Manage episode 221829039 series 2463849
محتوای ارائه شده توسط Christoph Neumann and Nate Jones, Christoph Neumann, and Nate Jones. تمام محتوای پادکست شامل قسمت‌ها، گرافیک‌ها و توضیحات پادکست مستقیماً توسط Christoph Neumann and Nate Jones, Christoph Neumann, and Nate Jones یا شریک پلتفرم پادکست آن‌ها آپلود و ارائه می‌شوند. اگر فکر می‌کنید شخصی بدون اجازه شما از اثر دارای حق نسخه‌برداری شما استفاده می‌کند، می‌توانید روندی که در اینجا شرح داده شده است را دنبال کنید.https://fa.player.fm/legal

Christoph tries to make tic-tac-toe work over the Internet and discovers the power of the atom.

  • Let's get a web framework, build a UI, hook that up to an HTTP API, throw in some websockets for notifications!
  • "We'd end up with our first 12 hour podcast episode."
  • A "tracer bullet": get something functioning to see the important parts of the solution.
  • Can choose when to replace important parts by something more "production worthy".
  • "Let's just ditch all the complexity of having a UI and just use curl."
  • curl will print the text response. We have a terminal UI!
  • "We're extending the command line out to the web!"
  • "I just keep curling every day or every other day until it's my turn."
  • "It's your morning curls!"
  • How do we handle web requests? What is a route?
  • Routes: /new, /show, /play?row=0&col=1
  • "Super simple URL API. Who needs REST?"
  • Let's run this on port 1337 to hide it from the Internet.
  • One shared game state stored in an atom. It's the only game in town!
  • Use an atom instead of a database to cut complexity while problem solving.
  • The ! ("bang") in swap! and reset! indicates you're causing a side effect.
  • Handler's sole job: take web requests and alter the game state using the game model.
  • Function called by swap! should be pure. Don't throw exceptions!
  • Dilemma: How much do you put inside the function called by "swap!"?
  • For errors, the transaction function can:
    • Return unchanged reference. Use "triage" function to diagnose.
    • Have an "error" attribute in the state and set an "outcome" code like :success,:invalid-coordinate, etc.
  • Tracer bullet shows lots of ways to complex-ify this into "Tic-Tac-Toe, Enterprise Edition"

Clojure in this episode:

  continue reading

118 قسمت

Artwork

Episode 004: Atomic Curls

Functional Design in Clojure

94 subscribers

published

iconاشتراک گذاری
 
Manage episode 221829039 series 2463849
محتوای ارائه شده توسط Christoph Neumann and Nate Jones, Christoph Neumann, and Nate Jones. تمام محتوای پادکست شامل قسمت‌ها، گرافیک‌ها و توضیحات پادکست مستقیماً توسط Christoph Neumann and Nate Jones, Christoph Neumann, and Nate Jones یا شریک پلتفرم پادکست آن‌ها آپلود و ارائه می‌شوند. اگر فکر می‌کنید شخصی بدون اجازه شما از اثر دارای حق نسخه‌برداری شما استفاده می‌کند، می‌توانید روندی که در اینجا شرح داده شده است را دنبال کنید.https://fa.player.fm/legal

Christoph tries to make tic-tac-toe work over the Internet and discovers the power of the atom.

  • Let's get a web framework, build a UI, hook that up to an HTTP API, throw in some websockets for notifications!
  • "We'd end up with our first 12 hour podcast episode."
  • A "tracer bullet": get something functioning to see the important parts of the solution.
  • Can choose when to replace important parts by something more "production worthy".
  • "Let's just ditch all the complexity of having a UI and just use curl."
  • curl will print the text response. We have a terminal UI!
  • "We're extending the command line out to the web!"
  • "I just keep curling every day or every other day until it's my turn."
  • "It's your morning curls!"
  • How do we handle web requests? What is a route?
  • Routes: /new, /show, /play?row=0&col=1
  • "Super simple URL API. Who needs REST?"
  • Let's run this on port 1337 to hide it from the Internet.
  • One shared game state stored in an atom. It's the only game in town!
  • Use an atom instead of a database to cut complexity while problem solving.
  • The ! ("bang") in swap! and reset! indicates you're causing a side effect.
  • Handler's sole job: take web requests and alter the game state using the game model.
  • Function called by swap! should be pure. Don't throw exceptions!
  • Dilemma: How much do you put inside the function called by "swap!"?
  • For errors, the transaction function can:
    • Return unchanged reference. Use "triage" function to diagnose.
    • Have an "error" attribute in the state and set an "outcome" code like :success,:invalid-coordinate, etc.
  • Tracer bullet shows lots of ways to complex-ify this into "Tic-Tac-Toe, Enterprise Edition"

Clojure in this episode:

  continue reading

118 قسمت

همه قسمت ها

×
 
Loading …

به Player FM خوش آمدید!

Player FM در سراسر وب را برای یافتن پادکست های با کیفیت اسکن می کند تا همین الان لذت ببرید. این بهترین برنامه ی پادکست است که در اندروید، آیفون و وب کار می کند. ثبت نام کنید تا اشتراک های شما در بین دستگاه های مختلف همگام سازی شود.

 

راهنمای مرجع سریع

در حین کاوش به این نمایش گوش دهید
پخش