Do you want to start in Android development? I tell you my story.
Nowadays mobile development has increased a lot. You can read on the Internet about an old woman who developed her first mobile app for iOS or a kid that makes a living by developing games for Android. But, how did they start?
Around the world, there are a lot of institutes and universities that teach how to create mobile applications in just two months with a perfect certificated and may working when finishing the course. However, not all people can afford for these because Android courses can cost around $300 by month.
I entered in Android programming thanks to the Internet and tutorials. Now I work as an Android Developer in a smartwatches company. Let me tell you how I started.
Brief early story
On my childhood, I used to develop my own website using HTML and CSS, also, I liked that the people who used to visit my website have an account registered in it. I learned PHP with Dreamweaver (actually, I learned by reading the PHP and SQL code generated).
When I was 18 I wanted to create my own mobile application to allow students knowing each other by going to their Universities sharing their cars as carpooling. But I did not know how to do it! What did I do? I started to google it.
My first steps
I remember a YouTube channel of an Indian programmer who taught all Android components: from buttons and simple clicks to the filling of RecyclerViews getting information from a database using the Volley Library. But my early months weren’t like doing a lot of Android Studio small projects for every ‘lesson’. I applied all lessons to my in-development app of those times. While I was creating my first app, I was learning how to do specific things thanks to video tutorials.
Each thing I wanted my app have, I searched it on YouTube. I used to watch video tutorials because reading documentation was boring for me but over time you realize that it’s not so. In articles, readme files of sample codes or Android Developers documentation, you notice that there is information that video tutorials do not mention or they didn’t take it into account. Maybe if you’ve already been a couple of months in Android development you identify with this.
Based on trial an error, I learn many things on the Google Developer Console. It’s important to know that package names of applications must not change after you upload them to Google Playstore, it is like the ID of your app. Moreover, you must read how to sign your app and do not forget the release key .jks file you generate for uploading the application, if you lose it, you won’t be able to upload an APK file for updating the app. And don’t forget to up your versionCode number when trying to upload a new version in Playstore. You can download Tapme! from this link: https://play.google.com/store/apps/details?id=com.jflavio1.tapme.
In those times, I never cared about best practices like making unit tests to my apps, take advantage of the use of design patterns, the importance of use the debugging tool, know how much useful is the Android Monitor for avoiding memory leaks or take time for reading about android architecture and learn how it works. I was like a kid.
Today I’m working in a start-up as an Android Developer. I also have learned a lot here. I invest time on reading how different libraries work, android developers’ blogs and also, I wrote my own android library for managing Wi-Fi networks: WifiConnector.
Few weeks ago, I made what I consider a big step: compile Android Source Code from AOSP (Android Open Source Project), being sincerely, it took me about 5 business days. It’s incredible to learn how Android works and how it compiles apps.
Learn from your errors
This is so important, really.
You are going to be the same Junior Programmer if you use the last thing that worked.
Analyze your code and learn from others.
I remember I used to repeat buttons style in many different activities and fragments. This is so bad because when you want to change the style of the application, you have to find all your buttons and change them. My activities classes never inherited from a parent class.
This is a simple error that I realized with time and I tell them so that you don’t either.
Improve your code by checking seniors and professionals code in GitHub for instance, and compare your initial code style. This is why is so important to learn new things and analyze others code because you can watch how distinct people translate their ideas into code.
Best practices and recommendations
May be this is the most important part of the article. I do not consider me as an Android Senior Developer but I think with experience I have gained, I can write about what things I recommend and regard as useful for beginners so they do not fail in the same mistakes as me.
Do not start programming an app ‘crazy’. Take time writing the basic things you want your app do. Afterwards, put it on a cool design for finally develop it. This must not take you more than one or two hours.
Create parent classes and styles.
This is a good recommendation to implement. Having parent classes allows you to have control of all classes that inherits from them and makes your code easy to refactor and maintainable.
For example, if you are thinking about building a medium/large app, you could use this UML Diagram. In this case, we have SuperLoginActivity for all activities that are going to have the same behavior and styles for login screens. The same with SuperRegisterActivity. I create two more activity classes for swipes and button screens. Notice that upper activities are, essentially, abstract classes and does not have a xml resource. You could do the same with fragments and all you can imagine. As a little tip, the use of nomenclature for names could apply for everything, from variables and classes’ names to xml resources’ names.
Use a nomenclature for names.
As I mentioned before, you should use names that allow you to identify objects, resources, images, classes, and all of them just by typing some keywords. For instance, I use this nomenclature: <WHERE>_<TYPE>_<RESOURCE_NAME>. So, if I want to look for a button in a fragment I would type: loginFragment_btn_loginBtn.
Divide your packages by modules or classes types.
This could be useful in a future. There are two types of techniques for naming packages. If you name them by type, means that classes are going to be divided by their type, in other words, you can find all activities in one packages, all fragments in one package, all adapters in one package and so. On the other hand, if you name them by module means that you are going to divide classes by your app functionality, so in one package you are going to find classes, fragments, adapters and many others by classes types. However, when you learn about software architectures you can combine this knowledge to improve the package layout of your app.
Learn how to use the Android Monitor.
It’s important to know how to use this tool provided by Android Studio. May be not in order to become an expert but for identifying memory leaks and reduce your app RAM use thanks to Memory Monitor. Few months ago, I found a good article about this: http://www.theshiftingbit.com/Fixing-Memory-Leaks-in-Android-Studio.
Watch Android Performance Pattern Videos.
They are on YouTube and may are good resources for beginners. For example, for Memory Monitor: https://www.youtube.com/watch?v=7ls28uGMBEs.
Take a time to learn how android works.
Maybe you are not thinking to become an AOSP developer and create your own custom ROM, but knowing how this great platform works is a basic stuff you must read. Link with summary: https://developer.android.com/guide/platform/index.html.
Learn about software design patterns and architectures
There are many forms to develop an android application. As I mention few lines above, you can divide your app packages by functionalities modules or classes types but when you learn MVP (Model-View-Presenter), MVVD (Model-View-ViewModel) or Clean you will find that the first option will be considered inside the main package structure proposed by the architecture you have choosen. For example, Clean propose three main packages: model, domain and presenter. Your MVP package structure with activities, services, broadcast receives and fragments will remain inside the presenter package.
As a more advance development environment, you can modularizate your application: not only having the default ‘app’ module, but having the Clean Arch three main modules and compile each one independently for instance.
Learn about agile methodologies.
This is something you can find on the Internet very easy. Knowing the main tools of development like agile methodologies used by teams will serve you when you start to work.
Have a testing culture.
Every significant change you make, test it. Create a testing class for assure you are not breaking other functionalities.
Use a version control system.
This is so important if you find a job as a developer. GitHub for open source projects or Gitlab if you do not want anyone watch your code.
Learn from others.
As I mentioned on above section, learning from others code is very useful. You can compare how you do shape your ideas in contrast them. This could be applied for libraries source code; your knowledge increases a lot if you follow this recommendation.
The most important thing of all recommendations I could give to you. Do not limit you. Do not settle. If you develop some function then write it again in other way and compare which one works better, which one adapts to changes and allow you to make easy unit tests. Learn about multi-threading on Android, asynchronous processes and explorer many API’s just for curiosity.
Here I share some links that makes my life easier:
- Android Arsenal — https://android-arsenal.com You can find a lot of libraries here.
- Gradle Please — http://gradleplease.appspot.com If you do not know a library or support library gradle name, you can take a look at this site.
- Prabeesh R K YouTube Channel -https://www.youtube.com/channel/UCfQkNueQenRQQ1NnCBe6eQQ My first steps were thanks this Indian programmer. Very useful staff.
- Udacity Course Videos: Developing Android Apps — https://www.youtube.com/watch?v=2Wo_QfQZ0lE&list=PLAwxTw4SYaPnMwH5-FNkErnnq_aSy706S Playlist of the Udacity course offered by Google.
- Android Developers — https://developer.android.com/index.html?hl=es A lot of information could be found here.
- Android Developers Blog — https://android-developers.googleblog.com If want to be in contact with lasted news for developers.
- Try Git — https://try.github.io/levels/1/challenges/1 Perfect tutorial for learning git.
If you are a beginner or are thinking on starting in this world, I hope this article could help you. I am not a professional android developer with 5 years of experience, I’m like you, a developer that wants to learn more and more.