3 ms·
Aristotle – Ruby business logic engine, inspired by Cucumber
- dchuk 12y agoSo this is basically a Natural Language state machine? Or am I missing the intent of this entirely?
- kyllo 12y agoInteresting application of the "rule of least power" to a Rails app. It kind of seems like code commenting on steroids--actually parsing the comments to execute the code that they describe. I'd be a little concerned about performance overhead for this--have you noticed any effect on the speed of your Rails app from using this? And if the goal is to provide business rules documentation for nontechnical users, why not just comment your code and make an RDoc? I'm not sure I fully understand what Aristotle buys you over this: #Move to 'to_do' if the last message changed and is unverified request.state = :to_do if request.last_message_id_changed? && request.state != :to_do && !request.last_message.try(:sent?)
- a-priori 12y agoIt buys you a higher level of abstraction. Now, abstractions have costs and benefits, so it's up to you whether it makes sense in any particular case. But that's what this tool buys you. In this case, its benefits are that the logic is stated in natural language, in domain terms, so it could be written and/or reviewed by domain experts or business analysts. It's basically a very simple business rule engine. It's similar in this way to Cucumber, except that this is specifying production logic instead of test cases. It's also just text so the logic could also be updated by users at run-time, making the system scriptable, if you need that kind of reconfigurability.
- kyllo 12y agoI can see the potential benefit in that, if there are specific types of business rules that really need to be configurable by the users. However I think that if overused, this not only makes your system slow due to excessive string-comparing, it also leads to a potentially awful antipattern that I'm all too familiar with from my own experiences in enterprise software dev. Add a few more features to this Aristotle language, and pretty soon you may have just invented yourself an ad-hoc, informally-specified, bug-ridden, slow implementation of a new programming language. http://thedailywtf.com/articles/The_Enterprise_Rules_Engine http://thedailywtf.com/articles/The_Enterprise_Rules_Engine http://en.wikipedia.org/wiki/Inner-platform_effect http://en.wikipedia.org/wiki/Inner-platform_effect http://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule http://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule If you really need configurable rules in a rails app though, I'd think it would be faster and more maintainable to just create a DSL within Ruby code rather than parsing a text file. Then you could use the if-this-then-that type business logic syntax but still have it be legal Ruby code and get all the tooling support that comes with it.
- mariusandra 12y ago1) As the app I'm writing is pretty low-traffic (few thousand pageviews per day) I haven't noticed any slowdowns. In fact, the first thing that came to mind after your question was this article: http://blog.codinghorror.com/the-sad-tragedy-of-micro-optimization-theater/ http://blog.codinghorror.com/the-sad-tragedy-of-micro-optimi... :) 2) Nontechnical users will never read RDoc type code. They want things in plain English in the admin area where they do their work. I'm not sure which RDoc integration would provide that.
- eabraham 12y agoInitially, I thought Cucumber was going to change testing because it would allow Business Analysts, Stakeholders and other interested non-technical individuals to read the tests. Experience taught me that these types of abstraction layers get relegated to lower skilled "programmers" because the non-technical individuals don't want to "write the business logic" because its still very code-like.
- mariusandra 12y agoWith aristotle this the programmer would still write the logic, the main benefit is that the stakeholder can see a real-time version of the logic in some admin interface.