Skip to main content

4 posts tagged with "java"

View All Tags

Isolate services using the command pattern

· 5 min read
Saverio Ferrara
Software Engineer

Using microservices is mainstream nowadays and them bring several challenges for the software engineers: operations and infrastructure, security, monitoring, caching, fault-tolerance, and so on.
In particular, having under control the communication between microservices is the key to build reliable reliable services.

In the Java world there are around several solutions for this purpose but, in this post, I'd like to analyze how Hystrix leverage the "command pattern" to accomplish this goal.

Building web applications with Scala

· 10 min read
Saverio Ferrara
Software Engineer

Scala is general purpose programming language very popular for building web application. But why? At the moment I really don't know why :) , I'm just reading about it and sharing my thoughts with you.

Let's start from Scala. It's a programming language both object-oriented and functional: we can refer to this kind of programming language as "object-functional". We say that is a programming language because there is a compiler for it, but also an interpreter is available.

It is intended to be compiled to Java bytecode, so the resulting executable runs on the JVM, and Java libraries can be used directly in Scala code and vice-versa. Maybe this is the real strength of this language... it allows to write brand-new web application while reusing legacy java libraries. That's awesome for a company with a bunch of old java code.

Java implementation of the Ackermann function

· 2 min read
Saverio Ferrara
Software Engineer

Wilhelm Friedrich Ackermann (29/3/1896 – 24/12/1962) was a German mathematician best known for the Ackermann function, an important example in the theory of computation.

La funzione di Ackermann è una funzione f(x,y,z) che ha come dominio l'insieme delle terne di numeri naturali e come codominio i numeri naturali.

Essa è un esempio di funzione ricorsiva che non è primitiva ricorsiva poiché cresce più velocemente di qualsiasi funzione ricorsiva primitiva.

XQuery queries in Java

· 3 min read
Saverio Ferrara
Software Engineer

XQuery, una abbrevazione per XML Query Language, è un linguaggio di programmazione specificato dal W3C e destinato ad interrogare documenti e basi di dati XML. Questo perché XML si sta proponendo come la tecnologia per rimpiazzare i vecchi DBMS relazionali :-)

Il w3c ha definito il linguaggio XQuery 1.0; usa la sintassi delle espressioni di XPath  2.0, con l'aggiunta delle cosiddette espressioni FLWOR per la formulazione di query complesse. Il risultato è un linguaggio di programmazione funzionale, dichiarativo, con somiglianze con il vecchio SQL.

Per effettuare delle query xquery su un file XML possiamo usare delle librerie come BaseX e Saxon. Purtroppo attualmente Saxon non è un prodotto del tutto gratuito, quindi scegliamo di usare BaseX, un processore Xquery-XPath open source.