July 2nd, 2018

Groovy Basics Part I: Concise Syntax



Java 8

Starting this summer I'll be picking a programming language to look at in-depth every season. The language may be one I want more knowledge on or it may be a completely new language I've never explored. For this summer, the language of choice is Groovy. Groovy is a programming language run on the JVM that can be used alongside Java code1. It supports static and dynamic typing, along with a host of features in hopes to shorten the verbose Java syntax. Groovy is used in a number of different projects such as Grails, Gradle, and Jenkins.

One of the main reasons I want to look at Groovy is my work on a project involving Jenkins at work. I also always had an interest in the language as an alternative to Java. This post looks at some basic features of Groovy that caught my eye after an hour or two of exploring. This post and Part II serve as my first impressions of Groovy. After these two posts I'll dig deeper into Groovy features and use it in Jenkins programs. Now its time to start exploring!


August 27th, 2018

Currying Groovy Closures



+3 More

Something I'm really interested in is incorporating functional programming practices into my code. Despite not working in any purely functional languages (although I am starting to look at Haskell), most imperative and object oriented languages support certain functional operations. In my recent exploration of Groovy, I noticed that closures support the currying technique. Currying in Groovy takes an existing function and creates a new specialized variant. This post explains how to use currying to enhance Groovy closures.

My exploration of Groovy wasn't the first time I crossed paths with currying. Currying was mentioned in my readings on Java 8 along with my brief research so far of Haskell (a functional programming language). Currying is named after Haskell Curry, an American mathematician (the Haskell language is also named after Curry)1,2. The goal of currying in Groovy is to make specialized versions of a function. To accomplish this, pieces of a function are put into a fixed state prior to invocation.


September 14th, 2018

Groovy's Dynamic Language Features



Dynamic Programming

In the past, I always associated dynamic programming languages to those with dynamic typing. In my discovery post on Groovy's type system I learned that dynamic typing and dynamic programming are two completely different concepts. Dynamic typing specifies a language that enforces types at runtime. Dynamic programming languages allow attributes of a program to change at runtime that are typically kept static. This post is my introduction to the features of a dynamic programming language and their use cases in Groovy applications.

Groovy builds upon Java which is statically typed and does not have dynamic language features. While Groovy does use Java's type system, it enforces types at runtime only, making Groovy dynamically typed. Groovy also has dynamic language capabilities that Java does not.


July 4th, 2018

Groovy Basics Part II: Object Oriented Features



This is the second post in my introduction to the Groovy programming language. I'm looking at the basic features I find interesting before diving into more complex topics. To learn about some basic Groovy operators check out part I.

This discovery post explores Groovy's object oriented features. As far as existing object oriented libraries are concerned, Groovy extends the Java object libraries in what is commonly referred to as the GDK (Groovy Development Kit)1. For example, the GDK gives more methods to the collections framework, specifically the Collection interface. All collections can use the GDK's each() method to iterate over their contents with a Groovy closure. I utilize some of the GDK enhancements in this post.


August 16th, 2018

Groovy Closures vs. Lambda & Arrow Functions



+4 More

The thing that really intrigued me during my Groovy first impressions posts were closures. Closures are Groovy objects with similarities to Java lambda functions and JavaScript arrow functions (among others). While enclosed in an object, closures behave like a method which can be invoked and passed arguments. Closures can also be assigned to variables and passed as arguments (they are objects after all). In this post I will look at the basic behavior of closures and compare them to similar constructs in other languages (Java, JavaScript, & Swift).

Speaking about closures often causes confusion since its definition varies across languages. For example, in JavaScript a closure describes the ability of a function to remember its lexical scope (the scope in which it was defined in code) even when it’s invoked outside its lexical scope. JavaScript’s closure definition is different than Groovy’s, although in Groovy closures remember their lexical scope as well1. To reduce confusion birthday context is the Groovy idiom for a JavaScript closure.


July 15th, 2018

Optional Typing in Groovy


Type Systems


While reading a book on Groovy recently I came across two different definitions that apply to the languages type system. The first states that Groovy is an optionally typed language. Optional typing in Groovy allows certain variables defined without a type (using the def keyword) and others with a type similar to Java. The second definition given to Groovy's type system is that it is dynamically typed. In the past I always associated dynamic typing with not having to explicitly declare types in code (in languages like Python and JavaScript). So how can Groovy have dynamic typing along with optional type declarations? To answer these questions I had to dig deeper into programming languages type system and sharpen up my definitions of dynamic and static typing.

