IBMStreams / administration

Umbrella project for the IBMStreams organization. This project will be used for the management of the individual projects within the IBMStreams organization.
Other
19 stars 10 forks source link

Add a patterns repository #51

Closed ddebrunner closed 9 years ago

ddebrunner commented 9 years ago

Java primitive operators benefit from being able to use pattern classes that provide common functionality. Examples of these are provided by the Streams product, such as PollingTupleProducer and TupleInTupleOut. This repository would contain a Java project (not an SPL toolkit) with (typically abstract) classes providing additional patterns and common functionality. Eventually maybe the product patterns (which already provide the code) would move to this repoository. Users of Streams have found the existing patterns useful, allowing the Java developer to focus on the required logic, rather than boilerplate code.

An example is a Filter pattern that allow the ability to implement a Filter in Java just by implementing a single method: public boolean filter(Tuple tuple). The pattern classes provides the implementation of the process method, schema checking etc.

SPL toolkits that reused the patterns would typically take the pattern jar from the tool and included it in their toolkit.

The repository would be laid out to support patterns in additional languages, not just Java.

A set of initial contents, including Filter, Split, RegexFilter and RegexSplit is at:

https://github.com/ddebrunner/streamsx.patterns

leongor commented 9 years ago

Great idea! Can you add Cpp directory please?

hildrum commented 9 years ago

+1 on the patterns repository.

leongor commented 9 years ago

+1.

leongor commented 9 years ago

BTW, SPL patterns can be a good addition too.

ddebrunner commented 9 years ago

Yeah, had thought about SPL patterns, but wasn't sure what they would look like, so was planning to wait until something was contributed. Maybe SPL would be better in a separate toolkit, as any SPL artifact would be usable as a function, type or operator directly, whereas these patterns are really inputs to primitive operator development.

On the cpp, when a C++ pattern is contributed the cpp directory could be added.

hildrum commented 9 years ago

I don't know if SPL patterns belongs here--an SPL pattern is usually a toolkit or a sample, or a toolkit with a sample, and I think that might make more sense either under streamsx.samples or under its own repository.

I'm also not sure about the inclusion of cpp patterns. If you have something in mind, I think it'd be good to share it somewhere. However, you don't usually write a cpp operator by extending from another operator (and, in fact, I 'm not sure you can--I tried and gave up on the approach.) So a cpp operator pattern is probably going to be something you copy-and-modify, rather than extend-and-add.

With those considerations in mind, @ddebrunner, do you think streamsx.javapatterns would be a better name?

leongor commented 9 years ago

Ok, we have different "patterns" in mind :) I thought something like excerpts in Cpp/Java/SPL or even in Perl ready for copy/paste. Maybe we can define another repository for it?

chanskw commented 9 years ago
ddebrunner commented 9 years ago

I think this could be a patterns repository for primitive operators/functions, including c++.

There may be C++ reusable patterns, e.g. look at StateHandler added in Streams 3.2.2 beta, it would be interesting to include it and see how it evolves.

hildrum commented 9 years ago

I think for now it's best to have one patterns repository. We can split into two later, if it makes sense. FWIW, my source if I need to see examples of output functions, CPP schema checking, CPP windowing, etc is always the SPL standard toolkit.

petenicholls commented 9 years ago

Created streamsx.patterns and added @ddebrunner , @hildrum @chanskw @leongor as committers. Within this repository I suggest separating the language level (java, c++, spl). As things evolve there we can reorganize if needed. Closing this issue. Move future discussion to streamsx.patterns