Using Redis as a cache mechanism with Python

There are a lot of scenarios where we want to reduce the number of requests we do either towards our database either towards a third party API. Those may include reducing the usage cost -either referring to the need of scaling our systems, either to the usage of an external API for a specific number…

Read more

Handling dates in BI projects and Data Warehouses

One of the biggest challenges -if not the biggest- when we are building ETL pipelines, either for BI projects either for any project that has any integration requirements, is the unification of data. Overall this will be a domain-specific task. Handling dates although, that are imported in our system from external or internal sources (e.g…

Read more

Facade Pattern in Python

The Facade design pattern belongs to the structural design patterns and provides a unified interface to a set of interfaces. It is commonly used in apps written in OOP languages and it intends to provide a convenient interface to the client, thus the latter avoid dealing with complex parts (subsystems). Keep in mind although that,…

Read more

Binary Search Tree

Any tree that its elements have at most two children nodes is called a binary tree. Those children nodes are referred typically as the left and the right child. As we can see a tree is not a linear data structure and represents nodes that are connected by edges. A tree has the following properties:…

Read more

Bubble Sorting in Python

Bubble Sort is the simplest sorting algorithm. It works by changing positions in the adjacent elements if they are in the wrong order. Basic Example Assume we have the following list of integers: (32, 5, 12, 9, 72) With bubble sort, we will traverse through the list and compare the adjacent elements, as many times…

Read more

Python Generators

Generators are a special kind of function that returns a lazy iterator. These are objects that you can loop over like a list. Unlike lists, lazy iterators do not store their data in memory. Before diving in generators, we need first to elaborate a bit on the iterators concept and the yield keyword. Iterators An iterator is…

Read more

Python Decorators

A decorator is a design pattern in Python that allows a user to add new functionality to an existing function or object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate. Functions as First-Class Objects Before diving into decorators we need to understand how functions work in Python where they are first-class objects.…

Read more

S.O.L.I.D. Principles in Python

In object-oriented programming, S.O.L.I.D. is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable. S.O.L.I.D. Concepts Let us initially briefly describe each one of the principles, before our attempt to elaborate on each one of them with Python examples. Single Responsibility Principle: Any class should only have a single responsibility, meaning that…

Read more