New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored global functions into modules #5
Conversation
Hi, Roberto. Thanks for the pull request! First, let me point out that I wouldn't have known you're not a native speaker had you not said so. :) Secondly, thanks for taking the time to do all this. It's extremely flattering and I greatly appreciate it. Regarding the commit, I have mixed feelings. I like some of the ideas, but not all of them. What I like
What I don't like
PragmatismI may turn this into a blog post, but one thing I'm wrestling with is simplicity. Specifically, since camel (as checked in) is only ~650 lines, is it really worth splitting things up into segregated files? If so, how many? Or is it worth it to just keep things simple and easier to understand, by including them in one file (even if that requires ugly flower boxes)? :) I think, as with all things, the answer is in the middle, as I described above. I think the right answer is probably three files:
Sitting here now, that feels like the right amount of separation of concerns while still keeping things easy to understand. |
In several places persisted references to global symbols that have been now replaced. A weird thing about these bugs is that whenever they occur inside a promise nothing is raised, the control simply go back to the main run loop (this make debugging them very hard, there must be a way to let the exception be seen).
Hi Casey,
My take regarding this point is that splitting a 650 line files into meaningful Clearly I'm not advocating for splitting files for the sake of the split, nor Further refactoringsAs I mentioned in my first post, I think the new structure is a good start, but
Let me know if you feel the same. If you agree with me, I will try to help. IdiomsComing from a number of other languages I agree with you about the weirdness of New FeaturesThe current way of handling pages not found is quite crude (If I'm correct it is a JSON response saying that the page is not found). The project needs a better 404 handler. |
Hi Casey, If I'm not much mistaken, this would have several advantages:
How do you feel about it? If you feel you want to keep the things as they are let me know and I will stop stalking you. All the best. |
I know that you have been through an exciting time and I wish you all the best. I guess that you are not interested in the changes I proposed you so I'm closing this request. |
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:
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