Programming in Android: 15 things I’ve learned while building an app

It took me a lot of effort, time and sweat before I have successfully developed an App. Although I have an experience in Java programming. Still, It was not easy for me to learn this platform. I still remember the day back in 2013 when I started to develop my first Android application for our System design and development course. We came up with the idea of creating a simple mobile app where we can utilize the possible features that could run on an android device. We have no idea.

Technically, our Android app consists of multimedia elements such as text, photos, audio, and video presentation to make the application user-friendly and easy to understand, the core functionality is all about augmented reality which the real-world environment is augmented by computer-generated sensory input. The user can search for the hospital nearby through the point of interest (POI).

FROM THE SCRATCH

It’s very difficult for me since developing an android application is not included in our syllabus. Even creating a simple design in XML is really challenging. A new paradigm. I have to adopt this technology and I have to study it from the scratch. It was totally self-taught. What we’ve learned from the school may not be applicable in the real world. You have to improve your skills each and every day, especially in our chosen field. It has been three and a half years now since I started to develop an Android app, and it was one of the best decisions I ever took in my college life.



I remember the time when I’ve successfully developed my first app. The feeling when you did something great is a feeling of accomplishment. But before I learned the skills I have today, I did a lot of mistakes and wasted a lot of time experimenting without any assurance of success.

SLEEPLESS NIGHT

Later on, our department formed a group of student that will compete and develop an app for the Philippine commission on Women( Magna Carta of Women)  and luckily, I’ve been a part of that group that represents our department. It was all started there. Like what I’ve said, developing an app is really hard, what more in a tight deadline? We developed the app for less than a month. All of us has no solid foundation in mobile development. We are all a newbie that time plus a pressure knowing that students from prominent colleges and university are our competitor.

I am in charge with the UI Design and other functionality of the app. As the day draws near the deadline, we become more and more stressful. No neurons die in our brain each day passed by. We were developing for almost 24/7 and I still remember one time I was awake for almost 34 hours.  Brainstorming, engineering, coffee, and energy drinks are our great companions. That experience helped me to improve my logical thinking and programming skill…A little bit. 😀

I have learned so many things in the past 3 years developing an app for both iOS and Android platform. I’ve learned different techniques, programming approach and most importantly, I learned what to do and what NOT TO DO. 

So, I will share some tips that I’ve learned from my 3 years working experience in the mobile platform.

FIRST: READ, READ, READ

The more you read, the more things you will know.

Basically, reading is the key to learning.

Read tutorials, guide, and tips on how you can improve your skills in Android development. This is one of the best things to do regardless if you are a newbie or an expert already, but don’t just read all day, you have to do it yourself also.

You can read tutorials all day but you’ll only improve by doing.

For newbies out there, I would suggest visiting AndroidHive, it is also one of my favorite tutorial websites back then. You can learn Android development from the basic to advance through Ravi Tamada’s tutorials –  the owner of AndroidHive. I still remember the time when I was just a beginner in Android development, I’m having a problem with my task to the point that I can’t even understand and I don’t know what I’m doing. Luckily, I found a tutorial from AndroidHive and it really saved me a lot of time.

Just to name a few, here’s a list of great websites to leverage your Android Development skill

The key secret to success is not excessive expertise, but the ability to use it. Knowledge is worthless unless it is applied. — Max Lukominskyi     

***************************** PLEASE CONTINUE READING *****************************

DO NOT REINVENT THE WHEEL

There are tons of open source library in GitHub for you to use for free. Do not reinvent the wheel unless you are creating a custom framework or a library to be used by other developers.  You don’t need to make it yourself if there is someone who has been already solved it before.

I reinvented the wheel last week. I sat down and deliberately coded something that I knew already existed, and had probably also been done by many many other people. In conventional programming terms, I wasted my time.

If you’re struggling to develop your app or you are having a problem solving a certain task, try to explore some third-party libraries. It will also help you to speed up your development.

Here is the list of open source libraries that I use as references.

I also use Libraries for developers app. I use this app every time I’m looking for a library that I can use on my project. This app provides a collection of third party libraries, as a developer this application is essential for you. You will have information about the author, captures, license, description, links to the library and you can try a working example within the application. You can download the app at this link

You can also check Android Arsenals, you can find a variety of library on that site.

Aside from these libraries, there is a collection of pre-made Android apps which are also open source. Visit this link

Tips:  Focus more on the core business logic of your app.

LEARN TO ЯƎVƎЯƧƎ ENGINEER

The best way to learn new software is to reverse engineer.