As previously mentioned, I used to associate dynamic typing with a lack of type definitions. I likely made this association because languages that don't declare types in code are often dynamically typed - such as JavaScript and Python. While both JavaScript and Python are dynamically typed, the meaning of dynamic typing is less about existence of type definitions and more about when types are enforced.


July 11th, 2018

How Do Regular Expressions in Groovy Stack Up?



+5 More

Using regular expressions for pattern matching is a task software developers perform on a regular basis. Although regular expressions still differ a bit across languages, they are standardized to the point where they are language agnostic. However, interacting with these regular expressions differs greatly across different programming languages. In my recent ventures into Groovy, I saw a very unique approach to handling regular expressions. I decided to compare the approach in Groovy to approaches in other languages I often use. This article shares my findings.

Language Agnostic

A concept that is independent from any single programming language implementation. Skills that are language agnostic can be applied throughout the software development ecosystem.


December 22nd, 2018

How Languages Enforce Multiple Inheritance


Object Oriented Programming

+7 More

I recently read a book discussing multiple inheritance in Python. Python is one of the few object oriented languages that permits multiple inheritance of classes. Many other languages include workarounds for multiple inheritance. For example, Java allows for classes to implement multiple interfaces. On the other hand, PHP allows for classes to use multiple traits. This article looks at programming languages I use and how they enforce multiple inheritance or available workarounds.

What is Multiple Inheritance?


July 29th, 2018

Method Overloading Across Languages


Method Overloading

+6 More

While working with the object oriented paradigm, methods often need to be overridden or overloaded. These similar concepts are often confused by new developers - in my early days of software development it took a long time to remember the differences. Both overriding and overloading consist of creating multiple methods of the same name. The difference between the two is the scope and situation in which these methods are used.

Method Overloading vs. Overriding


Overloading is creating multiple methods or functions in the same scope with the same name. For overloaded methods the scope is a class definition. The difference between overloaded methods is the number of parameters - or for a language with explicit type definitions the parameter types. A programming language is tasked with choosing between the different overloaded methods when they are invoked. Invocation processes differ across programming languages.


Overriding methods occurs in object oriented programming when a subclass implements a method already defined in the superclass. Everything about the method signature stays the same - including the number of parameters and the return type of the method. When the method is called from a subclass instance, the overridden method is invoked instead of the superclass method.

Languages such as JavaScript use a similar technique to overriding with prototypal inheritance. The JavaScript technique is called shadowing, in which an object lower on the prototype chain has a method that shares the same name as a method higher up the chain. Methods lower on the prototype chain will block - or shadow - methods with the same signature higher on the chain. Shadowing results in methods lower on the chain being invoked.


August 18th, 2019

Revisiting Type Equality



+15 More

In this article I'm revisiting the concept of type equality. Type equality is a topic that software engineers learn early on in their careers. Similar to any other profession, it's beneficial to go back to the basics for practice. Professional basketball players practice layups before each game. Professional programmers should work at the basics as well. I spent this past week re-learning type equality in 13 different languages. In the process I've reaffirmed my knowledge and gained new insights. The rest of this article discusses my findings.

The Different Forms of Type Equality


September 29th, 2020

Jenkins Server Modern Infrastructure with Kubernetes on EKS



+8 More

In a prior article, I discussed a Jenkins server I created on AWS EC2 and EFS. In this article I’ll discuss the second generation of that infrastructure, which uses Docker containers orchestrated by Kubernetes on an EKS cluster.


October 1st, 2020

Interesting AWS Jenkins Jobs



+2 More

I recently built a new Jenkins server hosted using Kubernetes on EKS. My main use of the Jenkins server is to automate application and infrastructure tests, deployments, and miscellaneous tasks. I get email notifications if these jobs fail, so I know when there is an issue with my software.

Many of my Jenkins jobs work with the AWS CLI and Terraform to interact with and manipulate my cloud infrastructure. I believe these jobs may be useful as templates for others wishing to achieve similar results.