了解android开发_开始Android开发时应了解的11件事

了解android开发

In this article, I’m going give you exactly what you should know when starting Android development.

在本文中,我将为您提供开始Android开发时应了解的确切信息。

These tips will help you learn Android development much faster than if you were floundering around trying to understand what to learn first.

这些技巧将帮助您更快地学习Android开发,而这比您试图了解首先要学习的知识时要费劲。

So let’s get right into it!

因此,让我们开始吧!

1. Java vs Kotlin-我应该首先学习哪个? (1. Java vs Kotlin — Which Should I Learn First?)

Image for post

One of the first dilemmas you’ll be faced with as a beginner is whether you should learn Java or Kotlin first.

初学者会遇到的第一个难题是您应该先学习Java还是Kotlin。

First of, you can ease your mind by realizing that this question isn’t actually all that important 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 language, it’s trivial to learn the other.

Java和Kotlin均可用于开发Android应用程序。 两种语言都很容易学习,一旦您知道一种语言,学习另一种语言就变得微不足道了。

However, there are benefits and drawbacks to each language. I’ll list those and let you decide on which one you want to learn first.

但是,每种语言都有优点和缺点。 我将列出这些内容,然后让您决定要首先学习哪个。

Java (Java)

First up, I’ll discuss Java. Here are its benefits:

首先,我将讨论Java 。 这是它的好处:

  1. Java is a very well known and widely used object-oriented programming language. As such, knowing Java will not only help you to understand many applications, not just Android apps.

    Java是一种非常著名且广泛使用的面向对象的编程语言。 因此,了解Java不仅可以帮助您理解许多应用程序,而不仅仅是Android应用程序。

  2. Java is pretty straightforward to understand, and is probably a great choice for your first programming language.

    Java非常容易理解 ,对于您的第一种编程语言来说,它可能是一个不错的选择。

  3. Java has been around for a very long time, so the language is a lot more mature than Kotlin.

    Java已经存在了很长时间, 因此该语言比Kotlin成熟得多。

  4. Java is the de-facto standard for learning OOP (object-oriented programming). Learning design patterns will be very simple if you know Java.

    Java是用于学习OOP(面向对象编程)的实际标准。 如果您了解Java,学习设计模式将非常简单。

  5. Java will give you a better understanding of the JVM (the Java Virtual Machine).

    Java将使您更好地了解JVM(Java虚拟机)。

But as with anything, there are downsides to Java. Here’s a few of those:

但是与其他任何东西一样,Java也有缺点。 以下是其中一些:

  1. A lot of Java code is “boilerplate” code; in other words, it’s code that’s necessary for your code to work, but has little to do with the actual logic of your code. This results in duplication and hard-to-change code if you aren’t careful.

    许多Java代码是“样板”代码 ; 换句话说,代码是代码正常工作所必需的,但与代码的实际逻辑关系不大。 如果您不小心,则会导致重复且难以更改代码。

  2. Related to the last point, Java is a rather “verbose” language. Most of your code needs to be explicit, which is what causes boilerplate.

    与最后一点有关,Java是一种相当“冗长”的语言 。 您的大多数代码都必须是显式的,这才是样板。

Here is a simple code example to show what I mean in point #2. This is how you declare an object variable in Java. Let’s say it’s a car object:

这是一个简单的代码示例,以显示我在第二点中的意思。 这就是在Java中声明对象变量的方式。 假设这是一个汽车对象:

Car myCar = new Car();

Doesn’t seem like a lot of code, I know. But here’s the same thing in Kotlin:

我知道,看起来好像没有很多代码。 但是Kotlin的情况与此相同:

val myCar = Car();

There is very slightly less code in the Kotlin version, so you may not think this is a big deal. But there are a lot more different scenarios where Kotlin’s code is more expressive and leaner than Java’s code. After a while, these differences add up.

Kotlin版本中的代码少得多,因此您可能不会认为这没什么大不了的。 但是在许多不同的场景中,Kotlin的代码比Java的代码更具表现力和精简性。 一段时间后,这些差异加起来。

So that’s pretty much it on Java. Now let’s discuss Kotlin.

