Functions and Methods (With the Traps and Tricks)

These pages are targeted at people who can already program in Python, so the most basic aspects of functions and methods is assumed knowledge, and this page focuses on what is of interest to those who aleady have that assumed knowledge. Default Value Parameters.The default value trap'Pure' functions / methodsFunction overloading Default Value Parameters Both… Continue reading Functions and Methods (With the Traps and Tricks)

Variables & Types (Under the hood)

This posts delves a little deeper in to variables in both Python and Kotlin. Nobody Expects.. Pointers in Python (and Kotlin)Primitive Values vs Reference/Pointer Variables.Mutable vs ImmutableShared Modifications - The Devil InsideClass vs Type in Python & Kotlin Nobody Expects.... In many languages, the simplest variables operate like a calculator memory: A value is stored… Continue reading Variables & Types (Under the hood)


The two that do not fit in the same group are the Python With and Kotlin Use. These functions are for using (or doing something with) a resource that should be released when the operation is complete. Kotlin Let, Apply, Run, Also, With (not to be confused with Python With), are all quite similar. Once… Continue reading With,Use,Apply,Also,Run,Let

From Extension Lambdas to expressive Kotlin DSLs

Extension functions, and Lambdas and even Extension Lambdas have both been discussed already (and are assumed knowledge for this page).  But the uses of lambdas goes beyond just functionality, and into the realm of expressive code.  Expressive code is about having the code represent the ideas behind the code more clearly, allowing better reading of the… Continue reading From Extension Lambdas to expressive Kotlin DSLs

Closures, callbacks, Lambdas and Lambda parameters

Introduction. Previous pages have introduced the concept of lambdas and closures, and explained how the concept of the closure relates to methods, static and class methods in both python and kotlin.  This page builds on the concept of lambdas and closures, and provides more details on the workings in kotlin, and how this differs from… Continue reading Closures, callbacks, Lambdas and Lambda parameters

Interfaces, Delegation & Composition vs Multiple Inheritance & Duck Typing

Kotlin has Interface, Abstract Classes and Delegation, while Python has multiple inheritance. Different tools, same problems.  The different tools reflect an evolution of what Object Oriented best summed up by: Composition over inheritance. The rethink, the new concepts and how to use them are explained here. Abstract Classes Interfaces:  Duck Typing with Safety Multiple Interfaces… Continue reading Interfaces, Delegation & Composition vs Multiple Inheritance & Duck Typing