Member-only story

Object-Oriented and Functional Programming in Kotlin

PINAR TURGUT
3 min readAug 25, 2023

--

Object-Oriented and Functional Programming, using the Kotlin language. Don’t worry if those terms sound a bit overwhelming — I’m here to make it all crystal clear without the tech jargon.

Object-Oriented Programming (OOP): 🧩

Think of OOP as building with LEGO blocks. Each block represents an object that has certain properties (color, size) and actions (connect, disconnect). In the programming world, objects are like those LEGO blocks — they bundle together data and the functions that work on that data.

Let’s say we’re building a zoo simulation. In OOP, we’d create objects like ‘Animal’ or ‘Zookeeper’. An ‘Animal’ object could have properties like ‘name’ and ‘age’, and methods (functions) like ‘eat()’ or ‘makeSound()’. These objects can interact, and we can organize them into classes and hierarchies for easier management.

Functional Programming (FP):

Now, imagine building with building blocks that can transform themselves. Functional Programming is like a series of transformations on data. You give it input, it processes it, and gives you an output. It’s like a recipe — you follow the steps and get your delicious cake at the end!

--

--

PINAR TURGUT
PINAR TURGUT

Written by PINAR TURGUT

Android developers who is passionate about personal growth https://pinartechtips.com

Responses (1)