My Journey — Five Years of Android Development

18 minute read

Published:

This post is all about my journey through Android development which has taught me many lessons. I am writing this article because it could be helpful to many people out there who are facing problems like me.

Back in 2014, July 7th, I had my first job as an Android developer. It would be exciting for almost everyone on the first day of a job career. Same with me. I was so excited with many questions in mind, like how the company was going to be.

What would my roles and responsibilities be? And so on. But after a week or so, we all will come to understand what the things are that we need to handle.

I started my career with a startup where I didn’t have a mentor to teach me the way of learning and implementing things in software development.

I know that many of us are not going to start our career with top companies but we should take it as an advantage because here, we are going to learn things in our way. If it fails, we learn from our mistakes and try another way, spending more time at work.

A job is not like a movie where we go to spend some time and come back when the movie end. At the starting point, it’s all about our career which we are going to sail throughout our life.

It’s like building a strong foundation base. Spend more time at work or learning at the initial phase, otherwise you are going to face something unexpected in the future. I know that every one of us has family and other responsibilities, but keep a balance on everything.

Learn something from each mistake. Do not repeat them.

Some of my experiences that could help others.

Learn Before You Code

Many of us, after getting a task to do, we straightaway hit the IDE to get the result. We use our expertise to Google the things and copy-paste them. Sooner or later, we will find out that everything can’t be done in that way.

So, if a task or feature is assigned to be implemented, try to give your best. First of all, think about how we are going to solve the problem, secondly, what are we learning from it, and lastly, is this the optimized way of doing it?

Every one of us codes to get the result, and keeps on doing the same thing for years. I too had done the same thing until I met some people who I should thank for making me look at things differently.

Before starting and hitting the IDE, estimate your work effectively. Everything you do, try to make a new learning experience out of it. Do things differently, try to implement older stuff in newer ways so that you don’t get bored.

For example, I had used findViewById(R.id.xxx) for almost two years. I was used to it. Although Butter Knife came to ease some things I was not aware of it because I didn’t spend time exploring.

I just wanted my code to run and get the result on mobile. But later, when I started using Butter Knife, and later Kotlin synthetic imports, I understood the ease of doing things. So, keep on exploring things…

Keep learning, never stop. Try different approaches for the same task.

Check for Optimization

There is always room for improvement. Once we get the desired output, we ourselves or the QA (Quality Assurance) team test the build and release it to production.

But getting the desired outputs is not the only most important thing we need to check as to how the feature we implemented affects the performance of an app.

There may be a lot of reasons like bad CPU usage, unnecessary memory consumption, poor implementation of battery resources, etc.

To debug and overcome these issues, in Android Studio 3.0, there is a section called Profiler. A Profiler is a suite of tools to explore, optimize, and troubleshoot performance.

With Profilers, you can measure UI performance for situations like frame, drops, and check for view hierarchies. Slow rendering creates a very bad user experience. Make use of Profile GPU rendering, Systrace, layout inspector, and the benefits of ConstraintLayout.

Check out my posts on Profilers and improving UI performance to get an idea of how you can optimize your apps.

Make a habit of measuring the performance of the app before release. This will give better results.

Coding Standards

Writing something and getting output is a thing that everyone can do providing little assistance. But writing clean and maintainable code is a little hard in the beginning.

At the starting point, we don’t have exposure to code so with our knowledge, we write the name of methods and variables as per our understanding which may be difficult for others to understand.

I too had a difficult time for six months at an early phase in my career. In these six months, every time I wrote something, I used to get bad feedback for one thing or the other.

The code we write should be easily understood by everyone on the team, it should be easy to modify. Don’t think of great names, it’s just a matter of naming that everyone should accept.

In some companies, you can find some predefined naming standards so we just need to follow them rather than creating new ones.

For classes that extend an Android component, the name of the class should end with the name of the component. For example, LoginActivity, SignUpFragment, DownloaderService, CustomDialog.

Resources file names are written in lowercase_underscore. For example, for images or icons, we use ic_ as the prefix. If the image is tickmark then we name it ic_tickmark.

For layout files, we use the component_class_name format. If there is a LoginActivity, the layout name will be activity_login. If there was a SignUpFragment we use fragment_sign_up as layout file name.

