SlideShare a Scribd company logo
Designing
Auto Generated Codes
17 Nov 2015 Roppongi.aar #2
@kikuchy
• Hiroshi Kikuchi (@kikuchy)
• Belonging to , inc , Working on , inc (mixi group)
• Making Dating App for Android
• Strict review OJISAN
Who am I
APT made our work
reduced!!
So, you use APT,
and be happy!!
\\٩( 'ω' )‫و‬ ////
… I was going to talk about
like that, but
Oh, you are already using
APT.
fin.
\(^o^)/
So, I ll talk about
Designing
Auto Generated Codes
What is the best way to use
Generated Code in our project?
Please consider and discuss.
The Problem
Make Us Wakeful
Case 1 (/2)
If you make an awesome library
hiding generated codes…
// Fields
@ExecuteSomething
String foo;
// Executor class “ThisClass$$Executor” is
generated.
// My library loads executor class automatically!
AwesomeLibrary.execute(this);
Alice changes Naming Rule
of Generated Class.
ex) (ClassName)$$Executor -> (ClassName)$$Doer
proguard-rules.pro ????
< Hey, I obfuscated your code!
Proguard
@ Production Build
Case 2 (/2)
If you make awesome proguard-safe library…
// Fields
@ExecuteSomething
String foo;
// Executor class “ThisClassExecutor” is
generated.
// There are no reflection, no
ClassNotFoundException!!
new ThisClassExecutor().execute(this);
Bob often asks you
What s the name of Generated Classes and methods and constructor arguments and
interfaces will use in Generated Code blablabla…
Why ask me repeatedly ?
Why I have to remember
invisible codes?
Bob
<
https://www.flickr.com/photos/greeblie/2190709020/
 / / / /    / |  /    `、 i  !  |i   i  ,  l
  / / //   /   | /       | |  |  l !  i  |  |
`/ー- 、 / /    | /       | l   |  l l  !  !  i
/ ,,,,- ニ=x- 、_   !/       |i  _, +十'イ  i  !  !
''" / :;;r jヽ ` ̄  リ      ,, -=、 レ | / /  :|
 /:::::;;;;;;;:`::::::l          / :;;r ヽヽ   |/| /   :!
 |::::::::;;;;;;;;:::::::l             l:::;;;;;` ::| l  //    :!
  '、:_ ''''  ノ          l  '''' ノ |  /    :|
::::::::..  ̄               ` ー '   ,'      :|
::::::::::::            ,    ..::::::::::::..l  .:|   :|
::::::::::                :::::::::::::::::::|  :|   :| Mmmm…
                    ::::::::::::::: l .:|  l  :|
                         /  :| :l  :|
                      , '   :::| :|  :|
` 、     ⊂ニ==ー‐-     , イ    ::::| :|  :|
hiding generated codes
no reflection
vs
Butter Knife pattern
Dagger2 pattern
vs
Compare patterns
Butter Knife pattern
(hiding generated codes)
Dagger2 pattern

