SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
with Logcat
Sanaebadi97
Gradle Kotlin DSL
Tutorial
What is Kotlin DSL ?
If you’ve ever used SQL before or Groovy
with Gradle, it means that you’ve used a
DSL language before. DSL stands for
Domain Specific Language, which is a type
of programming language that cares mainly
about the readability by enforcing the use of
declarative code with minimal boilerplate
(declare to use) instead of imperative code
(explaining how to solve a problem) but as a
drawback, it can be used only inside a
specific context or domain.
Kotlin is already proven to be a very powerful and safe production-ready programming
language especially. As a GPL (General Purpose Language) Kotlin has some great features
that enable writing very clean code with minimal syntax, things like Lambdas with receivers
that can be used outside of method parentheses and infix function notation. These features
permit to write DSL-like code with minimal effort.
Jetbrains’ Anko library brought the power of Kotlin DSL to clean verbose Android API
especially XML layouts.
Being built on top of the core language makes Kotlin DSL considered as an Internal DSL
which means that it does not have a syntax on its own, rather being a library that offers DSL
readability by exploiting the mother GPL language features, in this case, Kotlin.
Gradle Kotlin DSL Primer
Promises made by Kotlin DSL :
● A statically typed and a type-safe DSL (inherited from Kotlin)
● An enhanced IDE editing experience (inherited from Kotlin)
● Interoperability with existing scripts (as a JVM language)
● Maximum readability (as any DSL)
● Consistency and superpower (by using the same language across the project — source
code and configuration 100% Kotlin)
Why should I even care?
Shortly, because Groovy is a dynamically typed language, and because it’s very likely that
you have come across one of these problems when dealing with build script files for Android
:
● Very poor IDE assistant when writing a Groovy DSL script
● Performance issues*
● Errors at build runtime instead of compile-time
● Painful build script debugging experience
● Refactoring is a pain in
Reference : Medium
Read more :
Medium
Github
AndroidRiver
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

蔡学镛 Rebol漫谈
蔡学镛   Rebol漫谈蔡学镛   Rebol漫谈
蔡学镛 Rebol漫谈
d0nn9n
 
Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
lennartkats
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
lennartkats
 
Coldfusion
ColdfusionColdfusion
Coldfusion
Ram
 
Objective-C with respect to C# and Java
Objective-C with respect to C# and JavaObjective-C with respect to C# and Java
Objective-C with respect to C# and Java
Babul Mirdha
 

Was ist angesagt? (18)

Introduction to Go-Lang
Introduction to Go-LangIntroduction to Go-Lang
Introduction to Go-Lang
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)
 
Golang, Future of Programming Language.
Golang, Future of Programming Language.Golang, Future of Programming Language.
Golang, Future of Programming Language.
 
DSLs: what, why, how
DSLs: what, why, howDSLs: what, why, how
DSLs: what, why, how
 
蔡学镛 Rebol漫谈
蔡学镛   Rebol漫谈蔡学镛   Rebol漫谈
蔡学镛 Rebol漫谈
 
Java vs kotlin
Java vs kotlin Java vs kotlin
Java vs kotlin
 
Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
 
Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)
 
Managed Code .NET
Managed Code .NETManaged Code .NET
Managed Code .NET
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
Golang introduction
Golang introductionGolang introduction
Golang introduction
 
Coldfusion
ColdfusionColdfusion
Coldfusion
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
Objective-C with respect to C# and Java
Objective-C with respect to C# and JavaObjective-C with respect to C# and Java
Objective-C with respect to C# and Java
 
EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...
EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...
EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...
 
[EclipseCon France 2017] Eclipse Platform Generic Editor
[EclipseCon France 2017] Eclipse Platform Generic Editor[EclipseCon France 2017] Eclipse Platform Generic Editor
[EclipseCon France 2017] Eclipse Platform Generic Editor
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
 

Ähnlich wie Log cat kotlindsl

Ähnlich wie Log cat kotlindsl (20)

Android with Kotlin Course - SkillIQ.pdf
Android with Kotlin Course - SkillIQ.pdfAndroid with Kotlin Course - SkillIQ.pdf
Android with Kotlin Course - SkillIQ.pdf
 
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
 