在Java上就差不多了。 现在让我们讨论一下Kotlin

Kotlin (Kotlin)

So as I’ve said, Kotlin code is more compact and less verbose than Java code. That’s just one advantage of Kotlin over Java. Let’s look at the others:

因此,正如我已经说过的那样,Kotlin代码比Java代码更紧凑,更简洁。 那只是Kotlin相对于Java的优势之一。 让我们看看其他的:

  • Kotlin is now the language that most new apps are being developed in and that Google themselves recommend. Knowing it means you’ll be up-to-date. This is the primary reason you might want to learn Kotlin first.

    现在,Kotlin是大多数新应用程序的开发语言,也是Google自己推荐的语言。 知道它意味着您将保持最新状态。 这是您可能首先要学习Kotlin的主要原因。

  • In my opinion, Kotlin is somewhat easier to learn than Java, though Java is pretty easy to learn too. However, I knew Java before Kotlin, so switching was very trivial for me.

    在我看来,Kotlin比Java更容易学习 ,尽管Java也很容易学习。 但是,我在Kotlin之前就知道Java,所以切换对我来说是微不足道的。

  • Kotlin has a lot of syntax sugar to decrease verbosity — we already delved into this somewhat.

    Kotlin有很多语法糖可以减少冗长 -我们已经对此进行了深入研究。

  • Kotlin seamlessly integrates with Java so you don’t have to learn Java to use Kotlin.

    Kotlin与Java无缝集成,因此您无需学习Java就可以使用Kotlin。

  • Standard Kotlin has more helper classes and an overall easier-to-use structure than Java .

    与Java相比, 标准Kotlin具有更多的帮助器类和整体上 更易于使用的结构。

  • Kotlin does a pretty great job at eliminating null values and null checks from your code. This is probably one of its biggest advantages.

    Kotlin在消除代码中的空值和空检查方面做得非常出色。 这可能是其最大的优势之一。

我对你应该先学什么的看法 (My Opinion on What You Should Learn First)

So what is my opinion on which to learn first? Keep in mind, this opinion really has rather little effect on your long term success.

那么,我对首先学习哪个有什么看法? 请记住,这种观点对您的长期成功影响不大。

But if I had to pick one, I’d say Java. Java is simply so well-known and widely used, you’ll appreciate that you learned it when you see code samples.

但是,如果不得不选择一个,我会说Java 。 Java是如此著名并且被广泛使用,当您看到代码示例时,您将了解到它是您所欣赏的。

And plus, once you do grasp a good understanding of Java, you should be able to learn Kotlin in less than a week. I can’t say the same for learning Kotlin first.

而且,一旦您对Java有了很好的理解,您应该可以在不到一周的时间内学习Kotlin。 对于第一次学习Kotlin,我不能说相同的话。

And on a side note, one of Kotlin’s biggest advantages — decreased boilerplate and verbosity, is also one of its biggest disadvantages. Why?

顺便提一句,Kotlin最大的优势之一 -减少样板和冗长,也是其最大的劣势之一 。 为什么?

You might think decreased verbosity is always great, but if you learn Kotlin first, the problem comes when you don’t understand why Kotlin was invented.

您可能会认为降低冗长度总是很棒的,但是如果您首先学习Kotlin,那么当您不了解Kotlin的发明原因时就会出现问题。

In other words, you won’t understand the downfalls of Java’s old boilerplate and verbosity that lead to the creation of Kotlin — if you learn Kotlin first. This may lead to you doing things improperly if you learn Kotlin first.

换句话说,如果您先学习Kotlin,您将不会理解Java的旧样板和冗长的失败导致Kotlin的创建。 如果您先学习Kotlin,这可能会导致您做事不正确。

Learning Java first establishes a great base for you to build your knowledge from. Learning Kotlin first ensures you’ll be up-to-date.

首先,学习Java为您建立基础奠定了良好的基础。 首先学习Kotlin可确保您保持最新状态。

But in the end, it really doesn’t matter all that much. I think Android developers should be fluent in both languages.

但是最后,这并没有多大关系。 我认为Android开发人员应该精通两种语言。

