Pro Yearly is on sale from $80 to $50! »

SOUZOUxMERCARI-A Story of Cute Birds and Oldman

Cf72ecd4105b5818fcabcc0c0aaeee22?s=47 jsugai
November 24, 2017
420

SOUZOUxMERCARI-A Story of Cute Birds and Oldman

Cf72ecd4105b5818fcabcc0c0aaeee22?s=128

jsugai

November 24, 2017
Tweet

Transcript

  1. ͔Θ͍͍খௗΛғ͏
 ͓ͬ͞Μୡͷ࿩ Mercari, Inc

  2. About me Jun Sugai @calciolife Mercari


  3. Agenda • Welcome Kotlin • Kotlinizing • using Kotlin

  4. Welcome

  5. None
  6. Ͳ͏͍͏ܦҢͰ? Welcome Kotlin/Kotlin ಋೖ

  7. ָͦ͠͏ͳงғؾ͋ͬͨ Welcome Kotlin/Kotlin ಋೖ

  8. •ָͦ͠͏ͳΒ΍ͬͯ͠·͏ •໘നͦ͏ͳ΍ͬͯ͠·͏ •໰୊͕ͳ͚Ε͹ڋ൱͠ͳ͍ Welcome Kotlin/Kotlin ಋೖ

  9. Kotlinizing

  10. •ςετίʔυ •Өڹͷগͳ͍ͱ͜Ζ͔Β •৽نͷػೳ͔Β •etc... ABC

  11. •ςετίʔυ •Өڹͷগͳ͍ͱ͜Ζ͔Β •৽نͷػೳ͔Β •etc... ABC શ෦Ͱ͢ΑͶ

  12. ಋೖ͸࢖ͬͯײ૝Λॻ͘·Ͱ΍Δ ݁ՌΛग़ͯͦ͜͠੒Ռ ΠλϦΞ୅දͩͬͯϘίϘί

  13. using Kotlin

  14. είʔϓؔ਺ Kotlin ͕Α΄Ͳಛघͳ࣮૷/࠷దԽͰ ͳ͍ݶΓ͸είʔϓؔ਺͸ཁ͢Δʹ ϝιουΛ࡞ͬͯॲཧΛҠ͔͑͠Δ ίʔυʹࠩ͠ସ͑Δ


  15. None
  16. είʔϓؔ਺ ࢖͏΂͖ɻReadable ͬͯେࣄɻ

  17. var/val/collection ΞΫηε੍ޚ΍ΧϓηϧԽͳͲ͸ Java ΑΓ΋෼͔Γ΍͍͢൓໘ɺ
 ଟ༻͠΍͢͞͸Ͳ͏ͳΜͩΖ͏?

  18. var/val/collection public class SearchListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private val List<SearchKeyWord>

    dataSet = new ArrayList<>(); public SearchListAdapter(SearchListener listener) { this.listener = listener; } //... @Override public int getItemCount() { return dataSet.size(); } public void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet = dataSet; notifyDataSetChanged(); }
  19. var/val/collection public class SearchListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private val List<SearchKeyWord>

    dataSet = new ArrayList<SearchKeyWord>() //େࣄͳͱ͜Ζ͚ͩ public void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet.clear() this.dataSet.addAll(dataSet) notifyDataSetChanged(); } // Kotlin ͩͱ immutable ʹͨ͘͠ͳͬͪΌ͏
  20. None
  21. var/val/collection private val List<SearchKeyWord> dataSet = new ArrayList<SearchKeyWord>() //େࣄͳͱ͜Ζ͚ͩ public

    void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet.clear() this.dataSet.addAll(dataSet) notifyDataSetChanged(); } •clear() -> addAll() ͷྲྀΕ͸ GC ίετతʹͲ͏ͳͷ? •addAll() Ͱ௥Ճ͢Δࡍͷཁૉ͕ڊେͳ instance ΍ڊେͳ heap ΁ͷࢀরΛอ࣋͢Δߏ଄ͩͱ
 clear() -> adAll() ͚ͩͰ GC ͕૸ΔՄೳੑ͸? •ཁૉͷίϐʔΛ࡞Δ heap ίετ/ϑοτϓϦϯτ͸ॲཧશମͰແࢹͰ͖Δ΄Ͳখ͍͞?
  22. var/val έʔεʹԠͯ͡ Readable ͳͷ͸େࣄ͚ͩͲϦιʔε͸༗ݶɻ ύϑΥʔϚϯε͸ "ίʔυͷ඼࣭" Ͱ͸ͳ͘
 "ΞϓϦͷ඼࣭" ͳͷͰಉ͡؍఺Ͱٞ࿦͠ͳ͍ɻ

  23. ଞͷࣄྫ͸ɺ·ͨผͷػձʹ! ৘ใަ׵ͱ͔͍ͯͩ͘͠͞