, ,

There is much talk nowadays about Functional Programming, Domain-Driven Design and other concepts that aren’t so new as well. In this post I will give an overview of each of them.

Aspect-Oriented Programming (AOP)

AOP is a programming paradigm that enables the proper separation of responsibilities, considering features that are essential to a group of objects, but they are not their direct responsibility.

AOP allows, among other things, that you intercept a method and do something before, during and / or after the execution of the method. It is helpful to prevent the code repeat in various parts of the system.



AOP Examples of use: Log generation, access control and exception handling, transactions.

AOP Examples of tools: AspectJ and Spring AOP (Java), Aspect#, Aspect.NET and PostSharp (.NET)

Functional Programming

It’s a programming paradigm that treats computation as an evaluation of mathematical functions and avoids changing-state and mutable data, which are characteristic of imperative programming. It emphasizes the application of functions, in order to obtain the function value for a given set of parameters involves not only to apply the rules of that function, but also make use of other functions.

The main influence of functional programming is the lambda calculus, which is based on capturing the most basic aspects of how operators and functions can be combined to form other operators.




Functional Programming Examples of use: There’s not a specific area where the functional programming acts. Its use in most often involves a better expression, and the fact of maintaining immutable objects.

Functional Programming Examples of Tools¹: LambdaJ (Java)

¹ Functional programming is more related to programming languages that use this paradigm. Since Java 8 it is possible to use functional programming.

Functional Programming Examples of Programming Languages: Clojure, Scala, Erlang.

Reactive Programming

It’s a programming paradigm that involves working with asynchronous data flows. This paradigm is based on the real-time operation. A reactive system should be:

Elastic: Should react to demand/load.
Resilient: Should react to failures.
Message Driven: Should react to events (event driven).
Responsive: Should react to users.



SOURCE: https://github.com/ReactiveX/RxJava/wiki/How-To-Use-RxJava

Reactive Programming Examples of Use: Create highly available applications and low latency. Basically, real-time systems.

Reactive Programming Examples of Tools: Meteor and React (Javascript), Reactor, RxJava, Netty and Akka (Java), Reactive Extensions (.NET), Rx.rb (Ruby), Vert.x (Java, Ruby and other languages)

Domain-Driven Design (DDD)

It is a programming model focused on customer business area, on the domain. This means that developers have to know well the area involved so that programming can be done using the terms of the domain. This paradigm is called “Ubiquitous Language”, which makes both developers and customers speak the same language.




DDD Examples of Use: There’s not a specific area where the DDD may or may not be used. Its use, however, it is recommended due to a better expressiveness and understanding of engaged domain, which can easy maintenance.

DDD Examples of Tools¹: CargoTracker and Apache Isis (Java)

¹ The DDD is more associated with the form of programming than a tool, so it is not necessary a tool to use DDD (rarely a tool is used).

Behavior-Driven Design (BDD)

It’s an agile development technique focused on application behavior. This means that you can literally tell the code: given a context, when a condition, then do that.


The Test:


The Class:


SOURCE: https://blog.codecentric.de/en/2012/06/jbehave-configuration-tutorial/

BDD Examples Of Use: It is widely used to test, because it promotes collaboration between developers and non-technical staff, because it makes really easy to read tests.

BDD Examples Of Tools: JBehave and Concordion (Java), SpecFlow (.NET), Cucumber (Ruby, Java and other languages)