Git Product home page Git Product logo

to-the-future-with-cbfutures's Introduction

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!

to-the-future-with-cbfutures's People

Contributors

lmajano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.