“Whether it’s rebuilding a car engine or diagramming a sentence, people can learn about many things simply by taking them apart and putting them back together again. That, in a nutshell, is the concept behind reverse-engineering—breaking something down in order to understand it, build a copy or improve it.” –Computerworld

If you really don’t know how things work, try to break it and learn from it.

STACKOVER FLOW IS YOUR FRIEND

Have you ever been stuck in a particular task even if you think you’ve given all of the best you can give but still you can’t figure out how to solve it? It is very frustrating sometimes, isn’t it? I experience this scenario always. If ever you got stuck in a certain problem or bugs that you can’t solve right away, try to ask some help from other developers, maybe they have already experienced your problem before and maybe they can help you out in your problem.

Even Google, Facebook, Twitter, Amazon and other engineers from a tech giant companies use StackOverflow. Although these tech giants have an internal code search specific their tools, API or some other mechanism that is only available internally to their product. They still use StackOverflow for some errors and issued related to the code which they might be using.  It doesn’t mean they know everything, they are humans too like us. Some tech giant engineers also use StackOverflow either for asking a question or answering a question asked.

If you don’t know the answer to a problem, try to search on the internet, but don’t just rely on other questions, you can also post your own question in StackOverflow.

Some IT companies are also asking for StackOverflow reputation. Anyway, what is StackOverflow reputation?


What is StackOverflow reputation? How do you earn (and lose) it?

Reputation is a rough measurement of how much the community trusts you; it is earned by convincing your peers that you know what you’re talking about. Basic use of the site, including asking questions, answering, and suggesting edits, does not require any reputation at all. But the more reputation you earn, the more privileges you gain. – StackOverflow

The primary way to gain reputation is by posting good questions and useful answers. Votes on these posts cause you to gain (or sometimes lose) reputation.

Stack Overflow is the largest, most trusted online community for developers to learn, share their programming knowledge, and build their careers.

Visit my profile here

JOIN ANDROID SLACK CHANNEL

Aside from StackOverflow, you could also ask for some help through  Android United slack channel. Android United is a friendly Slack community of professional Android developers.

If you want to join the community, you can use this form to request an invitation.

COMMIT AND PUSH: START USING GIT

I wish I knew this tool when I was in college. I still remember when we were developing the app for Magna Carta for women. We used to copy the entire code, save it to a flash drive and combine it manually through the IDE. Sounds uncool right? hahaha

Git is a very helpful tool, especially for team collaboration. Basically, Git is a version control system for tracking changes in computer files and coordination work on those files among multiple developers. It is primarily used to manage the source code through a cloud repository(GitHub, Bitbucket, GitLab, to name a few).

To know more about Git visit:

OBFUSCATE THE CODE – USE PROGUARD

If you have successfully developed an App and you need to submit it to the PlayStore, please don’t forget to implement Proguard in your Gradle configuration. Proguard is the best tool for securing your source code. It provides minimal protection against reverse engineering by obfuscating the names of classes, fields, and methods. It will also minimize your app to 90% smaller. It is 100% free and available to the Android SDK.

Check Proguard here

LEARN DESIGN PATTERN AND PRINCIPLES

In an object oriented software development, there are 23 design patterns which can be classified into three categories: Creational, Structural and Behavioral patterns. Design patterns are solutions to general problems that software developers faced during software development.  It is also used for solving technical problems in a way that has proven itself many times.

I’ve implemented Singleton, Adapter, Builder, Factory Method, Callback, and Facade pattern in my app before. Honestly, I can’t memorize all of these patterns but it is very important for a developer to know at least basic and how things work. You don’t need to memorize all the code, all you need to know are the principles.  Here is a list of design patterns which is implemented in Java that may help you to jump in.

You can check this link to know more about different design pattern.

CHOOSE PROPER ARCHITECTURAL PATTERNS

The architectural pattern has a big difference from the design pattern. Technically, an architectural pattern is strategic while the design pattern is tactical.  Meaning, the architectural pattern is more on solving software application architecture problem while design patterns are well known for solving a  specific type of problem and it is a general reusable solution to a commonly occurring problem in software development.

Architectural patterns refer to a much broader or large structure of a system and an overall organization of code.

Why care about CHOOSING the right Architectural pattern?

Because choosing the right architectural pattern is the answer for your darkest code fixing and debugging days. Choosing the right architectural pattern will help you to avoid a problem that developers commonly faced during debugging and unit testing. Without choosing a right architectural pattern, your controller will tend to be a bloated class executing different things. Testability is the first features that right architectural pattern could offer.

