• Developer's Commute
  • Posts
  • Quick Question: Want to Find the love of your life, I have something for you - Developer’s Commute

Quick Question: Want to Find the love of your life, I have something for you - Developer’s Commute

Building Symphonies of Innovation

Hey, I am Hitesh and this is Developer Commute, my weekly newsletter. I give you some interesting insights into Android each week. I hope this adds value and brings joy to you.

Let's start with today’s newsletter

Apps Making Headlines

What if your dating app had a personality Test?

Have you tried using dating apps before?

They might have or might not have worked for you.

I am sure they wouldn’t have given you a long-lasting relationship. Well, there is an app that is trying to solve this problem.

Imagine that instead of trying to optimize your profile for dating, an AI does it for you based on a personality test. It allows you to find people that match your vibe. That is where Cosmic App shines.

Cosmic App stands out the most amongst other dating apps, as it allows you to see who likes you and undo swipes free of cost.

It is trying to change the market of dating apps with new technological trends. I am excited to see what this app can deliver.

Before it comes to every phone, the cosmos has to face a lot of challenges. Markets like India involve thousands of people who will make profiles with diverse cultures and languages. It would be interesting to see how the AI copes with the plethora of information and how it will find matches for you.

Interesting Facts about Apps

Did you know on average a user has more than 80 apps on their phone?

Coding Memes

Android Core Concept

What is Dependency Injection?

Ultimate Path To Understand " Dependency Injection "

Here Is Everything you need to know

Let's start with Dependency Injection

Pre-request - I hope you understand the Class and objects in Kotlin

What is Dependency Injection?

  • It is needed when a class may require another class to function properly

Let me explain :

  • Suppose there is a Car

  • A car is dependent on its Engine system to work properly

  • A car is dependent on its Break system to work properly - A car is dependent on its Gear system to work properly - This is called Dependency

  • When we put or Inject these systems inside our cars.

  • So that it may serve its purpose.

  • This is called an Injection

When a car class is dependent on an Engine class to work properly.

And when we inject our Engine class into our Car class it is called Dependency Injection

  • So when we inject a class into a class that is dependent on it for its functionality

It is called a dependency Injection

  • It is needed when a class may require another class to function properly

  • It can be done manually but a framework is always preferred

  • Because it reduces a lot of code and keeps everything consistent

  • Framework makes it easier for new programmers to understand the code.

How can it be done manually?

  • We can simply Inject the Engine class through a constructor of the car class

  • But complexity arises when multiple projects need the same class.

  • What if there are bike, truck etc classes that are also dependent on the Engine class.

  • Injecting Engine class, again and again, becomes complex in nature

What is the solution?

What if we can save the Engine class in one place and every time another class needs it.

The class can go and access it from where it is saved.

This is a better approach

Here comes the need for dependency Injection frameworks like

  • Dagger Hilt

  • Dagger 2

  • Koin

How does it reduce code and keep everything consistent?

  • Manual Injection is avoided so code is getting reduced by a lot.

  • Since we are using a framework for dependency Injection our code will be consistent in every project

How do Frameworks make it easy for new programmers to understand the code?

  • With Consistency of code throughout all the projects.

  • It becomes easy for a new programmer to join the project and understand the code

  • Frameworks, therefore, make our Dependency Injection easier

"Dependency Injection can be made easy if an external source keeps track of the class that needs to be injected. It automatically takes the class and injects it with the required class. This is a dependency framework.”

This is the perfect Definition of Dependency Injection

What are the benefits of Dependency Injection?

  • Code Reusability

  • Improves Single Responsibility

  • Makes class more Testable

  • Makes Code more extensible

How does it increase code Reusability?

  • Dependency Injection allows us to reuse code again and again

  • Without creating a lot of messy boilerplate code

  • For example - The module allows us to inject a lot of code easily

Improve Single Responsibility?

  • Single Responsibility means that the class has the responsibility of carrying out a particular function

  • When we inject Dependencies, the class does not need to create objects of those injections.

  • Therefore it focuses on its single-function

Make Class More Testable?

  • Dependency Injection reduces a lot of boilerplate code thus making testing efficient in nature

  • We can easily track dependencies and find the code that is not working properly

Does it make code more Extensible? -> More parts of code can be added easily

  • Parts of the code can be easily implemented and injected where we want.

Two ways to add Dependency Injection inside the class: -> Constructor Injection -> Field Injection

Adding Dependency Injection through a constructor that is Constructor Injection

When we implement Dependency inside the class its Field Injection

Android Interview Question

"How to show local Notification at an exact time?"

Answer :

Suppose we want to show some kind of notification to the user at a particular time.

How can we do it?

-> Work Manager

-> Alarm Manager

Which should we choose?

-> Work Manager -

  • It does not guarantee the time of execution

  • The user does not need to be aware of these process

  • It is not a safer option when dealing with doze mode

  • Mostly used for background tasks-> Alarm Manager-

  • It guarantees the time of execution

  • The user is aware of the processes

  • It is a safer option when dealing with doze mode

  • Used for foreground tasks

    What is doze mode?

  • -> When an android is sitting ideal and is not being charged.

  • -> The OS stops the access of the CPU and network for the apps

  • -> This saves the battery life of the android

  • -> Once the screen is turned on or the charger is connected. The apps become normal.

    The best way to send timed notifications for the app

  • -> Use Alarm Manager with a broadcast Receiver

Advice Block From Experts

How to get your First Android Development Internship?

As an Android Developer, I always wondered how to break into the tech industry as a newbie. Well, I went out and asked some developers. How they got their first role, and I got some interesting insights and Tips for you.

Tip: Apply to Jobs properly

When you apply for jobs on LinkedIn, don’t just fill out the job form and hit apply. Instead, connect with the hiring manager who is hiring for your position. Once you have connected with the hiring manager, message him that you would love to work in the company and add some value to their product. Try to understand the product beforehand and see if you can share some insights about the product in your message. Tell him that you will be a valuable asset to the company if they allow you for a fresher role. After reaching out to the hiring manager, try connecting with people working in the company who may be your seniors or working on the same tech. Message them as well. Keep applying this technique to land your first fresher role. Tag me on Twitter or LinkedIn if you this tip helped you land your first role.

Interesting Tweets