(no reflection)
How to load generated
codes
Library dose everything Developers have to import
Proguard configuration is needed not needed
Developers have to learn only usage of library
+ generated class naming
rules
Type-Safe No Yes
Which we should adopt?
case by case
My Recommend:
Dagger2 pattern
Don’t forget
proguard conf?
Start
↓
Like beautiful
API?
Is not solidity
app necessary?
→ →
Yes
No↓
“Dagger2” pattern
→
No
Yes
↓ No↓
“Dagger2” pattern “Dagger2” pattern
“Butter
Knife”
pattern
Yes
No proguard,
and save the team
https://www.flickr.com/photos/katrinasagemuller/3751402009/
Appendix 1:
Auto code generation patterns
• Java Annotated Source Codes
• Using APT.
• ex) Dagger2, ButterKinfe, JsonPullParser, etc…
• Externals
• Gradle Task (depends on compileJava task)
• ex ) R.java, genum (← I m developing now!!!!!!!!!!!)
Source of Source Codes
Generated Class Depends on…
• Only Interface
• MyOwnInterface instance = new GeneratedClass();
• ex) Dagger2, (Retrofit)
• Library Classes
• LibrarySuppliedBase instance = new GeneratedClass();
• ex) Shillelagh, etc…
• Nope ¦¦ Unknown
• (Generated classes are hidden.)
• ex) ButterKnife, IntentBuilder, DeepLinkDispatch
Appendix 2:
Episode
POJO
↓
Map<String, String>
https://www.flickr.com/photos/yoshimov/10256644/
public class UserSearchRequest {
public EnumSet<UserKind> kind;
public String freeWord;
public int ageMax;
…
}
@ToQueryMap
public class UserSearchRequest {
@QueryParam(name = “kind”,
adapter = UserKindAdapter.class)
public EnumSet<UserKind> kind;
@QueryParam(name = “free_word”,
adapter = StringAdapter.class)
public String freeWord;
@QueryParam(name = “age_max”,
adapter = IntAdapter.class)
public int ageMax;
…
public final class UserSearchRequestSerializer {
public Map<String, String>
serialize(UserSearchRequest request) {
Map<String, String> map = new Map<>();
map.put(“kind”,
userKindAdapter.adapt(request.kind));
map.put(“free_word”,
stringAdapter.adapt(request.freeWord));
map.put(“age_max”,
intAdapter.adapt(request.ageMax));
…
return map;
}
GENERATED
Yheaaaaaaaa
\\٩( 'ω' )‫و‬ ////
Thank you for listening!
Question?
@kikuchy

More Related Content

What's hot

I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
Mike McNeil
 
SONY BBS - React Native
SONY BBS - React NativeSONY BBS - React Native
SONY BBS - React Native
Mehmet Ali Bağcı
 
What is Swagger?
What is Swagger?What is Swagger?
What is Swagger?
Philip Senger
 
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android Development
Willow Cheng
 
"I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more."I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more.
Fabio Milano
 
Automation is Easy! (python version)
Automation is Easy! (python version)Automation is Easy! (python version)
Automation is Easy! (python version)
Iakiv Kramarenko
 
Head first android apps dev tools
Head first android apps dev toolsHead first android apps dev tools
Head first android apps dev tools
Shaka Huang
 
Get started with AAR
Get started with AARGet started with AAR
Get started with AAR
René Mertins
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
Bartosz Kosarzycki
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
Victor Trakhtenberg
 
Creating iOS and Android Apps with Visual Studio and C#
Creating iOS and Android Apps with Visual Studio and C# Creating iOS and Android Apps with Visual Studio and C#
Creating iOS and Android Apps with Visual Studio and C#
mobiweave
 
Angular TS(typescript)
Angular TS(typescript)Angular TS(typescript)
Angular TS(typescript)
Ivan Stepić
 
Quick run in with Swagger
Quick run in with SwaggerQuick run in with Swagger
Quick run in with Swagger
Mesh Korea
 
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Jason Conger
 
Going Native With React
Going Native With ReactGoing Native With React
Going Native With React
Eric Nograles
 
Get Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI SpecGet Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI Spec
Adam Paxton
 
Android Dev Conference 2017 - Produtividade Ninja no Android Studio
 Android Dev Conference 2017 - Produtividade Ninja no Android Studio Android Dev Conference 2017 - Produtividade Ninja no Android Studio
Android Dev Conference 2017 - Produtividade Ninja no Android Studio
iMasters
 
Efficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE PluginsEfficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE Plugins
Samit Badle
 
React Native - Getting Started
React Native - Getting StartedReact Native - Getting Started
React Native - Getting Started
Tracy Lee
 
From IDE to Selenium 2
From IDE to Selenium 2From IDE to Selenium 2
From IDE to Selenium 2
davehunt82
 

What's hot (20)

I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
 
SONY BBS - React Native
SONY BBS - React NativeSONY BBS - React Native
SONY BBS - React Native
 
What is Swagger?
What is Swagger?What is Swagger?
What is Swagger?
 
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android Development
 
"I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more."I have a framework idea" - Repeat less, share more.
"I have a framework idea" - Repeat less, share more.
 
Automation is Easy! (python version)
Automation is Easy! (python version)Automation is Easy! (python version)
Automation is Easy! (python version)
 
Head first android apps dev tools
Head first android apps dev toolsHead first android apps dev tools
Head first android apps dev tools
 
Get started with AAR
Get started with AARGet started with AAR
Get started with AAR
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
 
Creating iOS and Android Apps with Visual Studio and C#
Creating iOS and Android Apps with Visual Studio and C# Creating iOS and Android Apps with Visual Studio and C#
Creating iOS and Android Apps with Visual Studio and C#
 
Angular TS(typescript)
Angular TS(typescript)Angular TS(typescript)
Angular TS(typescript)
 
Quick run in with Swagger
Quick run in with SwaggerQuick run in with Swagger
Quick run in with Swagger
 
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
 
Going Native With React
Going Native With ReactGoing Native With React
Going Native With React
 
Get Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI SpecGet Your Node.js API Swaggering with OpenAPI Spec
Get Your Node.js API Swaggering with OpenAPI Spec
 
Android Dev Conference 2017 - Produtividade Ninja no Android Studio
 Android Dev Conference 2017 - Produtividade Ninja no Android Studio Android Dev Conference 2017 - Produtividade Ninja no Android Studio
Android Dev Conference 2017 - Produtividade Ninja no Android Studio
 
Efficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE PluginsEfficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE Plugins
 
React Native - Getting Started
React Native - Getting StartedReact Native - Getting Started
React Native - Getting Started
 
From IDE to Selenium 2
From IDE to Selenium 2From IDE to Selenium 2
From IDE to Selenium 2
 

Viewers also liked

Upload a screenshot to Slack
Upload a screenshot to SlackUpload a screenshot to Slack
Upload a screenshot to Slack
Shinobu Okano
 
Administrasi kurikulum
Administrasi kurikulumAdministrasi kurikulum
Administrasi kurikulumShiltima Wiska
 
Android Clean Architecture for Dummies
Android Clean Architecture for DummiesAndroid Clean Architecture for Dummies
Android Clean Architecture for Dummies
Kengo Suzuki
 
Administrasi ppt
Administrasi pptAdministrasi ppt
Administrasi ppt2012620165
 
Python勉強会in 長野 オープニング
Python勉強会in 長野 オープニングPython勉強会in 長野 オープニング
Python勉強会in 長野 オープニング
Yuuki Nakajima
 
Uso di Slideshare
Uso di SlideshareUso di Slideshare
Uso di Slideshare
Franco Marra
 
DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話
Nakazawa Yuichi
 
ディープラーニングハンズオンを準備して学んだこと
ディープラーニングハンズオンを準備して学んだことディープラーニングハンズオンを準備して学んだこと
ディープラーニングハンズオンを準備して学んだこと
Kiyoshi SATOH
 
「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」
Takeshi Akutsu
 
Slide Wars- The Force Sleeps
Slide Wars- The Force SleepsSlide Wars- The Force Sleeps
Slide Wars- The Force Sleeps
Empowered Presentations
 
Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.
Emiland
 

Viewers also liked (11)

Upload a screenshot to Slack
Upload a screenshot to SlackUpload a screenshot to Slack
Upload a screenshot to Slack
 
Administrasi kurikulum
Administrasi kurikulumAdministrasi kurikulum
Administrasi kurikulum
 
Android Clean Architecture for Dummies
Android Clean Architecture for DummiesAndroid Clean Architecture for Dummies
Android Clean Architecture for Dummies
 
Administrasi ppt
Administrasi pptAdministrasi ppt
Administrasi ppt
 
Python勉強会in 長野 オープニング
Python勉強会in 長野 オープニングPython勉強会in 長野 オープニング
Python勉強会in 長野 オープニング
 
Uso di Slideshare
Uso di SlideshareUso di Slideshare
Uso di Slideshare
 
DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話
 
ディープラーニングハンズオンを準備して学んだこと
ディープラーニングハンズオンを準備して学んだことディープラーニングハンズオンを準備して学んだこと
ディープラーニングハンズオンを準備して学んだこと
 
「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」
 
Slide Wars- The Force Sleeps
Slide Wars- The Force SleepsSlide Wars- The Force Sleeps
Slide Wars- The Force Sleeps
 
Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.
 

Similar to Designing Auto Generated Codes

Sylius, the good choice
Sylius, the good choiceSylius, the good choice
Sylius, the good choice
Jacques Bodin-Hullin
 
DWX 2013 Nuremberg
DWX 2013 NurembergDWX 2013 Nuremberg
DWX 2013 Nuremberg
Marcel Bruch
 
Know your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvmKnow your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvm
Pawel Szulc
 
JS-formatter
JS-formatterJS-formatter
JS-formatter
kimsrung lov
 
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Joxean Koret
 
Elixir in a nutshell - Ecosystem (session 1)
Elixir in a nutshell - Ecosystem (session 1)Elixir in a nutshell - Ecosystem (session 1)
Elixir in a nutshell - Ecosystem (session 1)
Héla Ben Khalfallah
 
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0Marcel Bruch
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
Crystal Language
 
A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023
A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023
A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023
Pedro Vicente
 
Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0
André Moreira
 
Your money, your media a DRMtastic (reverse|re) eng. tutorial
Your money, your media a DRMtastic (reverse|re) eng. tutorialYour money, your media a DRMtastic (reverse|re) eng. tutorial
Your money, your media a DRMtastic (reverse|re) eng. tutorial
Security BSides London
 
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram KharviUnderstanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Cysinfo Cyber Security Community
 
Features, Exportables & You
Features, Exportables & YouFeatures, Exportables & You
Features, Exportables & You
jskulski
 
BSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|re
BSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|reBSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|re
BSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|reChandra Pratap
 
Open frameworks 101_fitc
Open frameworks 101_fitcOpen frameworks 101_fitc
Open frameworks 101_fitc
benDesigning
 
Making Security Invisible
Making Security InvisibleMaking Security Invisible
Making Security Invisible
J On The Beach
 
Livecode widget course
Livecode widget courseLivecode widget course
Livecode widget course
crazyaxe
 
0507 057 01 98 * Adana Cukurova Klima Servisleri
0507 057 01 98 * Adana Cukurova Klima Servisleri0507 057 01 98 * Adana Cukurova Klima Servisleri

Similar to Designing Auto Generated Codes (20)

Sylius, the good choice
Sylius, the good choiceSylius, the good choice
Sylius, the good choice
 
DWX 2013 Nuremberg
DWX 2013 NurembergDWX 2013 Nuremberg
DWX 2013 Nuremberg
 
Know your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvmKnow your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvm
 
JS-formatter
JS-formatterJS-formatter
JS-formatter
 
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
 
Elixir in a nutshell - Ecosystem (session 1)
Elixir in a nutshell - Ecosystem (session 1)Elixir in a nutshell - Ecosystem (session 1)
Elixir in a nutshell - Ecosystem (session 1)
 
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023
A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023
A Multiplatform, Multi-Tenant Challenge - Droidcon Lisbon 2023
 
Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0
 
Your money, your media a DRMtastic (reverse|re) eng. tutorial
Your money, your media a DRMtastic (reverse|re) eng. tutorialYour money, your media a DRMtastic (reverse|re) eng. tutorial
Your money, your media a DRMtastic (reverse|re) eng. tutorial
 
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram KharviUnderstanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
 
Features, Exportables & You
Features, Exportables & YouFeatures, Exportables & You
Features, Exportables & You
 
BSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|re
BSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|reBSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|re
BSidesLondon | Your Money, Your Media - A DRMtastic Android (reverse|re
 
Open frameworks 101_fitc
Open frameworks 101_fitcOpen frameworks 101_fitc
Open frameworks 101_fitc
 
Making Security Invisible
Making Security InvisibleMaking Security Invisible
Making Security Invisible
 
Livecode widget course
Livecode widget courseLivecode widget course
Livecode widget course
 
0507 057 01 98 * Adana Cukurova Klima Servisleri
0507 057 01 98 * Adana Cukurova Klima Servisleri0507 057 01 98 * Adana Cukurova Klima Servisleri
0507 057 01 98 * Adana Cukurova Klima Servisleri
 

More from Hiroshi Kikuchi

Android Developer Toolsのバグを見つけて直してもらった話
Android Developer Toolsのバグを見つけて直してもらった話Android Developer Toolsのバグを見つけて直してもらった話
Android Developer Toolsのバグを見つけて直してもらった話
Hiroshi Kikuchi
 
今更聞けない? Androidのテストのいろは
今更聞けない? Androidのテストのいろは今更聞けない? Androidのテストのいろは
今更聞けない? Androidのテストのいろは
Hiroshi Kikuchi
 
新規Androidアプリ開発において何より大切なこと
新規Androidアプリ開発において何より大切なこと新規Androidアプリ開発において何より大切なこと
新規Androidアプリ開発において何より大切なこと
Hiroshi Kikuchi
 
モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選
モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選
モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選
Hiroshi Kikuchi
 
JUnit5とAndroidのテスト
JUnit5とAndroidのテストJUnit5とAndroidのテスト
JUnit5とAndroidのテスト
Hiroshi Kikuchi
 
KotlinJSって正直どうなん
KotlinJSって正直どうなんKotlinJSって正直どうなん
KotlinJSって正直どうなん
Hiroshi Kikuchi
 
画面状態を抽象化してテスタブル設計ライフを送ろう
画面状態を抽象化してテスタブル設計ライフを送ろう画面状態を抽象化してテスタブル設計ライフを送ろう
画面状態を抽象化してテスタブル設計ライフを送ろう
Hiroshi Kikuchi
 
テストコードをアプリケーションコードと同じ階層に置きたい
テストコードをアプリケーションコードと同じ階層に置きたいテストコードをアプリケーションコードと同じ階層に置きたい
テストコードをアプリケーションコードと同じ階層に置きたい
Hiroshi Kikuchi
 
Android thingsやってみた
Android thingsやってみたAndroid thingsやってみた
Android thingsやってみた
Hiroshi Kikuchi
 
どうしてコードはレガシーになるのか
どうしてコードはレガシーになるのかどうしてコードはレガシーになるのか
どうしてコードはレガシーになるのか
Hiroshi Kikuchi
 
Androidの世界を離れて異文化留学してみた
Androidの世界を離れて異文化留学してみたAndroidの世界を離れて異文化留学してみた
Androidの世界を離れて異文化留学してみた
Hiroshi Kikuchi
 
なるべくコードを書かないAndroid開発
なるべくコードを書かないAndroid開発なるべくコードを書かないAndroid開発
なるべくコードを書かないAndroid開発
Hiroshi Kikuchi
 
開発チームにKotlinを導入した話
開発チームにKotlinを導入した話開発チームにKotlinを導入した話
開発チームにKotlinを導入した話
Hiroshi Kikuchi
 
3分で作る Kotlin Friendly な API
3分で作る Kotlin Friendly な API3分で作る Kotlin Friendly な API
3分で作る Kotlin Friendly な API
Hiroshi Kikuchi
 
C#でiPhone & Androidアプリ!
C#でiPhone & Androidアプリ!C#でiPhone & Androidアプリ!
C#でiPhone & Androidアプリ!
Hiroshi Kikuchi
 
Ideatter : Tech-on2011決勝でのプレゼン資料
Ideatter : Tech-on2011決勝でのプレゼン資料Ideatter : Tech-on2011決勝でのプレゼン資料
Ideatter : Tech-on2011決勝でのプレゼン資料
Hiroshi Kikuchi
 

More from Hiroshi Kikuchi (16)

Android Developer Toolsのバグを見つけて直してもらった話
Android Developer Toolsのバグを見つけて直してもらった話Android Developer Toolsのバグを見つけて直してもらった話
Android Developer Toolsのバグを見つけて直してもらった話
 
今更聞けない? Androidのテストのいろは
今更聞けない? Androidのテストのいろは今更聞けない? Androidのテストのいろは
今更聞けない? Androidのテストのいろは
 
新規Androidアプリ開発において何より大切なこと
新規Androidアプリ開発において何より大切なこと新規Androidアプリ開発において何より大切なこと
新規Androidアプリ開発において何より大切なこと
 
モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選
モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選
モバイルアプリ開発をグッと楽にするKotlinの便利なところ3選
 
JUnit5とAndroidのテスト
JUnit5とAndroidのテストJUnit5とAndroidのテスト
JUnit5とAndroidのテスト
 
KotlinJSって正直どうなん
KotlinJSって正直どうなんKotlinJSって正直どうなん
KotlinJSって正直どうなん
 
画面状態を抽象化してテスタブル設計ライフを送ろう
画面状態を抽象化してテスタブル設計ライフを送ろう画面状態を抽象化してテスタブル設計ライフを送ろう
画面状態を抽象化してテスタブル設計ライフを送ろう
 
テストコードをアプリケーションコードと同じ階層に置きたい
テストコードをアプリケーションコードと同じ階層に置きたいテストコードをアプリケーションコードと同じ階層に置きたい
テストコードをアプリケーションコードと同じ階層に置きたい
 
Android thingsやってみた
Android thingsやってみたAndroid thingsやってみた
Android thingsやってみた
 
どうしてコードはレガシーになるのか
どうしてコードはレガシーになるのかどうしてコードはレガシーになるのか
どうしてコードはレガシーになるのか
 
Androidの世界を離れて異文化留学してみた
Androidの世界を離れて異文化留学してみたAndroidの世界を離れて異文化留学してみた
Androidの世界を離れて異文化留学してみた
 
なるべくコードを書かないAndroid開発
なるべくコードを書かないAndroid開発なるべくコードを書かないAndroid開発
なるべくコードを書かないAndroid開発
 
開発チームにKotlinを導入した話
開発チームにKotlinを導入した話開発チームにKotlinを導入した話
開発チームにKotlinを導入した話
 
3分で作る Kotlin Friendly な API
3分で作る Kotlin Friendly な API3分で作る Kotlin Friendly な API
3分で作る Kotlin Friendly な API
 
C#でiPhone & Androidアプリ!
C#でiPhone & Androidアプリ!C#でiPhone & Androidアプリ!
C#でiPhone & Androidアプリ!
 
Ideatter : Tech-on2011決勝でのプレゼン資料
Ideatter : Tech-on2011決勝でのプレゼン資料Ideatter : Tech-on2011決勝でのプレゼン資料
Ideatter : Tech-on2011決勝でのプレゼン資料
 

Recently uploaded

Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

Designing Auto Generated Codes

  • 1. Designing Auto Generated Codes 17 Nov 2015 Roppongi.aar #2 @kikuchy
  • 2. • Hiroshi Kikuchi (@kikuchy) • Belonging to , inc , Working on , inc (mixi group) • Making Dating App for Android • Strict review OJISAN Who am I
  • 3. APT made our work reduced!! So, you use APT, and be happy!! \\٩( 'ω' )‫و‬ ////
  • 4. … I was going to talk about like that, but
  • 5.
  • 6.
  • 7. Oh, you are already using APT.
  • 10. So, I ll talk about
  • 12. What is the best way to use Generated Code in our project? Please consider and discuss.
  • 15. If you make an awesome library hiding generated codes… // Fields @ExecuteSomething String foo; // Executor class “ThisClass$$Executor” is generated. // My library loads executor class automatically! AwesomeLibrary.execute(this);
  • 16. Alice changes Naming Rule of Generated Class. ex) (ClassName)$$Executor -> (ClassName)$$Doer
  • 18. < Hey, I obfuscated your code! Proguard @ Production Build
  • 19.
  • 20.
  • 21.
  • 23. If you make awesome proguard-safe library… // Fields @ExecuteSomething String foo; // Executor class “ThisClassExecutor” is generated. // There are no reflection, no ClassNotFoundException!! new ThisClassExecutor().execute(this);
  • 24. Bob often asks you What s the name of Generated Classes and methods and constructor arguments and interfaces will use in Generated Code blablabla…
  • 25. Why ask me repeatedly ? Why I have to remember invisible codes? Bob < https://www.flickr.com/photos/greeblie/2190709020/
  • 26.  / / / /    / |  /    `、 i  !  |i   i  ,  l   / / //   /   | /       | |  |  l !  i  |  | `/ー- 、 / /    | /       | l   |  l l  !  !  i / ,,,,- ニ=x- 、_   !/       |i  _, +十'イ  i  !  ! ''" / :;;r jヽ ` ̄  リ      ,, -=、 レ | / /  :|  /:::::;;;;;;;:`::::::l          / :;;r ヽヽ   |/| /   :!  |::::::::;;;;;;;;:::::::l             l:::;;;;;` ::| l  //    :!   '、:_ ''''  ノ          l  '''' ノ |  /    :| ::::::::..  ̄               ` ー '   ,'      :| ::::::::::::            ,    ..::::::::::::..l  .:|   :| ::::::::::                :::::::::::::::::::|  :|   :| Mmmm…                     ::::::::::::::: l .:|  l  :|                          /  :| :l  :|                       , '   :::| :|  :| ` 、     ⊂ニ==ー‐-     , イ    ::::| :|  :|
  • 27. hiding generated codes no reflection vs
  • 29. Compare patterns Butter Knife pattern (hiding generated codes) Dagger2 pattern
 (no reflection) How to load generated codes Library dose everything Developers have to import Proguard configuration is needed not needed Developers have to learn only usage of library + generated class naming rules Type-Safe No Yes
  • 30. Which we should adopt?
  • 33. Don’t forget proguard conf? Start ↓ Like beautiful API? Is not solidity app necessary? → → Yes No↓ “Dagger2” pattern → No Yes ↓ No↓ “Dagger2” pattern “Dagger2” pattern “Butter Knife” pattern Yes
  • 36. Appendix 1: Auto code generation patterns
  • 37. • Java Annotated Source Codes • Using APT. • ex) Dagger2, ButterKinfe, JsonPullParser, etc… • Externals • Gradle Task (depends on compileJava task) • ex ) R.java, genum (← I m developing now!!!!!!!!!!!) Source of Source Codes
  • 38. Generated Class Depends on… • Only Interface • MyOwnInterface instance = new GeneratedClass(); • ex) Dagger2, (Retrofit) • Library Classes • LibrarySuppliedBase instance = new GeneratedClass(); • ex) Shillelagh, etc… • Nope ¦¦ Unknown • (Generated classes are hidden.) • ex) ButterKnife, IntentBuilder, DeepLinkDispatch
  • 41.
  • 43. public class UserSearchRequest { public EnumSet<UserKind> kind; public String freeWord; public int ageMax; … }
  • 44. @ToQueryMap public class UserSearchRequest { @QueryParam(name = “kind”, adapter = UserKindAdapter.class) public EnumSet<UserKind> kind; @QueryParam(name = “free_word”, adapter = StringAdapter.class) public String freeWord; @QueryParam(name = “age_max”, adapter = IntAdapter.class) public int ageMax; …
  • 45. public final class UserSearchRequestSerializer { public Map<String, String> serialize(UserSearchRequest request) { Map<String, String> map = new Map<>(); map.put(“kind”, userKindAdapter.adapt(request.kind)); map.put(“free_word”, stringAdapter.adapt(request.freeWord)); map.put(“age_max”, intAdapter.adapt(request.ageMax)); … return map; } GENERATED
  • 47. Thank you for listening!