The coding standards can improve readability and maintainability of the code and it reduces complexity of understanding things.

Testing

Testing has gained more importance these days. Nowadays, everyone is asking to write test cases while developing. JUnit test cases are most commonly used for testing the logical parts.

Levels of testing:

Small tests are unit tests that validate your app’s behavior, one class at a time.

Medium tests are integration tests that validate either interaction between levels of the stack within a module or interactions between related modules.

Large tests are end-to-end tests that validate user journeys spanning multiple modules of your app.

It is better that we follow test-driven development(TDD) when developing our apps. Rather than doing testing after the entire product is finished, we need to start at the very initial phase. Find out more about falling in love with Android Testing.

Though following TDD is not so easy, it’s useful to limit the flaws to the max extent possible.

Architectural Patterns

Until we have two to three years of experience, some of us might not have heard the term architecture. But it is very important to know about architecture. Architecture is nothing but the way we implement our apps.

The common scenario is, if joining any new organizations when we start bug fixing then we come to know how painful it was and give blessings to the master who wrote that shitty code, it may not be true in all cases.

But who knew the importance of architecture would have followed it so that you will understand the importance because of the ease of changeability.

There are many architectures out there like MVC, MVP, MVVM, Clean, etc. It is totally dependent on the complexity of our app to decide which architecture to use.

Keep in mind that mobile devices are also resource-constrained, so at any time, the operating system might kill some app processes to make room for new ones.

The most important principle to be followed while developing the apps was separation of concerns.

These UI-based classes like activity or fragments should only contain logic that handles UI and operating system interactions. By keeping these classes as lean as possible, you can avoid many lifecycle-related problems. Keep the model classes independent of UI.

Architecture would be more helpful for changeability in case there are any future modifications to the developed feature or testability.

Security Implementations

As you are an Android developer, you might have known about APK decoding.

It is a process by which an APK file can be decoded and the third person can see your class files and resource files. We need to apply ProGuard to our apps while generating the signed APK.

ProGuard helps to shrink, obfuscate, and optimize our app.

android {
    buildTypes {
        release {
            // Enables code shrinking, obfuscation, and optimization for only
            // your project's release build type.
            minifyEnabled true
            // Enables resource shrinking, which is performed by the
            // Android Gradle plugin.
            shrinkResources true
            // Includes the default ProGuard rules files that are   packaged with
            // the Android Gradle plugin. To learn more, go to the section about
            // R8 configuration files.
            proguardFiles getDefaultProguardFile(
                    'proguard-android-optimize.txt'),
                    'proguard-rules.pro'
        }
    }
    ...
}

If ProGuard is applied to your apps, it renames the class file names to short names that hackers couldn’t understand and creates a lot of junk files. There is a mapping file that is generated.

By applying ProGuard, even though your class files are protected to some extent, our resource files can be seen by the hacker. There are many paid tools available on the market like which can even secure resource files.

Hungry to know more info? Please check out R8 shrinking.

We talked about securing our codebase. But there are other things like preferences, databases, and networking where we need to provide security.

The native encrypted shared-preference library from the AndroidX family is one way to secure preferences. It only supports Marshmallow (Android 6) and above. To know more about securing preferences, please check out Securing sensitive data in Android.

For secure communication with the servers and to prevent man-in-the-middle attacks, we need to implement some kind of security measure. In order to securely access an online service, users need to authenticate to the service, they need to provide proof of their identity.

Many of us follow the concept of OAuth for secure communications. OAuth provides a single value, called an auth token, that represents both the user’s identity and the application’s authorization to act on the user’s behalf to fetch or post data to the server.

Based on the auth token, the validation server returns the response. Also, please check out Certificate Pinning.

The future is all about security so do not underestimate it.

Learn Design Patterns

In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem. It is not a finished design that can be transformed directly into source code.

Rather, it is a description or template for how to solve a problem that can be used in many different situations. Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system.

While developing an application, we face some common problems. Design patterns are nothing but a common solution to such problems. We can apply them to get a solution to our problems.

Design patterns are classified into three categories mainly:

Creational design patterns deliver solutions for creating classes and objects (Singleton, Factory, Builder, etc.).

