DISCOVERY

October 4th, 2018

Cool Python Data Structures

Python

Data Structures

In my time spent researching Python this week I stumbled across some really interesting data structures. Python has a vast standard library, with many data structures that specialize in certain tasks. It reminds me of Java’s standard library, except that Python data structures either have their own literal syntax or a built-in function for construction! This discovery post looks at three data structures that I found especially interesting.

Tuples

Tuples are a commonly used data structure in Python. They hold immutable records, and are often used as immutable lists. One thing I didn't know is that tuples support 'tuple unpacking', which spreads their contents across multiple variables.

DISCOVERY

December 14th, 2018

Features of Python Classes

Python

Object Oriented Programming

In this discovery post, I'm exploring some interesting features of Python classes. Python fully supports the object oriented paradigm, and I wrote about object oriented features such as the data model in past articles. Learning all the object oriented features of a language assists in creating APIs. Hopefully this knowledge helps me create better Python objects.

Investigating Python Methods

DISCOVERY

September 24th, 2018

Python's Data Model

Python

Meta-Object Protocol

This summer I started a trend of picking a different programming language each season to explore. The language of the summer was Groovy, which was selected because I used Groovy at work. For the fall I’ve decided to deep dive into Python. Python was the first language I learned, beginning with CS101 my freshman year of college.

Python is well documented as a beginner friendly language. It is taught at most colleges to introduce programming. The ease of learning Python does come at a price. Very few master the language since they feel there is no need to1. The goal of dissecting Python this fall is to truly understand everything the core language has to offer. To begin, I will explore Python’s data model.

DISCOVERY

December 15th, 2018

From Protocols to ABCs in Python

Python

Protocols

+2 More

Python provides many different techniques for declaring interfaces. Some are informal such as protocols, while some are strict such as ABCs. The lack of an interface keyword makes learning all the different techniques a bit more difficult. This discovery post explores different options for creating interfaces in Python.

Protocols & Duck Typing

RETROSPECTIVE

October 28th, 2019

Unit Testing AWS Infrastructure with Python

AWS

Python

+2 More

From October 2018 to May 2019, I moved the infrastructure for both my websites to AWS. The process for building and tearing down this infrastructure is automated with IaC, specifically Terraform. I've had a lot of fun working with Terraform and learning the different design patterns for infrastructure in the cloud.

After my infrastructure was built, I realized I needed a way to test that my IaC was behaving as expected. The obvious solution to this requirement was a unit test suite. I implemented this unit test suite in Python with the help of the AWS SDK. This article explains why I took the time to write unit tests and walks through of the basics of testing AWS infrastructure in Python.

DISCOVERY

March 31st, 2020

Interesting Aspects of Numpy

Python

Numpy

Data Analysis

In my new role at work, a good chunk of my programming is Python based and revolves around data analysis. I already knew Python, however I wanted a review libraries such as numpy and learn libraries such as pandas and matplotlib. This article discusses numpy, short for "Numerical Python". The goal of this article isn't to teach numpy to beginners, instead focusing on library aspects I found most interesting.

What is Numpy?

DISCOVERY

April 19th, 2020

Interesting Aspects of Pandas

Pandas

Numpy

+3 More

In my previous article I walked through interesting aspects of numpy. I first learned numpy back in college during a course on Artificial Intelligence. With my daytime work becoming more Python based these past few months, I took numpy back up.

Before this winter, I never used pandas. Pandas is a data analysis library similar to numpy. In fact, pandas uses numpy arrays in many of its exposed methods. While numpy exposes an array data structure, pandas has two main data structures: Series and DataFrame. In general, pandas is commonly used for manipulating and analysing time series or table data (think SQL table or excel spreadsheet)1.

DISCOVERY

November 25th, 2017

Exploring Generators

JavaScript

ECMAScript 6

+2 More

When I first heard about generators in the ES6 version of JavaScript, I wasn't quite sure how useful they would be. In this post I will look at the basics of generators in JavaScript and other languages. In a future post I'll explore how to combine Generators and Promises.

The following code uses generators to create a fibonacci sequence.

DISCOVERY

December 22nd, 2018

How Languages Enforce Multiple Inheritance

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?

DISCOVERY

November 14th, 2017

Sorting Lists with Comparison Functions

Java

Java 8

+6 More

In this discovery I look at sorting lists in different programming languages for non-trivial objects. The languages I use are my core languages: Java, JavaScript, Swift, Python, PHP, and C. I've used all these languages in larger projects and wish to stay proficient in them. Throughout this article I show snippets of code in each language, but you can also check out the full code on GitHub. Let's get started!

Java

DISCOVERY

January 24th, 2018

First Look at RabbitMQ

RabbitMQ

Message Broker

Python

Recently I looked at RabbitMQ, a message broker used to communicate between different parts of an application. An analogy I really liked is that RabbitMQ puts a post office in an application, where producers put messages in a post office box, which are then routed to consumers1.

RabbitMQ configuration can be written in any language with a RabbitMQ library (which consists of most languages you know). This is extremely powerful since different pieces of the RabbitMQ channel can be implemented in different languages. For example, let's say a RabbitMQ server has one producer and three consumers. The single producer might be written in Java, while the three consumers might be written in JavaScript, Python, and PHP. Imagine all the different possibilities of sending RabbitMQ messages across applications!

DISCOVERY

July 29th, 2018

Method Overloading Across Languages

Java

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

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

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.