2.向正确的来源学习-最好是付费的 (2. Learn From the Right Sources — Preferably Paid)

There are a lot of Android developers out there — and not all of them do it right. It’s crucial you learn from the right sources, or you could actually be learning detrimental material.

那里有很多Android开发人员-并不是所有人都做得很好。 从正确的来源学习非常关键,否则您实际上可能正在学习有害的材料。

My favorite platform for learning Android related content is Udemy. You may prefer something like Pluralsight, Skillshare, or Udacity.

我最喜欢的学习Android相关内容的平台是Udemy 。 您可能更喜欢Pluralsight,Skillshare或Udacity之类的东西。

Whichever platform you prefer, I recommend you do find some high-quality paid material. When you find a highly-rated course on the subject you want to learn, I recommend you check its release date and make sure it is recent.

无论您喜欢哪种平台,我建议您都可以找到一些高质量的付费资料。 当您找到想要学习的主题的高评价课程时,建议您检查其发布日期并确保它是最新的。

Many times we don’t value free courses as much as paid courses, so we never finish the free courses. That’s why I say to take paid courses if you’re serious about this.

很多时候,我们对免费课程的重视程度不如付费课程,因此我们永远不会完成免费课程。 这就是为什么我说如果您对此很认真的话要选择付费课程。

I know these are obvious tips, but there are a lot of highly-rated courses on say, Udemy, for example, that are outdated but highly-rated because of their age.

我知道这些都是显而易见的技巧,但是例如,有很多评价很高的课程,例如Udemy,这些课程已经过时,但由于其年龄而受到好评

Don’t go for those. Make sure you are learning up-to-date, relevant material. And if you need to learn Kotlin first to do that, then go right ahead.

不要去那些。 确保您正在学习最新的相关材料。 而且,如果您需要先学习Kotlin才能做到这一点,那就继续吧。

I don’t have much experience with platforms other than Udemy, so I can’t really comment on the best practices for those platforms. I will simply insert a list of my favorite instructors on Udemy and YouTube so you can start learning quality content fast.

除了Udemy之外,我在其他平台上没有太多经验,因此我无法真正评论这些平台的最佳实践。 我只需在Udemy和YouTube上插入我最喜欢的讲师的列表,即可开始快速学习优质内容。

Check these guys out — you won’t regret it.

检查这些人-您将不会后悔。

3.学习最新版本的Android (3. Learn With the Latest Version of Android)

Image for post

As I’ve stated before, it’s important you’re learning about the latest version of Android. Why am I emphasizing this simplistic “duh, of course I should do that” tip?

如前所述,了解最新版本的Android非常重要。 我为什么强调这个简单的“ ,当然我应该做的”小费?

The main reason is simple. Only in the latest versions of Android have Google finally been pushing good (should I say, better) design practices, such as MVVM architecture and databinding.

主要原因很简单。 只有在最新版本的Android中,谷歌才最终推动了良好的(应该说是更好的)设计实践 ,例如MVVM体系结构和数据绑定。

These technologies and architectures are not new, but traditionally they have been tricky or even impossible to implement in Android.

这些技术和体系结构并不是新事物,但是传统上它们在Android中难以实现甚至无法实现。

As such, many old courses will teach you old technologies and therefore bad practices, hacks, and work-arounds that dirty up your code.

因此,许多老课程将教给您老技术,并因此教给您使代码不堪重负的不良做法,黑客和变通方法。

And whatever you do, don’t even start learning AsyncTask.

无论您做什么,都不要开始学习AsyncTask。

In all seriousness, try to be aware of what you should be learning and avoid those old practices as much as possible.

认真地说,试着意识到您应该学习什么,并尽可能避免那些旧的做法。

To help you, I’ll give you a guide as to what Android technologies you should be learning in 2020 later in this article.

为了帮助您,本文稍后将为您提供有关2020年您应该学习哪些Android技术的指南。

I know that in the future, these technologies won’t be as relevant. But the concept is the same — always learn to use the latest version.

我知道,将来这些技术将不再重要。 但是概念是相同的- 始终学习使用最新版本。

