cliss/camel — pull request #5 by boborbt (2014-05-10 14:00:43+00:00)
Title: Refactored global functions into modules

Hi Casey,
I'm a long time listener of the show and I got curious about your newly open sourced camel project.

I'm not a node expert (I started studying node only recently), but I thought that your code albeit not bad could use some refactoring. Here is what I've produced. As you will see I've moved all functions into separate modules and moved all global vars into several fields of the app object.

This is not perfect and some more work could be spent to improve several things, but I thought that you may prefer camel the old way and so I did not bother to do the work not knowing if you were interested.

Several advantages I find in the new version:
- more modular (of course ;-))
- smaller code units, improves readability (and you do not need the section dividers that John hates)
- easier to test (no test done right now)

I tested the engine with the sample post included in the project and it works. I highly suspect that something would break on a larger site, but I don't have one to test it. If you find any problem feel free to email me the whole thing (or just the files that make the thing to break) and I will fix it (most likely it only needs to refer the 'scoped' variables/functions instead of the global ones.

In no way this message is meant to make any offence or blame you or your code, if you find anything offensive please take into consideration that I'm not a native english speaker and so I may have misspoken.

Say hello to Marco and John, you guys are the best.

Roberto Esposito