Skip to main content


Showing posts from September, 2019

An early look at Dagger Reflect

When it comes to solving the Dependency Inversion principle, there is no better way then using annotations in the JVM world. However, generating code in compile time has some costs. For example the build time. And I believe this is the only thing dagger can't do well alone.

This is not a bye bye dagger post. This is mostly, obtaining the most out of Dagger.

To solve this problem, Dagger-Reflect was written. What this tool does, is basically moving Dagger a step forward, from code generation at compile time, to code generation at Runtime, which basically is what reflection does, overall.

To set up Dagger-Reflect is pretty easy. Just add these lines to your build.gradle (module app) file:

You can check the docs for full or partial configuration. One thing that doesn't go well with this configuration is repetitive code if you have a lot of modules. Yes, you have to do this in every module that you have dagger. Therefore, there is already a plugin which handles that, and requires…

Getting hands dirty with Flutter

An Android Developer point of view.

I have never been a fan of cross-platforms until Flutter came by. Actually, it was my first experience with cross-platforms. Never have I ever tried React Native, Ionic or whatever. But what was intriguing about Flutter? Well, since I am a Google fan and a Native Android Developer, i thought I should give it a try.

Jumping into Flutter was pretty easy. They have simple documentation comparing to the Android Developers documentation, and I think it has a lot more details and better best-practices. Also, Android Studio supports flutter development by just installing Dart and Flutter plugins. So the only real configuration I made was telling Android Studio where my Flutter SDK location was.

In order not to transfer this article to a tutorial, I'm just going to point out, what I think Flutter development is comparing to Android.

Honestly, Flutter is simpler.
Even though I was an inexperienced programmer when I started Android, I remember a lot of str…

Publish your library to JitPack

Once getting inside the open source concept, the idea and desire to publish a library is inevitable. What you need is an idea, or perhaps make a better version of an existing library, or just you need to use some module inside your company for several projects.

With the JitPack, you won't be suffering at all. So how do you do it? For the sake of this tutorial, I'm just gonna make a logging library.

Note: This article assumes you already know how to use git.

Once you have your IDE opened, create a new project. Since I am using Android Studio, I'm gonna choose an Android app but you can do the same (I guess, never done it) with on Java/Kotlin projects and IntelliJ. Nothing new here. So let's jump further. Once the project is created, create a new module:

After that, you can choose whatever you need, but for this article I'm gonna stick to Android library. 

Give it a name, and the library is ready to be coded. If you notice, in your project, the module will be added…

Some quick notes on Dark Mode

The dark mode, perhaps is one of the easiest functionality to implement without breaking literally anything in existing project. However, it has it's own hidden costs, tricks. Before implementing the Dark mode, what is most important is that your project must be ready for dark mode.

What I had:

What I wanted to achieve:

The setup:
The only thing you need to doto get your app ready for dark mode is the themes tag and the AppCompatDelegate class. The rest depends on your project. So instead of some <stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar"> you just need the <stylename="AppTheme"parent="Theme.AppCompat.DayNight"> . The code for dark mode/light mode is pretty simple: 

Note: These are not the only states.

The problems I faced:

The drawer:
First of all, if you notice the drawer on the Light mode, you will see that the text of the menu items, is black. I don't really want that, because in dark mode it will truly …

A small comparison between 3 essential algorithms in Kotlin

There is no doubt that sorting is still one of the most essential and important part in computer science. Everyone who knows a little about algorithms has already proven today's data to  be true, but I would give a hand to everyone who hasn't tried the results by themselves yet.

There are different sorting algorithms, but there are many factors to differentiate them from one another. And the focus today will be in the execution time, which comes as a result of each algorithms time complexity.

Let's jump to the algorithms first, starting with Insertion Sort:

This is the code for Merge Sort:

And this is the code for Quick Sort:

The only thing that will be changing here is the size of the elements that Utils.someArrayOfInts() will return.

In the first case, let's try our algorithms  with just an array of 7 integers:

Insertion sort is pretty quick comparing to other algorithms in this case. Now let's run the same algorithms, with one thousand (1000) integers. Check …