For an example, in the not-so-distant past, I paid for an old, highly-rated course on Udemy that taught me an old version of Android (it was actually just Android Oreo, but technology flies).

例如,在不那么遥远的过去,我为Udemy上的一门古老而受好评的课程付费,该课程教会了我一个旧版本的Android(实际上只是Android Oreo,但技术飞速发展)。

Guess what? After that course, I immediately wound up spending a lot more wasted time learning the latest version of Android.

你猜怎么了? 完成该课程后,我立即花了很多时间在学习最新版本的Android上。

If I would have chosen an up-to-date course to begin with, I would have moved much faster.

如果我选择一门最新的课程作为开始,那我的步伐会更快。

4.确保您了解生命周期 (4. Make Sure You Understand Lifecycles)

After you learn your language of choice and understand the basic components of the Android framework, you need to start learning lifecycles and how they work.

在学习了选择的语言并了解了Android框架的基本组件之后,您需要开始学习生命周期及其工作方式。

There are three main lifecycles you should concern yourself with — app lifecycles, activity lifecycles, and fragment lifecycles.

您应该关注三个主要生命周期- 应用程序生命周期,活动生命周期和片段生命周期。

Knowing these lifecycles helps you in two ways:

了解这些生命周期可以通过两种方式帮助您:

1.生命周期是Android开发中一切工作的基础。 (1. Lifecycles are fundamental to everything in Android development.)

You’ll use onCreateView() in every fragment, and onCreate() in every activity. But onCreate() for a fragment and onCreate() for an activity are very different. These kinds of nuances you will only know by learning how fragment and activity lifecycles work.

您将使用onCreateView()在每一个片段,和onCreate()中的每一个活动。 但是onCreate()为一个片段和onCreate()为一个活动是非常不同的。 您只有通过了解片段和活动生命周期的工作原理才能知道这些细微差别。

2.您将减少内存泄漏和错误。 (2. You’ll have fewer memory leaks and bugs.)

A classic example is where an observer outlives its listeners, resulting in accidental NullPointerExceptions. This happens when you forget to unregister your listeners in onStop() or you use things like LiveData (which manages its lifecycle automatically) improperly.

一个典型的例子是观察者的侦听器寿命超过其侦听器寿命,从而导致意外的NullPointerExceptions 。 当您忘记在onStop()取消注册侦听器,或者使用了LiveData类的LiveData (自动管理其生命周期)时,会发生这种情况。

These bugs can wreak havoc on your codebase and cause many hours of cursing at the screen and wanting to smash your computer to bits on the spot (don’t do that by the way).

这些错误可能会严重破坏您的代码库,并在屏幕上造成许多个小时的诅咒,并希望立即将计算机粉碎成碎片(请勿这样做)。

5.了解SOLID原则 (5. Know SOLID Principles)

Image for post

If you’re an absolute beginner, you can safely ignore this section. But if you know Java and can create a few simple apps, these are what you’ll want to learn next.

如果您是绝对的初学者,则可以放心地忽略此部分。 但是,如果您了解Java并且可以创建一些简单的应用程序,那么接下来您将要学习这些内容。

Not long ago, I didn’t think knowing SOLID principles and design patterns was all that important or beneficial. Boy was I wrong.

不久前,我认为了解SOLID原理和设计模式并不是那么重要或有益。 男孩,我错了。

A lot of self-taught programmers (which I assume you are, or wish to be) think that the technology they are using is the most important thing to learn. They aren’t far wrong — you do 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’d say this is even more important than learning the tool itself.

简而言之,您应该知道为什么使用的工具存在。 我说这比学习工具本身更为重要。

For instance, you shouldn’t be learning Dagger 2 without first learning about inversion of control, dependency injection, and maybe even doing some dependency injection by hand.

例如,如果您不首先学习控制反转,依赖注入,甚至可能需要手工进行依赖注入,就不应学习Dagger 2。

Then, and only then, should you learn Dagger 2. Once you know why Dagger 2 exists and the concepts it’s based on, you’ll be able to learn it much faster.

然后, 直到那时 ,您应该学习Dagger2。一旦知道Dagger 2为何存在以及它所基于的概念,您就可以更快地学习它。

