The Dependency Inversion Principle

The dependency inversion principle(known as DIP from here on out) is one of the core tenants of the S.O.L.I.D principles and probably my favorite. This principle underlies so many of the design patterns we see in software and system design and as a result if you understand it then you begin to see systems all

Private/Public Key Cryptography

Lets dive into private/public key cryptography today. This is a simple concept that can seem a lot more complex than itreally is. 1. Symmetric cryptography This is the most simple form of cryptography to grasp. In this case we have one private key and it is shared by the server and the client. Lets say

two’s complement

I thought I’d do a quick write up on how to convert positive number to negative in two’s complement. This topic because it’s really simple and some sources make it more complicated that it should be. As you know, two’s complement is by far the most widely used binary scheme used by computers today. Its

Find the first occurrence of a number using binary search

In this post we will take a look at a small modification to binary search. Instead of looking for the location of a specific target we will now try to find the first occurrence of that target. For example if we have an array like below [crayon-5e245e8ea0112506119874/] and our target is 2 then out our

Binary Search

Welcome to the binary search series! In this series of post we will focus on implementing binary search for coding interviews and some of the common pitfalls that come along. We will start with the most basic implementation of binary search first. Before we start coding a solution we want to make that we are

How do software version numbers work?

OVERVIEW Software Version numbers are everywhere when we deal with software so its worth it to take a little time to understand their semantics when we start out. Lets take a look at two simple version numbers.   EXAMPLES 1.2.3 1.2.18   HOW TO READ VERSION NUMBERS Intuitively you might think that 1.2.3 is a

Compile a local jar file with Gradle

In this tutorial we will compile a local jar file with Gradle into our java project. Technologies used: gradle 2.14.1 Java SE 1.8 For this tutorial you can go clone the repo from github and just delete the build.gradle file from the project and build it from scratch along with me. Step 1: Take a look

Where is gradle installed on my mac

Finding out where certain tools and programs were installed on my mac caused me quite a bit of frustration in my early days of programming. We can usually trust tools like homebrew and others to do things the right way but its always good to know at least where they are putting the software they

Building Java projects from the CLI – Part 3

In the final part of this tutorial we will add a third party jar to the classpath and use it in our main method. STEP 1: Create a lib directory at the root of our previous project. This is where third party libraries conventionally go in java projects so we will place our JAR here.

Building Java projects from the CLI – Part 2

In this posts we will use the java cli with multiple packages. This takes a few more steps than the previous posts but its not hard to do either. We will use the same project as in the previous posts. Our project directory will now look like below to include our new utility package and