Groovy DSL
Groovy DSLGroovy DSL
Groovy DSL
 
Introduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptxIntroduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptx
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How?
 
Kotlin - A Beginner’s Guide__________________
Kotlin - A Beginner’s Guide__________________Kotlin - A Beginner’s Guide__________________
Kotlin - A Beginner’s Guide__________________
 
Kotlin tlv
Kotlin tlvKotlin tlv
Kotlin tlv
 
Kotlin
KotlinKotlin
Kotlin
 
Kotlin native for iOS and Android
Kotlin native for iOS and AndroidKotlin native for iOS and Android
Kotlin native for iOS and Android
 
Android Development with Kotlin course
Android Development  with Kotlin courseAndroid Development  with Kotlin course
Android Development with Kotlin course
 
Android with kotlin course
Android with kotlin courseAndroid with kotlin course
Android with kotlin course
 
CC Presentation.pptx
CC Presentation.pptxCC Presentation.pptx
CC Presentation.pptx
 
Kotlin vs-java-which-will-succeed-android-development-in-coming-times
Kotlin vs-java-which-will-succeed-android-development-in-coming-timesKotlin vs-java-which-will-succeed-android-development-in-coming-times
Kotlin vs-java-which-will-succeed-android-development-in-coming-times
 
Kotlin
KotlinKotlin
Kotlin
 
Kotlin vs Java-A Comparison for Application Development Projects.pdf
Kotlin vs Java-A Comparison for Application Development Projects.pdfKotlin vs Java-A Comparison for Application Development Projects.pdf
Kotlin vs Java-A Comparison for Application Development Projects.pdf
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
 
What's DSL and what isn't
What's DSL and what isn'tWhat's DSL and what isn't
What's DSL and what isn't
 
Why Kotlin?
Why Kotlin?Why Kotlin?
Why Kotlin?
 
Kotlin App Development Tips.pdf
Kotlin App Development Tips.pdfKotlin App Development Tips.pdf
Kotlin App Development Tips.pdf
 
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdfLearn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
 

Kürzlich hochgeladen

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
Wonjun Hwang
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 

Kürzlich hochgeladen (20)

ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 

Log cat kotlindsl

  • 2. What is Kotlin DSL ? If you’ve ever used SQL before or Groovy with Gradle, it means that you’ve used a DSL language before. DSL stands for Domain Specific Language, which is a type of programming language that cares mainly about the readability by enforcing the use of declarative code with minimal boilerplate (declare to use) instead of imperative code (explaining how to solve a problem) but as a drawback, it can be used only inside a specific context or domain.
  • 3. Kotlin is already proven to be a very powerful and safe production-ready programming language especially. As a GPL (General Purpose Language) Kotlin has some great features that enable writing very clean code with minimal syntax, things like Lambdas with receivers that can be used outside of method parentheses and infix function notation. These features permit to write DSL-like code with minimal effort. Jetbrains’ Anko library brought the power of Kotlin DSL to clean verbose Android API especially XML layouts. Being built on top of the core language makes Kotlin DSL considered as an Internal DSL which means that it does not have a syntax on its own, rather being a library that offers DSL readability by exploiting the mother GPL language features, in this case, Kotlin. Gradle Kotlin DSL Primer
  • 4. Promises made by Kotlin DSL : ● A statically typed and a type-safe DSL (inherited from Kotlin) ● An enhanced IDE editing experience (inherited from Kotlin) ● Interoperability with existing scripts (as a JVM language) ● Maximum readability (as any DSL) ● Consistency and superpower (by using the same language across the project — source code and configuration 100% Kotlin)
  • 5. Why should I even care? Shortly, because Groovy is a dynamically typed language, and because it’s very likely that you have come across one of these problems when dealing with build script files for Android : ● Very poor IDE assistant when writing a Groovy DSL script ● Performance issues* ● Errors at build runtime instead of compile-time ● Painful build script debugging experience ● Refactoring is a pain in Reference : Medium