Getting to the point, SOLID design principles are the underlying principles for pretty much everything that modern software developers do.

明确地说SOLID设计原则是现代软件开发人员所做的几乎所有工作的基本原则。

For instance, dependency inversion — the “D” in solid — is the entire reason Dagger 2 exists. If you didn’t know SOLID and you were using Dagger 2, you’d have no clue what the framework is actually doing.

例如, 依赖项倒置(实心的“ D”)是Dagger 2存在的全部原因。 如果您不了解SOLID,而您正在使用Dagger 2,那么您将不知道该框架实际上在做什么。

So I’d highly recommend you learn the basics of SOLID design principles. If you don’t do it right now, you’ll definitely be learning it later. Every software developer should know these principles.

因此,我强烈建议您学习SOLID设计原则的基础知识。 如果您现在不这样做,那么以后一定会学习。 每个软件开发人员都应该了解这些原理。

Shameless plug — I’ve written a series of articles on SOLID and I’d love for you to check them out:

无耻的插件—我在SOLID上写了一系列文章,我很希望您能检出这些文章:

6.了解基本设计模式 (6. Know Basic Design Patterns)

Once again, if you’re a total beginner, you can feel free to skip this section.

同样,如果您是一个初学者,则可以随时跳过此部分。

As you get more experience writing code, you’ll see that there are certain patterns that come up a lot.

随着您获得更多编写代码的经验,您会发现有很多模式可以使用。

This isn’t a coincidence. There are about twenty-three primary design patterns that have been constructed from countless hours of experience and failures from thousands of programmers over the years.

这不是巧合。 多年来,数以千计的程序员从无数的经验和失败中汲取了经验,构建了大约23种主要设计模式。

The main benefit of these design patterns is communication. These patterns are well-known, so it’s easy to say “oh yeah, I could do that in 10 minutes with an observer pattern,” and everyone should understand your meaning.

这些设计模式的主要好处是通信。 这些模式是众所周知的,因此很容易地说“哦,是的,我可以用观察者模式在10分钟内做到这一点”,每个人都应该理解您的意思。

Here are the design patterns you should probably know:

以下是您可能应该了解的设计模式:

  • Observer pattern (because it’s everywhere. When you need to communicate from one object to another, this is your go-to pattern)

    观察者模式 (因为它无处不在。当您需要从一个对象到另一个对象进行通信时,这是您的首选模式)

  • Adapter pattern (for understanding RecyclerView adapters, ListView adapters, ViewHolders, etc)

    适配器模式 (用于了解RecyclerView适配器, ListView适配器, ViewHolders等)

  • Facade pattern (for understanding third-party APIs and why they are structured like they are)

    外观模式 (用于了解第三方API以及它们为何如此结构)

7. MVVM,MVC,MVP或MVI —最佳架构是什么? (7. MVVM, MVC, MVP, or MVI — What’s the Best Architecture?)

Image for post

One question I struggled with when I first started learning Android development is “Which architecture should I use for my apps? Which is best?” I had soon realized that putting everything into MainActivity wasn't going to work for long.

刚开始学习Android开发时,我遇到的一个问题是:“我的应用程序应使用哪种架构? 哪个最好?” 我很快意识到,将所有内容放入MainActivity不会持续很长时间。

The short answer is: MVC or MVVM. But hear me out.

简短的答案是:MVC或MVVM。 但是,请听我说。

The long answer is basically that these patterns consist of nearly the exact same ideas. They are just implemented in slightly different ways. The best architecture is the one that’s right for your app and how your users will interact with your app.

长的答案基本上是这些模式几乎由完全相同的想法组成。 它们只是以略有不同的方式实现。 最好的架构是最适合您的应用程序以及用户如何与您的应用程序交互的架构。

Before I go any further, I have to shout out my favorite instructor here — Vasiliy Zukanov.

在继续之前,我必须在这里大喊我最喜欢的老师-Vasiliy Zukanov。

His content on this subject is top-notch, and it would be unfair to talk about this concept without mentioning him.

他在该主题上的内容是一流的,谈论这个概念而不提及他是不公平的。

