• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to implement a business logic in FP Java 8 ?

 
Jean-Pierre Delouche
Greenhorn
Posts: 2
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I would like to be able to read my code as easy as reading a book. To do so, I would like to create a meaningful Domain Specific Language that will manupulate my business entities. Is there some benefits from Java 8 that would help me ?
 
Pierre-Yves Saumont
Author
Ranch Hand
Posts: 96
17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jean-Pierre,

What could help you is Functional Programming, and Java 8 may help you to do Functional Programming (compared to previous versions of Java). Imperative programming is much about evaluating expressions and composing the results. On the other hand, Functional Programming is much more about composing unevaluated expressions, and eventually evaluating the final result. This is the same as creating a DSL. Writing a program in a DSL is composing DSL instructions to produce the program. Of course, when programming, you don't want to evaluate each instruction separately. You compose them in such a way that they will (hopefully) produce the right result when eventually evaluated. This is how input/output and applying effects works in Functional Programming. Instead of executing instructions producing effects, you compose these instructions without executing them, which is like building a program in you own language. This is what chapter 13 is about. There are also occasional examples in other chapters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!