web analytics

The Famous Code Module!

DataFlow Applications in Composable provide infinite flexibility for users to compose almost any type of visual algorithm. The 100s of out-of-the-box Modules available in the Module Palette allow users to simply drag-and-drop the required Modules onto the cnavas to compose the desired process. While we strive to make our Modules as generic as possible, it’s impossible to know all the functionality someone is going to need. The beauty of Composable is that you can create a first class module, register it, and then proceed with creating your end-to-end DataFlow.

However, there are times when I’m in a pinch to get some job done, and I don’t feel like creating a first class module for some silly parsing that needs to happen. I also don’t want to clog up the Module Palette with domain specific or extremely data specific modules. Meet the Code Module!

The Code Module lets you write any code you want (well, there are some caveats). The module has several inputs including:

  • the code (duh!),
  • language,
  • class name in the code,
  • name of the method you want to call,
  • input parameters to the method.

The input parameters are a list, and are mapped to each parameter in your method signature.  So if you have 3 parameters, you should have 3 connections going into the parameters input.  The module also supports the “params” keyword in your method, allowing you to code for a dynamic number of inputs.

Any code is sand-boxed in an isolated application domain. So you can’t do things like try and list directories, write to files, or anything else naughty!

As a simple example, shown below is DataFlow with a Code Module that takes in 2 inputs (a string and an integer), and returns the concatenated string. The return value of the method is the result of the Module. If the method returns ‘void’, then the result is set to null.

Here’s the code used in the above example, for the Code parameter of the Code Module:

Composable offers multiple code modules for multiple languages, including C#, F#, VB, Python and R.