You can check out his course on Android Architecture if you really want to understand the underlying principles of good architecture.

如果您真的想了解优质架构的基本原理,可以查看他的Android架构课程

Anyways, if you really want to know what you should learn first right now, here are my recommendations. But since these are so similar, it really matters rather little which one you learn first.

无论如何,如果您真的想知道您现在应该首先学习什么,这是我的建议。 但是,由于这些是如此相似,因此您最先学习哪个并不重要。

I personally now think MVC is what you should probably learn first — simply because it’s so widely known and it lays the foundation for the other architectures.

我个人现在认为MVC是您可能应该首先学习的 -仅仅是因为它广为人知,并且为其他体系结构奠定了基础。

But if you’re short on time for learning new stuff, MVVM is Google’s recommended architecture and it is similar to MVC, with a few changes. Learning it will let you dive right into the Android documentation and understand a lot of the code there.

但是,如果您没有时间学习新知识,则MVVM是Google推荐的体系结构,它与MVC类似,但有一些变化。 学习它可以让您直接进入Android文档并了解其中的许多代码。

Until recently, MVVM was my go-to architecture. I’m now favoring MVC for a number of reasons. Let me know if you want to know my thoughts on this.

直到最近,MVVM还是我的首选架构。 由于多种原因,我现在偏爱MVC。 如果您想了解我对此的想法,请告诉我。

Then there are the lesser known architectures.

然后是鲜为人知的架构。

  • MVP is essentially MVC with a couple minor differences.

    MVP本质上是MVC,但有一些细微差别。

  • MVI is another spin on MVC architecture, but can be complex — not recommended to learn first. But in the end, it matters rather little.

    MVI是MVC架构的另一种形式 ,但可能很复杂-不建议先学习。 但是最后,它的影响很小。

  • Any other architectural pattern is probably something you shouldn’t concern yourself with. These 4 patterns are well established and if implemented well, will result in clean code.

    任何其他架构模式都可能是您不应该担心的。 这4种模式已经很好地建立,并且如果实施得当,将产生清晰的代码。

8.作为Android开发人员,我实际上应该了解哪些技术? (8. Which Technologies Should I Actually Know as an Android Developer?)

Image for post

This was one other question that plagued me when I first started. After you know the basic Android framework, what technologies should you learn?

当我刚开始时,这是困扰我的另一个问题。 了解基本的Android框架后,您应该学习哪些技术?

After developing apps for a little while, I’ve come to the conclusion that you should probably focus learning these specific technologies I’m going to show you here.

在开发了一段时间的应用程序之后,我得出的结论是,您可能应该集中精力学习这些特定的技术,我将在这里向您展示这些技术。

Keep in mind that pretty much all of these libraries are widely used by the Android community, and you’ll likely run across them at one point or another. It’s good to know what you need to know right here.

