javacodegeeks.com

Run you first gatling load test using scala

Gatling is a neat tool. You can create your load tests by just coding in scala. Jmeter allows you to do so through a plugin or beanshell but it is not as direct as the way gatling does so.I will start by adding the gatling plugin1addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")The next step is to changed the build.sbt01020304050607080910version := "0.1"scalaVersion := "2.12.8" enablePlugins(

javacodegeeks.com

A guide to the InfluxDBMapper and QueryBuilder for Java Part: Into and Order

Previously we used the group by statement extensively in order to execute complex aggregation queriesOn this tutorial we are going to have a look at ‘into’ statements and the ‘order by’ close.Apart from inserting or selecting data we might as well want to persist the results from one query into another table. The usages on something like this can vary. For example you might have a complex operation that

javacodegeeks.com

A guide to the InfluxDBMapper and QueryBuilder for Java Part: 3

Previously we executed some selection examples and aggregations against an InfluxDB database. In this tutorial we are going to check the group by functionality that the Query Builder provides to us with.Before you start you need to spin up an influxdb instance with the data needed.Supposing that we want to group by a single tag, we shall use the groupBy function.123Query query = select().mean("water_level").from(

javacodegeeks.com

Spin up an InfluxDB instance with docker for testing

It is a reality that we tend to make things harder than they might be when we try to use and connect various databases. Since docker came out things became a lot easier.Most databases like Mongodb, InfluxDB etc come with the binaries needed to spin up the database but also with the clients needed in order to connect. Actually it pretty much starts to become a standard.We will

javacodegeeks.com

Behavioural Design Patterns: Visitor

Our last pattern of the behavioural design patterns is going to be the visitor pattern.We use the visitor pattern when we want to make it possible to define a new operation for classes of an object structure without changing the classes.Imagine the scenario of a software that executes http requests to an api. Most http apis out there have certain limits and allow a specific number of requests

javacodegeeks.com

Upload and Download files to S3 using maven

Throughout the years I’ve seen many teams using maven in many different ways. Maven can be used for many ci/cd tasks instead of using extra pipeline code or it can be used to prepare the development environment before running some tests.Generally it is convenient tool, widely used among java teams and will continue so since there is a huge ecosystem around it.The CloudStorage Maven plugin helps

javacodegeeks.com

Behavioural Design Patterns: Template method

Previously we used the strategy pattern to in order to solve the problem of choosing various speeding algorithms based on the road type. The next behavioural design pattern we are going to use is the template method.By using the template method we define the skeleton of the algorithm and the implementation of certain steps is done by subclasses.Thus we have methods with concrete implementations, and methods without any

javacodegeeks.com

Behavioural Design Patterns: Strategy

Previously we used the state in order to add some functionality to an application based on the user state. Our next behavioural design pattern is Strategy. The strategy pattern enables us to select an algorithm at runtime. Based on the instructions our program will pick the most suitable algorithm instead of implementing an algorithm directly. This makes our codebase more flexible and keep it clean from any extra logic.Our

javacodegeeks.com

Behavioural Design patterns: State

The state pattern deals with altering an object’s behaviour when its state changes.Imagine the case of a class responsible for generating user interface based on the state. You got anonymous, logged-in and admin users.We shall create an interface called GreetingState which defines the action of drawing a html text with a welcome message to the user. There is going to be a different implementation according to the

javacodegeeks.com

Behavioural Design patterns: Observer

Observer is one of the most popular design patterns. It has been used a lot on many software use cases and thus many languages out there provide it as a part of their standard library.By using the observer pattern we can tackle the following challenges.Dependency with objects defined in a way that avoids tight couplingChanges on an object changes its dependent objectsAn object can notify all of its

javacodegeeks.com

Behavioural Design Patterns: Mediator

Previously we had a look at the iterator pattern.The mediator pattern is way different on what it tries to achieve. It is one of the behavioural patterns and its purpose is to alter the way objects communicate with each other. Instead of the objects communicating with each other directly the mediator will handle the objects interaction.For example imagine the scenario of a financial exchange. You do want to

javacodegeeks.com

Behavioural Design Patterns: Iterator

The iterator pattern is one of the most used patterns from the behavioural ones. Most of the times you use it without even noticing it. Supposing you have a container with elements and you want to traverse them. Iterating the elements might differ based on the container, retrieval method etc. By using the iterator pattern we can decouple the algorithms used by the containers, and the retrieval methods and abstract

javacodegeeks.com

Behavioural Design Patterns: Interpreter

Previously we had a look at the chain of responsibility and the command pattern. They do tackle different problems however they both delegate an action to another component, the command patterns always delegates the action, the chain of responsibility if the action cannot be handled it will be forward it to its successor.We are going to switch context and check the interpreter pattern. The interpreter pattern specifies how to

javacodegeeks.com

Behavioural Design Patterns: Command

Previously we used the Chain of Responsibility pattern in order to handle a complex problem with road incidents in a region, solving the problem in the first place or forwarding it to another incident handler.The command pattern is quite different to the cor pattern since it helps us in order to delegate an action/request to another object capable of executing it. Thus there is no direct execution whatsoever.

javacodegeeks.com

Behavioural Design Patterns: Chain of Responsibility

We had a look on creational design patterns and structural design patterns. On this blog we will focus on behavioural design patterns.From wikipediaBehavioural design patterns are design patterns that identify common communication patterns between objects and realise these patterns. By doing so, these patterns increase flexibility in carrying out this communication.Creational design patterns realise the creation of objects. Structural design patterns provide ways to realise relationships with objects.

javacodegeeks.com

Structural Design Patterns: Proxy Pattern

Previously we used the facade pattern in order to interact with a legacy application. Our next pattern would be the proxy pattern.The proxy pattern is used when we wantControl the access to an objectAdd extra functionality when accessing an object.One of the most common usages is when we want to monitor specific actions and add some metrics.For example we have a data upload service.package com.gkatzioura.

javacodegeeks.com

Structural Design Patterns: Facade Pattern

As developers most of the time we have to deal with complex systems, with many dependencies and even non existing documentation at all.In these situations finding a way to tackle those challenges is essential. The most common way to deal with it, is to hide all those dependencies and specify a front facing interface.The pattern to use in order to achieve is the facade pattern.Somehow you end

javacodegeeks.com

Structural Design Patterns: Decorator Pattern

Previously we altered the behaviour of our abstract objects using the bridge pattern and we implemented a tree like structure for our components using the composite pattern and delegating the requests.The decorator pattern allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.So imagine the scenario of applying various discounts to one of our

javacodegeeks.com

Structural Design Patterns: Composite Pattern

Previously we checked the adapter pattern the use cases and the bridge pattern. The pattern we will examine in this post is the composite pattern.By following the composite pattern we “compose” objects into tree structures representing part-whole hierarchies, therefore clients can treat individual objects and compositions uniformly.By referencing the word hierarchies the first thing that comes to mind is organisations. A military organisation is a great example for

javacodegeeks.com

Structural Design Patterns: Bridge Pattern

On the previous post we had a look at the adapter pattern. On this blog we are going to use the bridge pattern.As mentioned by GOF the bright pattern usage is to “decouple an abstraction from its implementation so that the two can vary independently”.How this translates to a software problem? Imagine that you need to implement software for missiles.You have Ballistic missiles, Cruise missiles, Rockets etc.

javacodegeeks.com

Structural Design Patterns: Adapter Pattern

On previous blog posts we focused on creational design patterns such as the builder pattern, the abstract factory/factory pattern, the singleton and the prototype pattern.We will switch our focus to the structural design patterns. By using structural design patterns our goal is to ease the design by identifying a simple way to realize relationships between entities.Adapter pattern is one of the most used and well known structural