In this article, I’ll give you exactly what you should know when starting to develop Android. These tips will help you learn to develop Android much faster than you are fiddling with figuring out what to learn first. So let’s get started on it! Let’s go
1. Java vs Kotlin — Which one should I learn first?
One of the first dilemmas you will face in the beginning is whether you should learn Java or Kotlin first. First of all, you can calm your mind by realizing that this question really doesn’t matter in the long run. Both Java and Kotlin can be used to develop Android apps. Both languages are easy to learn and once you know one, learning the other becomes simple. However, there are benefits and limitations to each language. I will list those and let you decide which one you want to learn first.
First, we will talk about Java. Here are the benefits of it:
- Java is a very well known and widely used object-oriented programming language. Thus, knowing Java will not only help you to understand many applications, not just Android applications.
- Java is fairly straightforward and probably a great choice for your first programming language. (Every school teaches Java)
- Java has been around for a long time, so this language is much more mature than Kotlin (Kotlin is still very young, only 10 years old).
- Java is the de facto standard for learning OOP. Learning the design pattern will be very simple if you know Java.
- Java will help you better understand the JVM
But everything has two sides, Java also has its disadvantages. Here are a few of them:
- A lot of Java code is ” boilerplate ” code. In other words, those are essential for your code to work, but have little to do with the actual logic of your code. This results in duplicate code and is difficult to change if you are not careful.
- Java is quite a wordy language. Most of your code needs to be explicit, which is what causes boilerplate creation. (There are also a lot of people who like the obvious java)
There is very little code in the Kotlin version, there are a lot of different situations where Kotlin code is more expressive and neat than Java code.
So that’s a few of the features of Java. Now let’s talk about Kotlin:
So like I said, Kotlin code is more compact and less verbose than Java code. That’s just one advantage of Kotlin over Java:
- Kotlin is currently the language where most new apps are being developed, and Google itself recommends using it. That means you will be updated. This is the main reason you might want to learn Kotlin first.
- In my opinion, Kotlin is somewhat easier to learn than Java, although Java is also quite easy to learn. However, I know Java before Kotlin, so the transition is pretty easy in some ways.
- Kotlin has a lot of syntax for reducing line length.
- Kotlin integrates seamlessly with Java so you don’t need to learn Java to use Kotlin.
- Kotlin has more helper classes and the overall structure is easier to use than Java.
- Kotlin does an excellent job of getting rid of null values and checking nulls from your code. This is probably one of its greatest advantages.
- Kotlin code is everything Android, IOS (kotlin multiplatform mobile), Web (ktor), Desktop App, …
My opinion on what you should learn first
So what is my opinion about learning first? Remember, this has little effect on your long-term path. But if I had to choose one, I would say Java). Simple Java is so popular and widely used, you will appreciate that you learned it while looking at the
code samples .
Plus, once you get the hang of Java, you’ll be able to learn Kotlin in less than a week. We can’t say that when we first learned Kotlin.
And on a side note, one of Kotlin’s biggest advantages – the reduced detail and length of the show, is also one of its biggest downsides. Why? You might think the reduced length is always great, but if you learn Kotlin first, the problem happens when you don’t understand why Kotlin was invented. In other words, you won’t understand the weaknesses of the old draft and the length of Java that lead to Kotlin creation – if you learn Kotlin first. This can lead to you doing things incorrectly if you learn Kotlin first.
Learning Java firstly establishes a great base for you to build your knowledge on. Learning Kotlin first makes sure you are up to date. But in the end, it really doesn’t matter that much. I think Android developers should be fluent in both languages. This is quite similar to the question of whether to learn C or python first and you know what your opinion will be.
2. Learn the right resources
There are tons of Android developers out there – and not all of them get it right. It is important that you learn from the right sources, otherwise you may actually be studying detrimental material.
My favorite platforms for learning Android-related content are Google Codelab and Doc. You might like something like Pluralsight, Skillshare or Udacity, Udemy No matter what platform you like, I recommend looking for some high-quality premium material. When you find a critically acclaimed course on the topic you want to study, I recommend checking the release date of that course and making sure that the course is recent. At the same time as many stars as possible. The free courses are not as appreciated as the paid courses, of course it will have something more valuable than the free online. While knowing these are obvious advice, many highly regarded courses, such as Udemy, are outdated but prized for their age. So you need to consider carefully when buying a course. Because there are many locks for a long time, there will be many parts that are not updated compared to the present. In 2016 2017, you should consider ignoring it.
Make sure you are learning relevant, up-to-date material. A few lists of your favorite instructors are on Udemy and YouTube so you can start learning quality content quickly.
3. Learn with the latest versions of Android
As I said before, it’s important for you to learn about the latest version of Android. Why do I emphasize this simple tip? The main reason is simple. Only in the latest Android versions, Google has finally promoted good design methods, such as MVVM architecture and databinding. These technologies and architectures are not new, but traditionally they have been complex or even impossible to implement in Android. As such, many old courses will teach you old technologies and hence bad methods, hacking, and workarounds to dirty your code. Strictly speaking, try to be aware of what you should learn and avoid those old practices as much as possible.
4. Make sure you understand Lifecycles
After you learn the language of your choice and understand the basic components of the Android framework, you need to start understanding the lifecycle and how they work.
There are three main life cycles that should be considered – app lifecycles, activity lifecycles, and fragment lifecycles. Knowing these lifecycle helps you in two ways:
1. The life cycle is the foundation for everything in Android development.
You will use
onCreateView() in every fragment and
onCreate() in every activity . But
onCreate() for a fragment and
onCreate() for a very different activity . These kinds of nuances you will only learn by learning how acitivity and fragment life cycles work.
2. You will have less errors and memory leaks .
A classic example is observer living longer than its listeners, resulting in accidental
NullPointerExceptions . This happens when you forget to unsubscribe your listeners in
onStop() or you use something like
LiveData (its auto lifecycle management) incorrectly. These errors can wreak havoc on your code base and cause hours of screen swearing and want to instantly smash your computer (don’t do so). =))
5. Know the principles of SOLID
If you are a beginner, you can skip this section. But if you know Java and can create a few simple apps, here’s what you’ll want to learn next. Not long ago, I did not think that it was so important or beneficial to know SOLID principles and design patterns. I was wrong.
A lot of self-taught programmers think that the technology they’re using is the most important thing to learn. They don’t go wrong – you need to know your tools. But what do tools and libraries actually do for you?
They speed up your development, that’s all. They do not introduce new concepts of software design. Simply put, you should know why the tools you use exist. I want to say that this is even more important than learning the tool itself.
For example, you shouldn’t learn Dagger 2 without first learning about
inversion of control ,
dependency injection and maybe even do some
dependency injection by hand .
Then, and only then, should you learn Dagger 2. Once you know why Dagger 2 exists and the concepts based on it, you will be able to learn it much faster.
Deep down, SOLID design principles are the fundamentals for almost everything modern software developers do.
For example, the
dependency inversion – the letter “D” in SOLID – is the whole reason why Dagger 2 exists. If you don’t know SOLID and you are using Dagger 2, you won’t know what the framework is actually doing.
So I highly recommend you learn the basics of SOLID design principles. If you don’t do it now, you’ll definitely learn it later. Every software developer should know these principles.
6. Know the basic Design Patterns
Again, if you are a complete beginner, you can skip this section.
As you gain more experience coding, you will find that certain patterns emerge a lot. This is no coincidence. There are about 23 major design patterns that have been built up from the countless hours of experience and failure of thousands of programmers over the years.
Yes, it can be said that it is the secret of martial arts in the world, absorbing it is like you have the Nine Sounds of Truth to proclaim in the world =))
The main benefit of these desgin patterns is communication. Here are designs you should probably know:
Observer pattern(because it’s everywhere. When you need to communicate from object to object, this is your pattern). You want to learn Rx, please know about this.
Adapter pattern(to understand
Facade pattern(to understand third-party APIs and why they are structured as such)
7. MVVM, MVC, MVP, or MVI – Which is the Best Architecture?
One question that I encountered when I first started learning Android development was “What architecture should I use for my apps? Which one is best? ‘ Putting everything into MainActivity will not work for long, so a good architecture is indispensable.
The short answer is: MVC or MVVM.
The long answer is basically these patterns consisting of almost exact ideas. They are just done in slightly different ways. The best architecture is the one that is relevant to your application and how users will interact with your application. However, if you really want to know what you should learn first now, here are my recommendations. But since they are so similar, which one you learn first is very important
Personally, I now think MVC is something you should probably learn first – simply because it’s widely known and it lays the foundation for other architectures.
But if you don’t have a lot of time to learn new content, then MVVM is Google’s recommended architecture and it’s similar to MVC, with some changes. Learning it will allow you to dive into the Android documentation and understand a lot of the code there. Until recently, MVVM is my favorite architecture.
Then there are lesser known architectures.
- MVP is basically MVC with a few minor differences.
- MVI is another spin of the MVC architecture, but can be tricky – you shouldn’t get to know it first
- Any other architectural model is probably something you shouldn’t care about. These 4 patterns are well established and if implemented well it will generate clean code.
8. What technologies should I learn?
Here’s another question that annoyed me when I first started. After knowing the basic Android framework, what technologies should you learn? Oh, there’s a ton of technology and it’s really messed up in that maze. If you get lost in this maze, you have to be really awake, not lose your body in that maze.
After developing the app for a while, I came to the conclusion that maybe you should focus on learning the specific technologies that I will show you here. Keep in mind that almost all of these libraries are widely used by the Android community, and you will likely go through them at one point or another:
- Basic AndroidX Library (constitutes Android Jetpack)These libraries are the core of Android functionality, and most of the things you’ll use from here will be UI components. Remember that AndroidX is actually a rewrite of the Android support library.
- Room Persistance LibraryWhen you need offline storage, you often use SQL to get content from an offline database. Room will help you do this much faster, by helping you create neat entities, DAOs, and all kinds of technical content.
- Google FirebaseFirebase (especially CloudFirestore) is simply my favorite cloud database at the moment, so this is likely to change. But if you want a solid cloud database, you can’t ignore Realtime Database or Firestore for Android.
- Retrofit (Okhttp) Nearly every developer will need to work with RESTful APIs at some point in their career. Retrofit is the standard library for everything REST in Android. If you are writing networked applications, knowing Retrofit – and therefore REST – is a pretty big requirement for many applications.
- Dagger -> Hilt (Koin)Dependency injection is an important rule for building good Android apps. Dagger is the standard way to do this faster than creating your own dependency injection component. It is widely used and will likely be encountered soon. Recently Hilt was introduced and strongly supported by Google. Learn it. It’s a bit difficult but if you use kotlin then you can use Koin – simple and fast
- RxJava, RxKotlin, CorountineRxJava is an interesting library. The main purpose is to make it easy to generate asynchronous code that runs on background strings and returns asynchronous results. It is used in many Android applications, so you need to know the basics of RxJava before reading the code of these applications. Coroutine is exclusive to Kotlin, but using it is quick and easy to understand. When the train is fast, I play with Kotlin and overnight on Java. (Damn it)
- Glide (Coil)Glide is a popular image loading gallery, complete with built-in caching. It is quite easy to use and is used by many Android developers. You can also refer to Coil (Kotlin’s pet).
- Mockito, MockK or some mock injection service for unit testing.I will talk more about this in tip 10.
- Gradle / Maven build automation systemsThe reason behind this is simple. You don’t need to know much about Gradle or Maven, but you should know enough to use libraries and dependencies when needed. Just search for anything you don’t know on Google and you’ll probably get a good answer.
9. When can I call myself a good Android Dev?
This question will cause you to struggle for a long time.
But if you want, in my opinion, a capable Android developer understands the following:
- The importance of architecture and design well suited to your problems.
- The importance of TDD.
- The technologies mentioned in the previous tip.
- Data structures and algorithms
- How to communicate your problem clearly and the importance of regular communication.
- It’s important to keep learning and interacting with other Android developers.
Anything else ! Let me know if you have something else you want to add to this list.
10. After completing Basic, start Unit Testing
Lastly, I want to leave you with one of the best practices that you can start with after learning Java, Kotlin, Android framework and the technologies in tip # 8 – Unit Test. Unit Test has many benefits. I will outline a few of them.
Single responsibility principleis enforced when you unit test properly.
- You can change your code more confidently because you are protected against “regression” or the quality of the code decreases when you change the code.
- You validate that your code does what it should.
Almost always, you will unit test using TDD, test driven development although it is also very difficult. This is a technique that “Uncle Bob” -Martin favors and his book- Clean Code will help you understand why you should use it (read it, great) Finally, when you are Understand the basic principles of unit testing, you should try to learn Mockito for Java unit tests or MockK for Kotlin unit tests.
These libraries help you create “simulations” for testing that can significantly speed up your development time. While this is great, you will understand the concepts of TDD much better if you have some experience doing tests without them.
If you want to be good at something, you really have to like it, have fun with it! It is important that you enjoy learning all of this interesting stuff. Don’t stress about it or try to go too fast. You will not keep good information if you do. And finally, maybe you should start writing and constantly updating a blog where you talk about what you’ve learned.
This is the classic method and it will help you strengthen your communication skills in addition to your technical skills. It will also help you interact with other developers. All of that is exactly what I do hereSo feel free to leave your thoughts and opinions in the comments section below.
Thank you for your attention. Article translated from Medium plus its cooking. We hope everyone is interested.