The examples of architecture pattern might be MVC, MVVM, MVP, and etc.  So, the question is, what architecture pattern would be the best to use when developing an android application?

MVC has three components – The view(or the interface of the app), Model( the data that the view is displaying), and the controller( which contains a business logic of the application). In MVC, the view communicates directly with the model. The controller serves as a logic layer and gets notified when an event happened from the user action from the view while in MVP, the view knows nothing about the model and the presenter would act as a middle man for the view and the model. The presenter is the responsible for managing a task and updating a model to be displayed in the view.

I haven’t used MVVM before but In my own opinion, research and analysis, MVP pattern do a better job than MVC since MVP it is more testable and it is far less costly in terms of maintainability.

  • MVC stands for Model – View – Controller
  • MVP stands for  Model – View – Presenter
  • MVVM stands for Model – View – ViewModel

If you like to learn more about implementing MVP or MVVM in your project, I’d encourage you to check out the Android Architecture Blueprint. The Android Architecture Blueprints project demonstrates strategies to help solve or avoid these common problems. This project implements the same app using different architectural concepts and tools.

Another project that I followed when I started to learn MVP was the Android MVP sample project by Antonio Leiva.

Anyway, each of these approaches has their own advantages and disadvantages. So, please do your own research. There’s a lot of resources available on the internet that might help you to start learning the architectural pattern.

USE PROPER CODING STANDARDS AND LEARN PROGRAMMING BEST PRACTICES

Always pay attention to your coding style. Another developer might inherit your code as soon as you leave the company. Your code will also represent what type of developer you are. As much as possible, follow the proper coding standards. It is also better to know where and when to use conditional statements. Some developers are abusing the used of if else which tend into something like indented “Hadouken code“.

You are a developer and you are not a culinary expert, so please don’t practice writing something like “spaghetti code.

Tips: You can follow this link for a proper coding style and guidelines.

ASK FOR FEEDBACK

If someone told that your code is ugly, your system or app has a lot of bugs or someone told you that your development skill is not good enough.  Take it as a positive not a negative. Always strive for excellence. Treat it as Constructive criticism. It will help you to enhance and improve your works, knowledge, ability, and skills 99.9% of the time. Just learn from your mistakes. There is always a room for improvements. There is no such thing as a bug-free software.

CHOOSE LOW-END DEVICES

For starters, when you develop an Android application, you should prepare it to be run on a wide variety of devices and circumstances. Testing an app into low-end devices is much better than testing it on high-end devices. Why? It’s because high-end devices would hide and cover the system flaws and error in your app especially memory leaks since high-end devices have a greater specs than the low-end device. It is also easy to track where your app crashed in low-end devices than a powerful one.

IT’S OKAY TO COPY AND PASTE A CODE

It’s okay to copy and paste a code, but copying a code from StackOverflow without learning and understanding it, is not okay.



When I say “It’s okay to copy and paste a code” I mean just a snippet of a code, not a whole project.

LEARN BASIC RESTful API and SERVER- SIDE SCRIPT.ING

It is also necessary for an Android developer to know at least how the data flow and communicate from the client to the server. As an Android developer, it would be advantages for you to know how to make your own Application programming interface(API) or how to setup a server.

I’d also encourage you to check out Google Firebase, it is a platform where you can actually deploy and setup your own API. It also provides a real-time database and backend as a Service. The service provides application developers an API that allows application data to be synchronized across clients and stored on Firebase’s cloud.



You can also follow this comprehensive guide how to build a simple REST API in PHP from the CodeoftheNinja.

SHARE YOUR KNOWLEDGE

I really love to share my ideas and knowledge to others because it gives me happiness and I learn in the process as well. Sharing your knowledge to others also increases your professional value. Helping people in your area of expertise allows others to build a better future.

I hope you learned a lot of things on my list 🙂


Good things come to those who wait 

Good things come to those who work their asses off and never give up

Don’t forget to share to your colleagues or other social media so others may benefit as well ?

Anyway, I am also the developer of the Baybayin app. Download it here

Follow me on IG:

https://instagram.com/vidalbenjoerivera

If you found errors, email me at [email protected]

4 thoughts on “Programming in Android: 15 things I’ve learned while building an app

  1. Learned a lot. Thanks for sharing 🙂

  2. Great! Key notes are there, complete and precise!
    Thank you kuya benjoe 🙂

  3. Thanks for sharing your experience. 🙂 i learned a lot and relate to the things you mention. 😀

  4. This is so helpful. Thank you

Leave a Comment

Your email address will not be published. Required fields are marked *