Chapter 5. The Business Rules Engine
The Challenge
Your business is now doing really well. In fact, you’ve now scaled to an organization with thousands of employees. This mean you’ve hired many people for different business functions: marketing, sales, operations, admin, accounting, and so on. You realize that all the business functions have requirements for creating rules that trigger actions depending on some conditions; for example, “notify sales team if prospect’s job title is ‘CEO’.” You could be asking your tech team to implement each new requirement with bespoke software, but your developers are quite busy working on other products. In order to encourage collaboration between the business team and the tech team, you’ve decided that you will develop a Business Rules Engine that will enable developers and the business team to write code together. This will allow you to increase productivity and reduce the time it takes to implement new rules because your business team will be able to contribute directly.
The Goal
In this chapter you’ll first learn about how to approach a new design problem using test-driven development. You will get an overview about a technique called mocking, which will help specify unit tests. You will then learn about a couple of modern features in Java: local variable type inference and switch expressions. Finally, you’ll learn how to develop a friendly API using the Builder pattern and the Interface Segregation Principle.
Note
If at any point you ...
Get Real-World Software Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.