I want to implement Rule Engine on my Rails 3.2 application which has a complex pricing logic,I want to transform the conditions in pricing logic to rules, and use them.I am creating an entirely new application for this purpose.
I googled alot in this regard and found rules_engine, ruleby, treetop, but the documentation they provided was not just sufficient, I struggled a lot in deciding the best one suitable for my requirement.
What's the best approach to start development on rule engine?
I've been looking for a prolog-like system to implement rules myself. Here's what I found so far.
This library contains a rule engine written in Ruby. It's based on the
Rete algorithm and uses a DSL to express rules in a readable way.
https://github.com/ulfurinn/wongi-engine
Related
I am planning to start a new complex project with ruby on rails, and I am currently thinking of which frontend-framework to use. I have never used one before.
Reading the docs, batman.js becomes really interesting. I would love to do things like "#post.comments" on the client side to get all comments for a given post - with nearly zero configuration. I am afraid of duplicated code if using a mvc-framework in the frontend and guess batman.js will reduce it. But in comparison to angular, batman does not gain from much support in the community (see Google Trends for example).
So my question is, is it possible to have the benefits of a batman.js-app in an angular-application with a little configuration? Do you have any good links for a good rails-integration?
I guess this is relevant to the batman.js side. We have a couple Rails + batman.js apps in production already and we'll be launching another one soon. Here are the advantages and disadvantages we've found:
Advantages:
Ruby & Rails-inspired syntax & architecture (eg, model associations, naming conventions, routing)
Easily integrates with Rails (batman-rails gem, JSON REST communication, CoffeeScript, Slim templates)
Easy to implement real-time updates (we're using Pusher)
Disadvantages:
Low "googleability". Not as widely used as Ember, Angular, Backbone etc.
Underdocumented. All our developers dive into the source from time to time.
For my part, I'm enjoying batman.js a lot and I'm trying to make up for the shortcomings by adding to documentation and being active on IRC, github and the google group. Good luck in your decision!
In framework-like ruby projects, how is it possible to package a plugins as gems and then use\unuse them inside the project, Most popular living example is Rails, but I seeking the abstracted concepts\practices\design patterns that can aid in building such project architecture.
Rails sourcecode is TOO big to navigate without a map.
Research Log:
- In Rails, Railities are assumed to be a good place to start exploring how plugin architecture is implemented.
- In Ruby 1.8, there was a C extension called mixology that provides mix\unmix constructs.
- In Ruby 1.9.*, It is believed that Rails used alias_method_chain
- In Ruby 2.0 prepend keyword is meant to be useful in solving such problem (I assume!)
One of the best introductions into topic I have seen so far was a Railscast where Ryan extracts some piece of his app into a gem:
http://railscasts.com/episodes/301-extracting-a-ruby-gem
Generally there are few rules to follow to make Your code easy extractable:
Extract common logic to modules or even better separate service objects
Following SOLID principles will make Your units lean and isolated as much as possible
ALWAYS namespace Your concerns, service objects, libraries etc
Test those units completely isolated, don't rely on details like database
(Controversial) Do dependency injections, You won't regret this when testing and simply when designing APIs between Your objects
Avoid using Rails helpers as much as possible if You intend Your code to be reusable outside a Rails context
I hope these suggestions will put You on Your own Rails :)
Okay. I'm NOT asking which one is better. I know Yii is not better than Symfony, Symfony is not better then Yii.
I'm asking which one should i go with it.
I want to give some points:
I have a large project which is very-well formatted and very-well coded. If you seen my codes you would think that i made my own framework but its not. It just that very-well coded. I'm using custom made Controllers for HTTP requests.
All i want to do is make my code much more easier to use and much more easier to understand and easier to edit. Component by component editing and extending.
I'm also using Zend Framework as a component but not framework base.
So, as you developers, which project framework for base coding do i really go with it. Yii or Symfony?
I actually loved Yii but Symfony's Bundle systemn and Namespaces are attract me. But i really wonder which one should i go.
As i said, im not asking which one is better. I want to get your throughts regarding to this issue.
I'm open for suggestions. Give me a path.
Yii is probably the truest 'framework' of all the options - it provides the scaffolding you need with almost no assumptions about how you would prefer to implement anything (except perhaps the inclusion of jQuery). It is incredibly fast to develop with, and very very fast to execute which translates to excellent scalability.
Projects I have used Yii for have always ended up well ahead of schedule - Yii just seems to make sense in the way it works. My experience with Symfony is limited, I will admit, but compared to Zend Yii is a breeze. The Gii MVC generator is a fantastic head start too, generating models and basic CRUD code from your database tables.
ALl this is just my opinion from my own experience, but that is what you asked for :)
I think what you search is to see what is the recommendations more than any Evangelism.
Just to give some pointers about what is the current state of PHP, and nice components that is using the latest php features.
Requirements
Make sure what you use has, a way to...:
send to the log (Monolog is a good one)
parse text only config (YAML is a good one)
logic-less templating, with some convention (Mustach, Twig)
dependencies definition manifests (Composer is the way to go, very similar to package.json that Node offers)
define common "service" instantiation mechanism (DependencyInjection is one example)
abstracted way to load libraries (ClassLoader component is a good one)
Localization management (see Symfony2/Twig documentation )
abstract database calls without hardcoding database vendor specific (Doctrine2, Propel)
Unit testing structure, usage and conventions (PHP Unit, Behat, Mink)
Database code doesn't use "mysql" and istead uses mysqli
And all of that distinct functionality packages that you can mix and match.
Mix and match
There is some efforts underway that address this exact issue, here some interresting ones:
The PHP Framework Interop Group is a consortium of contributors representing frameworks and they created some standards, namely the three layers known as PSR-0, PSR-1 and PSR-2
PHP The Right Way is a collaborative work on what is the current best practices.
Tobias Schlitt's definition of a framework
Hope this helps you. with your own choice of which framework to invest on.
Since you already use Zend, why not using it as a framework ??
And there is no anwser to your question, it depends on project needs...
Symfony should be use on 'big' projects with fast servers.
Yii is still a 'light' framework, but is very fast compared to Symfony, and has a short learning curve...
...etc
I am a somewhat experienced rubyist, but I am now starting to do rails development. I know rails is used to make "web applications" but what exactly does that mean? Do you build entire sites with rails or do you build a feature for a website in rails, and integrate it in to an existing website? (I know this question is kind of vague, but any answers to how ROR is used in the creation of websites would be much appreciated).
Generally speaking, you will build a full site with Rails, though you can integrate it into an existing website, as well. It is designed to provide a top-to-bottom solution for entire websites.
For standalone features or small scripts you just want to expose to the web, you might look at something like Sinatra or Camping.
What is Ruby on Rails?
I'm also build some rails applications in that I had entirely use rails to develop my web application. It's quite easy rather than using two or three languages. But when I developed I had to use Javascripts, CSS and Ajax to create more attractively
For me it's a great framework to build website and minimal knowledge is required although experience and knowledge of ruby gives you an upper hand.
I also feel that rails is good not only to build websites but to manage it.
Also the support community of rails is awesome and is complemented by guys like Ryan bates with their screen casts.
Also when we build a website using ror, we have the flexibility to concentrate on different features at different times or by different person.
This gets a great modular structure.
So you can design the basic functionality today and tell your colleague to get the views attractive using JS and friends without affecting your functionality.
Also the external support for rails (like gems and plug ins) is awesome and makes life heaven!
I would suggest that it's a great framework and the best feature is that it is a very easy to begin and learn but it always surprises you with new things.
Thus it allows you to learn a lot!
Hope it helps.
The website/web application distinction is made because there are many Rails apps in existence with no front end or 'website' to speak of. Using Rails, one could serve JSON amongst a cluster of compute nodes for data aggregation, or text to unix sockets for display on terminals. The uses for Rails are only limited by ones imagination, and you could even use Rails for single host interprocess communication if you desired. This might prove effective for a highly skilled rails programmer rather than learn a new tool to achieve similar results.
Django as a framework is a neat little package. There are very few files (compared to Rails) and it's got a clean structure. The fact that you can plug and unplug apps between different projects is an extremely nifty feature. At the same time, Ruby's hacking ability is unparalleled. It's complete object-orientedness makes it more expressive and fun.
To cut the story short, is there a Django-like or Django inspired framework on Ruby?
If not, would be possible for an implementation of Django on Ruby? What would be the challenges?
If one were to create a Django-inspired framework for Ruby, how would it's Domain Specific Language (DSL) nature come into play?
I've spent a good chunk of my past life using Symfony, which is a PHP framework heavily inspired from Rails. When I saw Django, it came as a bout of fresh air. I'm really curious to know what you guys think and have to say on this.
Update: I stumbled on a framework call Ramaze for Ruby. It seems to be a bare-bones MVC framework with pluggable components for the JS framework, ORM layer and the templating engine. So you could use Prototype / Sequel / Sass, or Mootools / ActiveRecord / XSLT, or any other combination of your choice! As a side-note, Merb is an interesting choice too.
Update 2: I'm sticking to PHP for big-ass commercial projects and Django for my personal projects. Reason why I decided to side with Django was the amount of flexibility it offered. That said, I realized that with greater power comes greater responsibility.
My advice to others: if you know exactly what you want - go with Django. It's probably easier to define things explicitly in it than in Rails. Merb may have been a good choice too, but I didn't have the time to explore it. Django seemed like a good fit and so I stopped being anal about the language I'm using. Thanks for all the help guys!
Try merb, merb-slices, and datamapper is probably the closest you can get in ruby.
I think you need to define a little closer what you mean by "Django-like". Depending on your exact definition, any of these might fit the bill:
Ruby on Rails
Mack
Waves
Merb
Iowa
Is having less files really a deciding factor on choosing a framework?
I agree that keeping track of a smaller number of files is easier on the brain, but I would choose a framework on:
documentation
size of community
maturity
before I woried about file count.