Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The secret life of rules in Software Engineering

2,250 views

Published on

Business rules do not get the attention they deserve in Software Engineering. They are mostly ignored in the specification phase and implemented in an adhoc manner in the target platform. We discuss why this is not going to work anymore

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

The secret life of rules in Software Engineering

  1. 1. The secret life of rules in Software Engineering Jordi Cabot @softmodeling – jordicabot.com June 2017
  2. 2. Disclaimer
  3. 3. “As a writer, my job is to change your perspective and make you think outside the box.” - Mary Sage Nguyen
  4. 4. Model-Driven Software Engineering: Preliminaries
  5. 5. • Grady Booch – history of softwre engineering The entire history of software engineering is that of the rise in levels of abstraction - Grady Booch Goal: Write less and less code
  6. 6. Everybody is doing it
  7. 7. MDE is just the logical next step
  8. 8. Model Rapid prototyping Static analysis Code generation Automated testing Refactoring/ Transformation Documentation [Illustration by Bernhard Rumpe] MDE = Models as key elements in all aspects of Software Engineering
  9. 9. The MDE equation Models + Transformations = Software
  10. 10. Original model 1st refinement nth refinement Model-to-model Transformation Model-to-text Transformation ... Requirements Use Case Class Diagram Java Project
  11. 11. What is a model 13 City of Nantes = “system” to be modeled A map is a model of this system Its legend is the grammar/ metamodel Different maps can focus on different “views” of the city
  12. 12. Not so different from languages MDE Grammarware MOF (metametamodel) UML (metamodel) ABank.uml EBNF.g Java.g MyProgram.java
  13. 13. MDE benefits +productivity +quality +Maintenance …. 2X – 8X 1.2X – 4X 80%
  14. 14. I’ll skip my over 500 “introductory” slides to MDE (but they are onine): http://mdse-book.com
  15. 15. 1: Rules in Software Engineering?
  16. 16. What is a business rule (for us)?
  17. 17. Definition  Business rule:  Statement that defines or constrains some aspects of the business  Applied on business terms  Independent from programming languages Defining Business Rules. "What Are They Really." The Business Rules Group, 2000, 1-77
  18. 18. Conceptual Schema Centric Development – Antoni Olivé It is both useful and necessary to integrate the business rules and conceptual modeling
  19. 19. Rule Modeling: UML+OCL
  20. 20. Some first examples
  21. 21. Why OCL (Object Constraint Language)? 23  No serious use of UML without OCL!!! (limited expressiveness of ALL (graphical) notations To learn OCL see http://modeling- languages.com/ocl-tutorial/
  22. 22. OCL: Basic Concepts • OCL is a rich language that offers predefined mechanisms for: – Retrieving the values of an object – Navigating through a set of related objects, – Iterating over collections of objects (e.g., forAll, exists, select) – Expressing conditions on those collections (sum, size,…) • OCL includes a predefined set of types + operations – Primitive types: Integer, Real, Boolean and String – Collection types: Set, Bag, OrderedSet and Sequence – 3 valued logic
  23. 23. OCL examples: Constraints context Quote inv OverZero: self.value > 0 context BlackListed inv NoRentalsForBlackListed: self.rental->forAll(r | r.startDate < self.blackListedDate)
  24. 24. OCL Example: Derivation Rules context Customer::discount: integer derive: if not self.premium then if self.rental.car.carGroup->select(c|c.category=’high’)- >size()>=5 then 15 else 0 endif else 30 endif
  25. 25. OCL Example: Contract context Rental::newRental(id:Integer, price:Real, startingDate:Date, endingDate:Date, customer:Customer, carRegNum:String) pre: customer.licenseExpDate>endingDate post: Rental.allInstances->one(r | r.oclIsNew() and r.oclIsTypeOf(Rental) and r.endingDate=endingDate and r.startingDate=startingDate and ….
  26. 26. Relationship of OCL with other rule-based languages? Very little research on this
  27. 27. Rule verification for MDE
  28. 28. 30 Original model 1st refinement nth refinement Model Transformation Model Transformation Source Code ... MDE-based software development process Errors in models breed and generate more errors in the code Why model verification
  29. 29. Person name: string children 2 * + rule : Nobody can be his own ancestor parent
  30. 30. …. .No finite (and non-empty) solution
  31. 31. Consistent? Proven? Formalism / Logics • Description Logics (DL) • High-Order Logics (HOL-OCL) • Deductive database queries (CQC) • SAT (Alloy + UML2Alloy), … Translate Prove Deduce UML model Class diagram + OCL constraints Typical solutions
  32. 32. MDE A Grand Challenge
  33. 33. Verification Automation Efficiency Expressiveness Precision(completeness) Pick only 2-3
  34. 34. Our pragmatic approach: Bounded verification 36 Solution? Constraint Satisfaction Problem 1. Variables – basic types + struct/list 2. Domains – finite 3. Constraints – Prolog 4. Property  Additional Constraint Translate Solve Deduce Property? + Model Constraints Cabot, Clarisó, Riera: On the verification of UML/OCL class diagrams using constraint programming. Journal of Systems and Software 93: 1-23
  35. 35. Resolution of the CSP Define cardinality variables Constraints on cardinalities Assign cardinalities Define attribute variables Constraints on attributes Assign attributes Proof
  36. 36. Rule implementation for MDE
  37. 37. Implementing OCL constraints Triggers in a database Views on a database If-then conditions in Java methods Cabot, Teniente: Incremental integrity checking of UML/OCL conceptual schemas. Journal of Systems and Software 82(9): Key point: Incremental checking
  38. 38. The BAD News
  39. 39. • Very few tools support it • Even less generate code from OCL Nobody uses OCL • No explicit rule engine component • Mixed with code • Adhoc approaches are used (errors, incomplete and inefficient) Rule implementation is left to programmers
  40. 40. It is both useful and necessary to integrate the business rules and conceptual modeling
  41. 41. 2: (Future) of Rules in SW Eng
  42. 42. Data-ism is the new religion
  43. 43. Big data is not schemaless. At most, we can say it is “less- schema” than other data
  44. 44. but we cannot count on the persistence mechanims to control the data
  45. 45. SW Eng needs to adapt - Rules as first class citizens - With an explicit representation and rule extraction mechanisms - Dedicated engines
  46. 46. Example: Citizen developers on Open Data
  47. 47. “the goal of the project is to make the promise of open data a reality by giving non-technical users tools they can use to find and compose the information they need”
  48. 48. Open Data for All
  49. 49. Web APIs as main citizen
  50. 50. Web APIs as main citizen
  51. 51. Web APIs as main citizen … a.k.a. JavaScript Object Notation… …a text-based open standard designed for human-readable data interchange… …derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects… JSON
  52. 52. Application Example S 1 S 2 ? S 1 S 2
  53. 53. Our approach Cánovas, Cabot: JSONDiscoverer: Visualizing the schema lurking behind JSONdocuments. Knowl.-Based Syst. 103: 52-55 (2016)
  54. 54. Many Challenges • On the data (scope) • On the quality of the data • On the precision of the discovery process • Propagation of uncertainty values Uncertainty • How to discover them • Optimal paths considering non-functional trade-offs (e.g. price vs quality) Non-functional properties
  55. 55. UML IFML GraphQL Schema
  56. 56. Cognification of rules
  57. 57. Cognification: The application of knowledge to boost the performance and impact of a process
  58. 58. During the industrial revolution, every machine got an electrified version The next revolution is the cognificatin of everything via cheap access to specialized AIs
  59. 59. Cognification ML Crowdsourcing Ontologies Big Data …
  60. 60. Cognifying Rules: 5 examples Rule Modeling bot as virtual assistant Rule inferencer to discover schema of unstructured data A code generator that mimicks a company programming style A real-time rule reviewer A morphing rule modeling tool that adapts to the user profile (language, input format…)
  61. 61. 3: We should do it together
  62. 62. We (RuleML and MoDELS conferences) seem to live in two parallel universes
  63. 63. Some sad stats (2009 – 2016) 0 2 4 6 8 10 12 RuleML Papers with UML or OCL in the title RuleML Papers with "Software" in the title Researchers publishing also at Models Valerio Cosentino et al: MetaScience: An Holistic Approach for Research Modeling. ER 2016
  64. 64. Let’s stop this madness of reinventing the wheel in each community
  65. 65. BUT NOT EASY - Publishing as a newcomer - Adapt vocabulary & style - Adapt technologies (API vs Semantic Web, DL vs OCL,…)
  66. 66. http://modeling-languages.com
  67. 67. Let’s work together jordi.cabot@ icrea.cat @softmodeling

×