GET, POST, PUT and DELETE routes

In this tutorial we will create a Spring Server that will manage a Person repo and support PUT, POST, GET, and DELETE operations. The Spring framework allows us to quickly spin up a backend server for our application.

First let’s set up the basic Spring App, if you have Intellij, you can just select Spring boot and add the Spring Web and Spring devtools options. If you are just using Maven, here is what my POM dependencies look like.

POM File dependencies


Access private fields and invoke private classes with Reflect

What is Reflect?

Reflect is a little know java library that lets you edit fields and invoke methods of a given object of a class. Maybe you are thinking

“Whats so cool about that, I thought I could already call class methods and reference their variables?”

Well what if I told you that this library ALSO allowed you to access private fields and methods 😲!!!

Yes, it is true, you can access the private methods of a class OUTSIDE THAT CLASS!!! That is why I consider it black magic 🧙‍♂️.

photo by Joshua Newton on unspalsh

When would you use Reflect?

Ok but why would you want to use this? If you want to…


an example of the Singleton Pattern and why it is used

When to use the Singleton Pattern?

The Singleton Pattern is used when you only want one instance of an object at a time.

An example when this pattern is useful is for an access point to a database 💾. In an app, it is beneficial to have one entry point to the database as opposed to multiple entry points (like what would happen with a regular class with a constructor).


How to isolate components that rely on other services for testing purposes

By spyro on Pinterest

Testing is a very important part of coding, 📈 Test driven development is a very popular way of testing where you write test code before you actually write any ACTUAL code 😲.

A Test is supposed to ISOLATE one function of one service and make sure it works ✅. However, when this service depends on other services, it can be hard to isolate that one section and verify any error is coming from that service😞.

Here is an example of WHY we NEED to mock

  • Say we want to test service A which will transform a List of strings into…


An example for the Factory Design Pattern using a factory for animals

What is the Factory Pattern?

photo by Lenny Kuhne on unsplash

To understand what the factory pattern is and why it is useful, I will use a simile. Imagine you are a dealership and want to order some cars for your dealership. you have two options…

  1. Contact a different factory for each type of car you want to get (Audi, Ford, Honda, Ferrari etc…) and tell each one how many cars you want them to create.
  2. Contact a single factory but tell them what type of car you want as well as how many you want

The first option is akin to the old way of instantiating objects (i.e. a class…


The best practice for retrying service calls

Retrying is a Best Practice

You know that old saying

“If you fall of the horse, dust yourself off and get back on”

It actually has a lot of application when designing and writing software. Occasionally, there are processes or workflows that will fail. What would you do in these cases? Some programmers will simply say

“Not my fault, I called this service and it failed me so I am just going to give an error message to the user and have THEM restart the workflow”

This is undesirable, even if the service works 99% of the time — when it fails — it will…


How to make throttle conscious Service Calls

photo by Logan Weaver on unsplash

Why Should You Limit Your Application?

You might be looking at this and thinking

“Why should I limit my application’s performance? I want my application to load and perform as fast as possible so I shouldn’t limit my API calls”

Well, you’re right and you’re wrong

You shouldn’t arbitrarily limit your API calls that is true. However, sometimes — for large applications — it may be necessary to limit your API calls to avoid being throttled by the API.

Throttling as defined by Adobe as

a process that is used to control the usage of APIs by consumers during a given period. You can define throttling…


The right way to store and read objects as json with Jackson ObjectMapper

Jackson Object Mapper

Introducing, the black magic that is the objectMapper. This library is the go to, state of the art, hands down #1 place to go for translating Json to a java class and vis-versa.

Here is the link to the library if you want to dive deep in all the things you can do with ObjectMapper.

In this short tutorial, we will show how powerful the ObjectMapper is by serializing to and from a Classroom java object — which itself will contain a List of Person Objects — so there will be a decent level of complication since our Classroom is…


learn to create parallel async tasks

Why Do Work In Parallel?

In big 💪, fast 🏃‍♂️, and complicated ⁉️ codebases, there is a substantial amount of processing that needs to be done. Doing all of that processing synchronously (one after another) will increase the time 🕐 the code needs to execute.

A good way to get around this problem is to do some of these processes asynchronously when they do not depend on each other.

Best practice Involves using a Thread Pool and wrapping your tasks in a Runnable (does not return anything) or a Callable (does return something).

In this tutorial, we will see how we can speed up our…


A guide to reading restaurant (or any) JSON properly

by LogicBig

ObjectMapper Background

JSON is used in many applications to store and send data, the ability to parse and read this data is very important on your journey to becoming a skilled programmer. Before I knew about ObjectMapper, I would manually search for fields in a JSON by doing.

This is a gross and error prone way to get values from a JSON and when a senior dev on my team saw me doing this they showed me the light 🌤️. (The light being Jackson ObjectMapper)

Matthew MacFarquhar

I am a software engineer working for Amazon living in SF/NYC.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store