Building a Rules Engine with PHP.
Swampy if-else logic for discounts getting out of hand? A simple rules engine separates rules from the data being checked - way easier to add new conditions without touching existing code.
5 posts found
Swampy if-else logic for discounts getting out of hand? A simple rules engine separates rules from the data being checked - way easier to add new conditions without touching existing code.
Solving fizz buzz without a mess of if-statements. The Chain of Responsibility pattern lets you chain handlers together so new ones slot in painlessly.
Had to send different XML files to a remote server and ended up with copy-paste classes everywhere. The Strategy pattern lets you swap out the "how" without touching the "what".
Standard auto-increment IDs won't cut it when you need unique numbers per customer. Here's how to roll your own sequence generator that plays nice with Doctrine and stays atomic.
Slow aggregation queries killing your app? Use SQL views as read-only Doctrine entities - the database does the heavy lifting so your app doesn't have to.