function currying

Post on 19-Jan-2015

2.382 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Understanding and using Function Currying for AS3 and javascript developers.

TRANSCRIPT

Understanding

Function CurryingJavascript / AS3

Thomas BurlesonDigital Solutions Architect

Sunday, April 29, 12

Anonymous Functions

Function CurryingClosures

Partial Applications

Sunday, April 29, 12

Combine function with variables to create new function.

Function Currying:

Variables are cached [captured] as function argumentsOuter variables are accessed via closure scope by inner Function

Sunday, April 29, 12

Explore existing Javascript code

Function Currying But how/why do we use

Refactor code (to remove verbosity)

Apply DRY concept

Concise Code, Easy Maintenance

Sunday, April 29, 12

Anonymous Functions

Function Currying

Closures

Existing Code

Refactoring with DRY

Sunday, April 29, 12

REST Service (asynchronous)

Sunday, April 29, 12

Not DRY Verbose!Difficult to maintain

Sunday, April 29, 12

Uses 'function currying'at two (2) levels :

onSuccess()

forClass()

Sunday, April 29, 12

top related