请记住,几乎所有这些库都已被Android社区广泛使用,并且您可能会在一处或另一处运行它们。 很高兴在这里知道您需要知道什么。

  • Basic AndroidX libraries (which constitute Android Jetpack)

    基本的AndroidX库(构成Android Jetpack)

    These libraries are the core of Android functionality, and most of the things you’ll use from here will be UI components. Keep in mind, AndroidX is actually a re-write of the Android support library.

    这些库是Android功能的核心,您将在此处使用的大多数东西都是UI组件。 请记住,AndroidX实际上是对Android支持库的重写。

  • Room Persistance LibraryWhen you need offline storage, you typically use SQL to get stuff from the offline database. The Room persistence library will help you do this much faster, by helping you create entities, DAOs, and all kinds of neat technical stuff.

    Room Persistance Library当需要脱机存储时,通常使用SQL从脱机数据库中获取内容。 Room持久性库通过帮助您创建实体,DAO和各种精巧的技术资料,将帮助您更快地完成此任务。

  • Google Firebase

    Google Firebase

    Firebase (particularly Realtime Database) is simply my favorite cloud database at the moment, so this will likely change. But if you want a solid cloud database, you can’t beat Realtime Database or Firestore for Android in my opinion.

    目前,Firebase(尤其是实时数据库)只是我最喜欢的云数据库,因此这可能会改变。 但是,如果您想要一个可靠的云数据库,我认为您无法击败Realtime Database或Android的Firestore。

  • Retrofit 2

    改造2

    Nearly every developer will need to work with RESTful APIs at some point in their career. Retrofit 2 is the standard library for everything REST in Android. If you’re writing networked applications, knowing Retrofit — and consequently REST — is pretty much a requirement on many apps.

    几乎每个开发人员在职业生涯的某个时候都需要使用RESTful API。 Retrofit 2是适用于Android中所有REST的标准库。 如果您正在编写网络应用程序,则对许多应用程序来说,了解翻新以及相应的REST知识是非常必要的。

  • Dagger 2

    匕首2

    Dependency injection is a vital principle to constructing good Android apps. Dagger 2 is the standard way of doing this more quickly than creating your own dependency injection component. It’s widely used and you’ll probably encounter it soon. Learn it.

    依赖注入是构建良好的Android应用程序的重要原则。 与创建自己的依赖项注入组件相比,Dagger 2是执行此操作的标准方法。 它被广泛使用,您可能很快就会遇到它。 学习吧。

  • RxJava 2 or at the time of writing, RxJava 3 might be worth checking out.

    RxJava 2或在撰写本文时,RxJava 3可能值得一试。

    RxJava is an interesting library. It’s primary purpose is to help you more easily create asynchronous code that runs on background threads and returns asynchronous results. It’s used in many Android apps, so you’ll need to know the basics of RxJava before reading the code of these apps.

    RxJava是一个有趣的库。 它的主要目的是帮助您更轻松地创建在后台线程上运行并返回异步结果的异步代码。 它已在许多Android应用程序中使用,因此在阅读这些应用程序的代码之前,您需要了解RxJava的基础知识。

  • Glide

    滑行

    Glide is a popular image loading library, complete with built-in caching. It’s pretty easy to use and it’s used by plenty of Android developers.

    Glide是一个流行的图像加载库,具有内置缓存。 它非常易于使用,并且被许多Android开发人员所使用。

  • Mockito, MockK or some mock injection service for unit testing.

    Mockito,MockK或一些用于单元测试的模拟注入服务。

    I’ll make this more clear in tip #10.

    我将在提示10中更清楚地说明这一点。

  • Gradle/Maven build automation systems

    Gradle / Maven构建自动化系统

    The reasoning behind this is simple. You don’t have to know a lot about Gradle or Maven, but you should know enough to throw in libraries and dependencies as needed. Just search anything you don’t know on Google and you’ll probably get a good answer.

    这背后的原因很简单。 您不必对Gradle或Maven有很多了解,但是您应该了解足够的知识,可以根据需要添加库和依赖项。 只需在Google上搜索您不知道的任何内容,您就会得到一个很好的答案。

9.什么时候可以称自己为“好” Android开发人员? (9. When Can I Call Myself a “Good” Android Developer?)

This question I’ve struggled with for a long time. I figure I will for a long time more.. I still feel imposter syndrome, and I picture myself as being much worse than I actually am. After some time, I do hope that I’ll feel more confident as a programmer.

这个问题我困扰了很长时间。 我想我会在很长一段时间内..我仍然感到冒名顶替综合症,而且我认为自己比实际情况差很多。 一段时间后,我确实希望自己会成为一名程序员,更加自信。

But if you want it, in my opinion, a competent Android developer understands the following:

但是,我认为,如果您愿意的话,有能力的Android开发人员可以了解以下内容:

  • Importance of architecture and good design that works for your problems.

    适用于您的问题的体系结构和良好设计的重要性

  • Importance of TDD as shown below.

    TDD的重要性如下所示。

  • The technologies I mentioned in the previous tip.

    我在上一个技巧中提到的技术。

  • Data structures and algorithms

    数据结构和算法

  • How to communicate your problems clearly and the importance of communicating often.

    如何清楚地交流您的问题以及经常交流的重要性。

  • How crucial it is to always be learning and interacting with other Android developers.

    始终学习和与其他Android开发者互动是多么关键

Anything else is icing on the cake! Let me know if you have another thing you want to add this list. I’d love to hear your opinions.

