Re-Thinking the Visitor Pattern With Scala: Shapeless and Polymorphic Functions

Over the course of my career, a problem that I have had to face fairly repeatedly is dealing with a nested tree-like structure with arbitrary depth. From XML to directory structures to building data models, nested trees or documents are a common and pretty useful way to model data.

Early in my career (classic Java/J2EE/Spring days), I tackled them using the classic Visitor pattern from the Gang of Four and have probably had more than my fair share of implementing that pattern. Then, whilst working in Groovy, I re-imagined the pattern a little to make it a little more idiomatic (dealing with mostly Maps and Lists) and, now, I am working in Scala, and once again the problem has arisen.

How to Practically Implement Microservices Infrastructure in Your Business

Implementing Microservices infrastructure

The hyper-dynamic approach to business has led to the development of cloud computing in the form of IaaS, PaaS, and SaaS, with our current buzzword Microservices being aggressively sought for implementation. Notably, tech giants like Google, Walmart, and Amazon using it have grabbed the attention of the masses who look forward to revolutionizing their business processes with a modular approach.

You may also like: Deploying Your Microservices

JavaParser: Java Code Generation

In this article, I'm going to show you how to generate Java code using theJavaParser. I couldn't find much of the documentation available with regards to code generation in javaparser.org or the manual. So, I thought putting this out would help someone who would like to experiment with the Java parser.

In its simplest form, the JavaParser library allows you to interact with Java source code as a Java object representation in a Java environment. More formally, we refer to this object representation as an Abstract Syntax Tree (AST). Also, it has the ability to manipulate the underlying structure of the source code. This can then be written to a file, providing developers with the facility to build their own code generating software.