Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Closes #14: add kotlin guide; other clean up #48

Merged
merged 8 commits into from
Aug 11, 2018

Conversation

mcomella
Copy link
Contributor

@mcomella mcomella commented Aug 10, 2018

@mcomella mcomella requested a review from boek August 10, 2018 23:40
@colintheshots
Copy link
Contributor

With the Kotlin Koans, I would specifically recommend the IntelliJ IDE plugin, Kotlin Edu. Educational plugins do not work yet in Android Studio though. It works great with IntelliJ Community Edition.

@mcomella
Copy link
Contributor Author

@colintheshots AS 3.0 is listed on the official page: https://www.jetbrains.com/education/kotlin-edu/ as it is on the Koans page. Perhaps it changed recently?

@mcomella
Copy link
Contributor Author

fwiw, I was hesitant to add this information initially because I didn't want to overwhelm people by having them install a bunch of single-use software but if it's important to properly run the Koans, it SGTM

@mcomella mcomella requested review from severinrudie and removed request for boek August 11, 2018 00:08
@boek boek self-requested a review August 11, 2018 00:14
## Getting Started
There are multiple ways to get started with Kotlin, depending on how you like to learn. If you like:
- Reading documentation, the official Kotlin docs are good: start at [Basic Syntax] and work your way through the pages in the side bar
- Learning while coding, try the [Kotlin Koans] online or in the IDE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to briefly describe what the Koans are.

Also IMO, if someone has no Kotlin experience and needs to ramp up quickly, Koans should be their first step. If there's agreement on that point we might want to mention it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to say, "Do this" because everyone learns differently (e.g. I preferred to read the docs).

But I can see why it'd be helpful to most people: I'll bump it to the top and elaborate a little.

- Reading documentation, the official Kotlin docs are good: start at [Basic Syntax] and work your way through the pages in the side bar
- Learning while coding, try the [Kotlin Koans] online or in the IDE
- Courses, try the official [Kotlin for Android Developers][course] course (note: none of our team members have tried this yet)
- Reading books, try [Kotlin in Action]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention the bookshelf for SF employees? Also probably worth including the Big Nerd Ranch book.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, I'm trying to reduce choice here to keep it simple for people. I phrased it to emphasize Kotlin in Action.

Once you've gained some basic familiarity with the language, you can gain more experience by:
- Watching videos and conference talks on YouTube.
- [Convert Java to Kotlin with the auto-converter][convert]and change the resulting code into idiomatic Kotlin
- Doing coding exercises on [exercism.io](https://exercism.io/)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, I had not heard of this website but it looks cool.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://codewars.com also has a lot of good Kotlin exercises

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boek Is there any benefit to codewars over exercism? I'm trying to reduce the number of choices for people to keep it simple.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth mentioning all KotlinConf, Google I/O, and Android Dev Summit videos are on Youtube.


You should also take a look at the official style guides:
- [Jetbrains](https://kotlinlang.org/docs/reference/coding-conventions.html)
- [Android](https://android.github.io/kotlin-guides/)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, do we prefer one of these over the other? I remember that there are a few discrepancies, although none come to mind at the moment.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should create a living Mozilla style guide, we could definitely use one of these as the base.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have a preference for one over the other: @pocmo would you agree?

I think we should create a living Mozilla style guide,

I agree: it would be good to document how we use things that aren't explicitly documented elsewhere or not enforced by our tools (I wish the tools were stricter!). I filed #49.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make the tools stricter. Both Android Studio and IntelliJ accept a style XML file which encodes our style choices. You can export a standard XML file for the team to load for consistent style. It's also possible to automatically perform formatting if you commit from Android Studio and check Reformat Code or use a pre-commit hook with the "format" command from the command line. The Android Open Source Project has had one of these XML style files in their repo for many years.
screenshot from 2018-08-11 10-15-58

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the command line option: https://stackoverflow.com/a/45713741

- Visiting local meetups

## Intermediate Topics
You can see what the Kotlin compiler is doing under the hood (e.g. is this lambda performant? What does it keep a reference to?) by using "Show Kotlin Bytecode" and then "Decompile" back to Java.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a link for this, but 'writing DSLs' is a neat intermediate topic. There's a chapter on it near the end of Kotlin in Action.

Copy link

@boek boek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good 👍
I wonder if we should point out these anywhere as we do use them quite a bit

@mcomella
Copy link
Contributor Author

I wonder if we should point out these anywhere as we do use them quite a bit

@boek Good idea. Do you think this link is a good resource to learning how to use them? (I want to save cycles by not personally vetting all the resources we recommend :P)

@mcomella mcomella merged commit 79c65bf into mozilla-mobile:master Aug 11, 2018
@mcomella mcomella deleted the i14-kotlin branch August 11, 2018 00:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants