Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Java臭くない かわいい小鳥にする話 - メルカリ JP のコード例を交え -

Java臭くない かわいい小鳥にする話 - メルカリ JP のコード例を交え -

Nov. 22, 2017
Mercari × Souzoh Android Talk @mercari

Kotlin すでにバリバリ使ってるところも慎重になってるところもあるかなと思うんですが、学習コスト安く小さなコードで戦果の上がるかわいい言語なので頭の鈍くなってきたおじさんたちにこそ使ってみてほしい!っていうプレゼンしてみました。

Chronum Sintario

November 22, 2017
Tweet

More Decks by Chronum Sintario

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • @sintario (Chronum Sintario) • ϝϧΧϦࣾྺ22೔Ίͷ৽ਓΤϯδχΞ • ീԦࢠࢢࡏॅʢژԦઢͱେߐށઢͰձ͑ΔΑʣ •

    ࠷ۙͷझຯ͸Ոఉͷෆཁ඼ΛϝϧΧϦͰചΓ͞͹͍ ͯച্ۚͰࣗ෼༻ͷ͓΋ͪΌΛങ͍ړΔ͜ͱʢ௚ۙ ͸੟ˑ͓ʹ͍͞Μͷ࣋ͬͯͳ͍רΛະ࢖༻৽඼300ԁ റΓͰूΊ͍ͯ·ͨ͠ʣ
  2. Career Background • JustSystems •Java, XML •ATOK Mac, Tweet ATOK,

    Objective-C, C++ • Lunascape •Web browser iOS app • DeNA •iOS apps, Android apps •Groovy, νϥγϧ, KenCoM, ͞ΜΆδελ •Healthcare, KenCoM, Ruby on Rails, Swift, Kotlin
  3. ͿͬͪΌ͚ ͜Ε͚ͩ஌ͬͯΕ͹ ͍͍͓̺ͩͨ ?., .let, .apply, when, ?: return, companion

    object, fun ͋ͱ͸ . ଧͬͯ Android Studio ઌੜʹڭ͑ͯ΋Β͍ͳ
  4. ݺΜͩʁಡΜͩʁ https://www.mercari.com/jp/search/? keyword=%E3%83%AA%E3%83%BC%E3%83%80%E3%83%96%E3%83%AB %E3%82%B3%E3%83%BC%E3%83%89 ষɹཧղ͠΍͍͢ίʔυ ষɹ໊લʹ৘ใΛ٧ΊࠐΉ ষɹޡղ͞Εͳ໊͍લ ষɹඒ͠͞ ষɹίϝϯτ͢΂͖͜ͱΛ஌Δ ষɹίϝϯτ͸ਖ਼֬Ͱ؆ܿʹ

    ষɹ੍ޚϑϩʔΛಡΈ΍͘͢͢Δ ষɹڊେͳࣜΛ෼ׂ͢Δ ষɹม਺ͱಡΈ΍͢͞ ষɹແؔ܎ͷԼҐ໰୊Λநग़͢Δ ষɹҰ౓ʹͭͷ͜ͱΛ ষɹίʔυʹࢥ͍ΛࠐΊΔ ষɹ୹͍ίʔυΛॻ͘ ষɹςετͱಡΈ΍͢͞ ষɹʮ෼ʗ࣌ؒΧ΢ϯλʯΛઃܭɾ࣮૷͢Δ
  5. public class ModalContentWebActivity extends SchemeWebActivity { public static Intent createIntent(Context

    context, String url){ return createIntent(context, url, null, null); } public static Intent createIntent(Context context, String url, String funcName, String params){ Intent intent = new Intent(context, ModalContentWebActivity.class); intent.putExtra(S.url, url); intent.putExtra(S.funcName, funcName); intent.putExtra(S.params, params); return intent; }
  6. public class ModalContentWebActivity extends SchemeWebActivity { public static Intent createIntent(Context

    context, String url){ return createIntent(context, url, null, null); } public static Intent createIntent(Context context, String url, String funcName, String params){ Intent intent = new Intent(context, ModalContentWebActivity.class); intent.putExtra(S.url, url); intent.putExtra(S.funcName, funcName); intent.putExtra(S.params, params); return intent; }
  7. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?): Intent { return createIntent(context, url, null, null) } fun createIntent(context: Context, url: String?, funcName: String?, params: String?): Intent { val intent = Intent(context, ModalContentWebActivity::class.java) intent.putExtra(S.url, url) intent.putExtra(S.funcName, funcName) intent.putExtra(S.params, params) return intent }
  8. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?): Intent { return createIntent(context, url, null, null) } fun createIntent(context: Context, url: String?, funcName: String?, params: String?): Intent { val intent = Intent(context, ModalContentWebActivity::class.java) intent.putExtra(S.url, url) intent.putExtra(S.funcName, funcName) intent.putExtra(S.params, params) return intent }
  9. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null): Intent { val intent = Intent(context, ModalContentWebActivity::class.java) intent.putExtra(S.url, url) intent.putExtra(S.funcName, funcName) intent.putExtra(S.params, params) return intent }
  10. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null): Intent { val intent = Intent(context, ModalContentWebActivity::class.java) intent.putExtra(S.url, url) intent.putExtra(S.funcName, funcName) intent.putExtra(S.params, params) return intent } overload ؔ਺ফ͑ͨʂ໌ࣔఆٛҰݸ࡟ݮ
  11. apply ͠·͠ΐ͏ͥ /** * Calls the specified function [block] with

    `this` value as its receiver * and returns `this` value. */ @kotlin.internal.InlineOnly public inline fun <T> T.apply(block: T.() -> Unit): T { block(); return this }
  12. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null): Intent { val intent = Intent(context, ModalContentWebActivity::class.java) intent.putExtra(S.url, url) intent.putExtra(S.funcName, funcName) intent.putExtra(S.params, params) return intent }
  13. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null): Intent { return Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) } }
  14. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null): Intent { return Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) } } ͜ͷதͰ͸ this ͕ Intent ΠϯελϯεͳͷͰ Ϩγʔόʔهड़Λল͚Δ
  15. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null): Intent { return Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) } }
  16. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null) = Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) }
  17. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null) = Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) } ࣜͷ໭Γ஋Λฦ͢Αɺͱ͍͏௚ײతͳදݱʹɻ return ͱ͔΋͸΍ॻ͍ͨΒಐః
  18. public class ModalContentWebActivity extends SchemeWebActivity { public static Intent createIntent(Context

    context, String url){ return createIntent(context, url, null, null); } public static Intent createIntent(Context context, String url, String funcName, String params){ Intent intent = new Intent(context, ModalContentWebActivity.class); intent.putExtra(S.url, url); intent.putExtra(S.funcName, funcName); intent.putExtra(S.params, params); return intent; }
  19. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null) = Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) }
  20. class ModalContentWebActivity: SchemeWebActivity() { companion object { fun createIntent(context: Context,

    url: String?, funcName: String? = null, params: String? = null) = Intent(context, ModalContentWebActivity::class.java).apply { putExtra(S.url, url) putExtra(S.funcName, funcName) putExtra(S.params, params) } ΋ͷ͛͑͢ߦ਺ݮΔͶ͑ จࣈ਺ݮΔͶ͑
  21. վΊͯಡΜͰΈΔͱϚδ͍͍ຊ https://www.mercari.com/jp/search/? keyword=%E3%83%AA%E3%83%BC%E3%83%80%E3%83%96%E3%83%AB %E3%82%B3%E3%83%BC%E3%83%89 ষɹཧղ͠΍͍͢ίʔυ ষɹ໊લʹ৘ใΛ٧ΊࠐΉ ষɹޡղ͞Εͳ໊͍લ ষɹඒ͠͞ ষɹίϝϯτ͢΂͖͜ͱΛ஌Δ ষɹίϝϯτ͸ਖ਼֬Ͱ؆ܿʹ

    ষɹ੍ޚϑϩʔΛಡΈ΍͘͢͢Δ ষɹڊେͳࣜΛ෼ׂ͢Δ ষɹม਺ͱಡΈ΍͢͞ ষɹແؔ܎ͷԼҐ໰୊Λநग़͢Δ ষɹҰ౓ʹͭͷ͜ͱΛ ষɹίʔυʹࢥ͍ΛࠐΊΔ ষɹ୹͍ίʔυΛॻ͘ ষɹςετͱಡΈ΍͢͞ ষɹʮ෼ʗ࣌ؒΧ΢ϯλʯΛઃܭɾ࣮૷͢Δ