Skip to content

Latest commit

 

History

History
107 lines (94 loc) · 5.56 KB

readme.md

File metadata and controls

107 lines (94 loc) · 5.56 KB

To The Future With cbFutures 🚀

by Luis Majano - Ortus Solutions

In this session we will explore the asynchronous and parallel programming constructs built into ColdBox. Java has supported a robust and functional approach to asynchronous programming since JDK8 and now it is available to us all in the Coldfusion (CFML) ⚡ World! To the future!

📅 Agenda

  • [] The NB (non-blocking) movement

    • [] Has made NodeJS shine, but other languages support this as well.
    • [] Movement to more async/parallel computations
    • [] Overall movement to computations
  • [] Lessons from Callbacks

    • [] Also refered to as Callback hell 🔥
    • [] Can make developers cry 😢
    • [] Never ending nesting collection of closures/functions 🕷️
    • [] Callbacks could be called multiple times by the other library.
    • [] Who has been there before? Don't lie! 🤥
  • [] Movement to promises

    • [] JavaScript has made this very popular
    • [] To get some sanity back into to development from call back hellfire 🔥
    • [] What is a promise?
    • [] Can have 3 different states:
      • Resolve : When completed
      • Reject : Error or something else
      • Pending : Not executing just yet
    • [] Cancel and Resolve them programmatically
    • [] Two channels of communication Promises Track
      • Data
      • Error
  • [] What about ColdFusion?

    • [] cfthread, right?? right? right? 🤔
      • [] Great BUUUUUUT for very very very very basic threading
      • [] Easy, but plagued with issues, which makes developers ALSO cry :😢
        • [] No way to choose where it runs (thread pool)
        • [] No concept of returning data, it's up to you to monitor/track data
        • [] Hard to manage them (cancel, monitor, pause), you are on your own buddy!
        • [] No functional approaches
        • [] Managing multiple threads and joining can be cumbersome and horrible
        • [] Example: Interceptor State Manager - Process Async All
    • [] Nothing existed until ACF2018/Lucee 5.3 => runAsync()
      • [] A step up, but not a big step
      • [] Still Many Issues:
        • [] Backed by a custom wrapper to java.util.concurrent.Future, jdk6
        • [] Simplistic error handler with no way to recover or continue executing pipelines after an exception. Concept of two tracks is broken!
        • [] No way to choose or reuse the executor to run the sub-sequent then() operations. Lucee actually creates a new singleThreadExecutor() for EVERY then() operation.
        • [] No way to operate on multiple futures at once
        • [] No way to combine/compose futures
        • [] Only works with closures, does not work on actually calling component methods
    • [] 🤢 We have two approaches to threading which are extremely simplistic and not powerful at all.
  • [] What about Java?

    • [] JDK 8 Introduced CompletableFutures, CompletionStages, Executors, Lambdas and much more.
    • [] 🦄 Java CompletableFutures are like JavaScript Promises, but you know Java devs, over complicate things, even names!
    • [] We have ported the majority of this functionality to CFML: ColdBox Futures
      • ColdBox, WireBox, CacheBox and LogBox
  • [] What is a ColdBox Future?

  • [] 🎩 Magical Pipelines

  • [] Working with multiple futures

  • [] Extra Credit: Schedule Tasks!