Block namespaces : Any preferred conventions

Hi all,
I’m finishing up two Cinder Blocks at the moment and want to publish them soon. I just have a question about how the blocks should be implemented namespace-wise. Up until now I’ve seen a couple ways of packing blocks in namespaces:

1- Blocks like Cinder-Http or Cinder-OpenCl which puts classes and folders in cinder::nameOfBlock namespace, like ci::http or ci::ocl .

2- Blocks like Cinder-UI or sharkbox-FullDome which uses the author’s name/alias as the namespace, like reza::ui or sb:: .

3- Blocks like Cinder-KCB2 which use the block’s name as namespaces, like Kinect2:: .

Judging by the fact that there are already different ways, I’d say there are no suggested conventions but I figured I’d ask once before getting into releasing Cinder Blocks, just to be sure. So please ignore this question if it’s lame or too specific:
Is there any convention which is preferred by Cinder’s community or makers when it comes to blocks and namespaces? I’m guessing since the blocks are intended to be used along with libcinder then putting them in cinder namespace makes sense (much like the first method) but then again I might be totally wrong, for instance if the makers believe that the cinder namespace should be used for blocks officially released by Cinder and for its core feutures.



I personally am not aware of any existing guidelines. They may have been discussed on the forums here, or among the core Cinder team, but I can’t remember I ever saw a definitive guide on the subject.

My two cents: using ci:: as part of your block’s namespace should probably be avoided. It could be that a block like Cinder-Http was intended to become part of an official Cinder release, or the author intended this, but then I still think it would be better not to use ci:: until it is part of Cinder.

A good rule of thumb might be to use a short, lowercase name. Your initials might be a good choice (unless your name is Colin Irwin), perhaps followed by a name for the block. My blocks often used ph::, but I haven’t been very consistent in using namespaces.


Something we’ve discussed s a guideline, probably a while ago now, is that things that aren’t included in the cinder repo itself shouldn’t use the cinder:: namespace. When / if they end up in cinder repo, the namespace would change. This includes things that ship as part of cinder but in the blocks folder - those things are essentially maintained in tandem with cinder but deemed as not necessary to bake into the library itself.

But then, this is a free world so people can do whatever they want. :slight_smile:

Thanks guys for the inputs. I totally agree with the idea that ci:: should be reserved for official releases and blocks in tandem with Cinder. I guess I’ll go with the route suggested by Paul, thankfully my alias doesn’t start with C and I :smile: