you can see part 1

deconstruct an object into a series of variables. A destructive declaration will create multiple variables at the same time.

data class Person(val title: String, val age: Int)
val person = Person(title, age)
val (title, age) = person

A destructive declaration is compiled into the following code:

val name = person.component1()
val age = person.component2()

Anything can be placed to the right of the destructor declaration as long as the required number of component functions can be called. Of course, there can becomponent3()withcomponent4()and many more.

Destructuring statements can also be used in loops

Tricks(1) Destructuring (for lambda parameters)

you should use…


Kotlin said I don’t have ternary operator, it’s bad for readabilit

  • the idea is that the former expression is more readable since everybody knows what if else does,
  • ? : The Elvis operator is part of many programming languages, e.g. Kotlin but also Groovy or C#. may be unclear if you're not familiar with the syntax already.


if or when in Kotlin is not a statement but an expression (i.e. it evaluates to a value),

if (condition) exp1 else exp2
if (a) b else c

in the case where you have multiple statements inside the body of an if branch…

1- what is Interface and its property ?
2- why an interface can’t store the state?
3- How to Implement interface property in Concrete type ?
4- what happen if class implement multiple interface and both the interfaces have the same functions ?
5- interface difference in Java and Kotlin
6- Functional interfaces(SAM Single Abstract Method)
7- Use a lambda in place of a functional interface?
8- Why use Object Expressions to instiate anonymous interface ?
9- Functional interfaces vs. type aliases ?
10- why can’t use Generic inside Interface Declaration ?
11- default function implementation of interface ?

what is Interface and its property ?


1- passing data between two activities
2- Passing data between two fragments
3- Passing data between Activity and Fragment

I was asked this Question in interview 😅😅

1️⃣ Passing data between two activities

  • Intent
    is an abstract concept of work or functionality that can be performed by your app sometime in the future (action +data)
val i:Intent =Intent(getApplicationContext(), NewActivity.class)
  • DataHolder and Hashmap
    You can use a singleton class to store objects and retrieve them in other activity by getting instance of that singleton class.

if you have a lot of arguments and/or complex objects you wish to move from one place to the…

1- examples that need factory design pattern ..
2- what is factory design pattern ?
3- When to use Factory design pattern ?
4- Advantage of Factory Design Pattern ?
5- How it should be implemented without Factory Design pattern ?
6- implementation with Factory method pattern ?
7- Disadvantage without using Factory Design Pattern?
8- Advantage with Factory method pattern
9- Relations with Other Patterns
10- Are Factory Design Pattern Concern with Complex object like builder?

when take about factory we will take about 3 pattern 1- static method factory (like we made in Singleton) 2- factory method (this…

1 - what is Builder Design Pattern
2 - when we had to use Builder Design Pattern ?
3 - some built in class we use in android studio that use Builder pattern ?
4 - How do we create a Builder in kotlin ?
5 - Fluent Interface with Builder Pattern in kotlin
6 - disadvantage of Builder Pattern?
7 - avoid builder pattern in kotlin
8 - advantages of named parameters over builder?
9 - Situation you need builder over named argument ?
10- Builder Pattern vs Kotlin DSL

Singleton Design Pattern in Kotlin

What is Builder Design Pattern

Builder design pattern is…

Design Pattern with Kotlin

1- singleton design pattern and its rule.
2- way to make singleton thread-safe
3- implementation in Kotlin without object keyword and the magic of object
3- how to Call Kotlin object Singleton in java class
4- Kotlin object property.
5- tricky ways to handle singleton when need to pass args to param
6- when it is not recommended to use object ?
7- android real example you do in your app (retrofit and sharedPref)

The singleton pattern is a design pattern that restricts the instantiation of a class to one object. …


Notes here i won’t make blog for the implementation for each of this

1- is my app can success without clean architecture?
2- ideal clean architecture meaning ?
3- mvvm over mvp and The opposite ?
4- can i combine both in one project?
5- when i use mvvm and mvp ?

1- In most cases we can not build an app purely on a single pattern, and that’s fine.

be relax :)
here Telegram Project you can check if and tell me if it use mvp or mvc or mvvm but don’t mean i told you not make no architecture i will say when should i don’t use architecture later

2- The main things is to separation in the view, the model and the logic between them

3- what is the Ideal Architect It should be

ahmed shaaban

Mobile Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store