还有什么可锦上添花的! 让我知道您是否还有其他想要添加此列表的信息。 我很想听听您的意见。

10.学习基础知识后,开始单元测试 (10. After Learning the Basics, Start Unit Testing)

Finally, I want to leave you with one of the best practices you can start after you’ve learned Java, Kotlin, the Android framework, and the technologies in tip #8 — unit testing.

最后,在您了解Java,Kotlin,Android框架以及技巧8(单元测试)中的知识之后,我想为您提供最佳的实践方法之一。

Unit testing has plenty of benefits. I’ll outline a few of those.

单元测试有很多好处。 我将概述其中一些。

  • Single responsibility principle (first letter of SOLID) is enforced when you’re unit testing properly.

    在正确进行单元测试时,将强制执行 单一职责原则 (SOLID的首字母)。

  • You can change your code more confidently because you are protected against “regressions” or the quality of your code decreasing as you change it.

    您可以放心地更改代码,因为可以防止“回归”或代码质量随更改而降低。

  • You validate that your code does what it’s supposed to do.

    您可以验证您的代码是否可以完成预期的工作。

Nearly always, you’ll unit test using TDD, test driven development. This is a technique that “Uncle Bob” Martin is a big advocate for, and his book, Clean Code, will help you understand why you should be using it.

几乎总是,您将使用TDD(测试驱动的开发)进行单元测试。 “鲍勃叔叔”马丁是这项技术的大力提倡者,他的书《 清洁代码》将帮助您了解为什么要使用它。

Once again I will credit Vasiliy Zukanov for his insight on this topic as well. I know I sound like a salesman for him, but there is a reason his courses are ranked so highly. They are very professional and polished courses, and any Android developer would benefit from them. His course on unit testing is something you should absolutely “test out” :)

我将再次感谢Vasiliy Zukanov对这一主题的洞见。 我知道我听起来对他来说就像个推销员,但是这是有原因的,他的课程排名很高。 它们是非常专业和完善的课程,任何Android开发人员都将从中受益。 他的单元测试课程是您绝对应该“测试”的课程 :)

Lastly, once you understand unit testing fundamentals, you should be trying to learn Mockito for Java unit tests, or MockK for Kotlin unit tests.

最后,一旦您了解了单元测试的基础知识,就应该尝试学习用于Java单元测试的Mockito或用于Kotlin单元测试的MockK。

These libraries help you create “mocks” for testing that can speed up your development time drastically. While this is awesome, you’ll understand the concepts of TDD much better if you get some experience doing tests without them.

这些库可帮助您创建测试“样板”,从而极大地缩短开发时间。 虽然这很棒,但是如果您有一些不使用TDD进行测试的经验,那么您会更好地理解TDD的概念。

结论 (Conclusion)

And as anyone in tech would tell you, just have fun with it! It’s important to enjoy learning all of this interesting stuff. Don’t stress over it or try to go too fast. You won’t retain the information very well if you do so.

就像技术上的任何人都会告诉你的那样,那就快好玩吧! 享受学习所有这些有趣的东西很重要。 不要过分强调或尝试过快。 如果这样做,您将不会很好地保留信息。

Lastly, it’s vital to AAB — always be building (you can thank Danny Thompson for this :))

最后,对AAB 至关重要 -始终在建设中(您可以为此感谢Danny Thompson :)

And finally, it’s probably a good idea to start and consistently update a blog where you talk about what you’ve learned.

最后,开始并不断更新您谈论所学知识的博客可能是一个好主意。

This is the classic rubber-ducky method, and it will help you solidify 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 here :), so leave your thoughts and opinions in the comments below. Happy coding!

所有这些正是我在这里所做的:),所以在下面的评论中留下您的想法和意见。 祝您编码愉快!

(This article comes from my blog at https://darrenfinch.com/11-things-you-should-know-when-starting-android-development)

(本文来自我的博客, 网址https://darrenfinch.com/11-things-you-should-know-when-starting-android-development )

翻译自: https://medium.com/swlh/11-things-you-should-know-when-starting-android-development-ca704f5394a7

了解android开发

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值