Structural design patterns are about the arrangement of classes and objects (e.g. Composite, Facade, Adapter).

Behavioral design patterns give us ways to communicate between objects and classes (Command, Observer, Strategy, etc.).

To know more, check out Design patterns in Android or other Medium posts.

Design patterns are very handy most times when you don’t know what to do.

Make Use of VCS

A Version Control System helps us to maintain file versions. Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. For almost all software projects, the source code is like the most precious asset whose value must be protected.

Don’t think of just using VCS for projects, start using it. Because it would be very hard and painful to maintain different versions of code. Not only for maintenance in case you want to compare a file in the tenth version to your first version, it will be like a hell.

But using a VCS like Git makes it very easy with basic commands. If you haven’t started, please start it right away. Check out more about VCS or GIT.

Git makes source-code maintenance very easy.

Do Not Copy and Paste Every Time

Many of us are used to do copy and paste work. We simply copy code from some other place like Google tutorials or Stack Overflow or any previously used classes and paste them where ever we require.

But doing it always is not a good habit. It’s from my own experience that I say that you should try to eliminate this stuff to the utmost possible.

I will explain how does this stuff impacts us from my experience. Until three years ago, I was used to doing these, I got the solutions and work delivered on time.

I didn’t know what was really going wrong until someone questioned me on these. What do we do if we get an exception or something to be written where you have no knowledge about them?

We just open our browsers then Google it, find the solution from Stack Overflow or any other site, and just copy it from there and paste it in our code. The same thing happened in the second, third, and so on situation.

Here, we are not gaining knowledge, we are just doing a data entry job that everyone out there can perform. But imagine the same thing if someone questions the same thing in your interview, then we realize we have done this but don’t know what we have done, which will result in a negative impact.

The solution to this is to write everything, every time. Don’t be lazy.

If we have a time constraint then doing this is fine but we have changed our development way like this. Try to write each and every line so that you can gain knowledge which may be helpful in interviews too.

Write everything every time don’t be a bot kind of thing.

Know What Is Going on Under the Hood

Having knowledge of how to do things is the first step in implementing a library or framework. But knowing what is going behind the scenes is also equally important but most of us do not give importance to the second part.

We mainly concentrate on the first part to get things shipped. As experience increases, the way we learn should also change. Nowadays, we see most of the interviewers delving into things rather than outer implementations.

As the experience number increases, we need to increase some additional weight of knowledge.

Having knowledge of what is going on under the hood is always for the greater good. Gain knowledge by knowing more.

Freelancing

As developers, we have a daily job to do but that alone doesn’t satisfy our hunger so we look for more things to do. One such thing was freelancing. We look for freelancing jobs on many sites but most of us end up doing nothing because we don’t get picked as we have no portfolios.

On the contrary, we might get picked for one or two minor projects which don’t give any fruits. So, do not get tired, try to get picked, create your space. Try with different sites.

If you have not succeeded in doing these then create your own freelancing job. Create your Play Store account, push out some apps with ads or in-app purchases, then do some social media marketing, get users so that your income stream will be created.

Now it’s your way as to how you would improve it.

No job is guaranteed so build multiple income streams from different sources.

Building Your Portfolio

Try not to keep all your efforts in your daily job. Build your profile, it is the only thing that matters.

For example, in an interview, there are two guys in the final round, one is a person who has graduated from an ordinary college like most of us and the second person graduated from a top university.

Then, who would have high chances of grabbing the position?

Obviously, the second one has the highest chances of getting it. But as experience changes, this will also change. Employers would look at your portfolio, not your colleges and percentages.

Your portfolio speaks about your capability of doing things, build it. Work with passion, build different streams to enhance your skills. Try different things like freelancing, mentoring, teaching, and developing, etc.

You may not succeed in all but you will succeed in one where you have great skills. Try different technologies, don’t stick to one. I was only working on Android for the last five years, nothing else, which was creating much more pain.

Try different things and find your expertise. A portfolio can speak a lot more than we think. As an app developer, in my opinion, we need to have a corner at the Play Store that demonstrates our expertise.

The right person will create opportunities rather than searching for them.

That’s all for now, hope you have enjoyed reading this article.

Please share some of your experiences that could be helpful to others.

Thanks for reading.