Skip to content
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

Refactor all fields such that the user need not call #validate explicitly #1

Open
haleyga opened this issue Aug 22, 2017 · 1 comment

Comments

@haleyga
Copy link
Owner

haleyga commented Aug 22, 2017

Currently, fields are constructed without throwing errors. The user calls #validate on each object and catches errors at validation time. Consider refactoring such that fields are validated on construction, and errors are thrown immediately rather than waiting for an explicit #validate call.

This would force users to handle construction-time throws, but I believe this is more intuitive than a silent #new followed by an explicit #validate call.

@haleyga
Copy link
Owner Author

haleyga commented Sep 8, 2017

I'm rethinking this approach. Considering the high-performance environment in which a FIX engine will likely be run (and given JavaScript's inherent performance shortcomings), try/catch blocks may impose an unnecessary overhead.

Perhaps a #validate pattern is preferred in such a situation. An explicit validation that simply returns a boolean should provide much better performance than try/catch blocks and throws (at the expense of the developer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant