Today, I learned about function composition. A function can be passed as argument to other function's parameter and can be returned as function.
fun (a : (Int)->Int) : (Int)->Int{ return a(it)} //this will return a function of type (Int -> Int)
#kotlin#android#jetpackcompose
In Kotlin, there is 2 ways to define a function without name. First one is Anonymous function looks like this fun (a : Int, b : Int) = a * b and second one is Lambda expression which looks like this val sum = {a : Int, b : Int -> a + b}.
#kotlin#jetpackcompose#androiddeveloper
Today, I learned about JSON and JSON Moshi Library which helps to Serialize the Kotlin object into JSON and Deserialize from JSON to Kotlin object.
Moshi library is lightweight-fast speed and size is just about 100 KB .
#kotlin#android#androiddeveloper
Today, I learned about data class which provide data-oriented methods like copy() & componentN(), and modified implementation of toString(), equals() & hashCode().
#kotlin#android#androiddeveloper#learninpublic
Today, I learned about lazy initialization and lateinit in kotlin. Lazy variable initialized when accessed first time, & lateinit is value will provided later for initialization.
#kotlin#android#learninpublic
I made a Command-Line project named "Chuck Norris Cipher Encoder" using Kotlin. I used concepts like while loops, when, if-else, encoding-decoding, binary numbers etc.
Source Code - https://t.co/Yc3dIC2lSa
Today, I learned about Interfaces Segregation Principle which is about classes which implement interface shouldn't have force to implement every methods and properties unnecssarily. interfaces should be divided into related responsibilities.
#Kotlin#Android#AndroidDeveloper
Today, I learned about Single Responsibility Principle which is about a class, function and module should have one reason to change. We should keep related responsibilities together and separate unrelated responsibilities.
#Kotlin#Android#AndroidDeveloper#JetpackCompose
After learning about Code Organisation and Design Principles like DRY, YAGNI, KISS & SOLID. I understood working code alone is not enough, when software complexity arise we need to organise code properly for other developers.