groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Illogica Software <illogica.softw...@gmail.com>
Subject Re: Groovy to develop for Android
Date Sat, 16 May 2015 07:06:33 GMT
I'll drop my two cents here.
Disclaimer: I' m not an Android professional, (my main income comes from
industrial automation and PLC programming) but I do write Android apps in
my spare time, so please feel free to skip the following text.

Being a "one man band", I tend to seek for the most productive and easier
to learn tools for the job. You know, time is precious. My programming
background from the Uni is mostly Java, now I'm all the way into Groovy.
In my opinion when you talk about Android you must start from Java, you
can't start from anywhere else; before trying another language you have to
understand all Android paradigms (Activities, Fragments, Handlers,
AsyncTasks, Services, Intents, and so on and on and on) in the language
they were conceived; after getting familiar with these structures, you can
try and switch focus to another language.
Back in the day discovering Groovy for me was a pleasant surprise: just
rename your *.java in *.groovy and you are mostly fine. In Android you also
need to reorganize the file tree and adjust your build.gradle, but that's
it, then you can enjoy compact and sweeter syntax, and you can make your
code groovy-er along the way. Easiest and fastest way to learn and apply a
language, in my opinion.

Long story short, I've been using the Grooid plugin since its early stages
and I'm not planning to switch back. I've ported one of my apps from Java
to Groovy and observed the latter produces an apk bigger by a couple of
megabytes. At runtime the Groovy app eats 3 megabytes more ram than the
original Java one, i notice some kind of lag during app startup, (I'm using
@CompileStatic everywhere). I find these differences neglectable for my
purpose, but you may not.
What really bothers me about Groovy for Android is the lack of "best
practices", I've studied C├ędric apps and some parts still look like black
magic to me. I really need some sort of documentation dedicated to Android,
or Android development guidelines as you pointed out.

You mention "Lots of resources claim that Groovy is a dead end". I think
this post is quite reassuring on the future of Groovy:
http://melix.github.io/blog/2015/02/who-is-groovy.html

While seeking for the most productive language for Android, my experience
with Kotlin was mostly driven by personal taste (therefore it was quite
improductive): already knowing Groovy I found Kotlin redundant for my uses.
It seems like its performance is closer to Java's than Groovy's, but I
can't really advice on this matter.

Best regards,
Loris


2015-05-15 18:43 GMT+02:00 Dmitry Semionin <dmitry.semionin@gmail.com>:

> Hello everybody,
>
> Recently i decided to learn how to develop for Android. But after learning
> some Java and reading about the way the modern Java features are adopted by
> the Android toolchain, i realized that the "classical" Java is not my way
> towards Android. Some googling around showed that two of the most obvious
> alternatives are Groovy and Kotlin. Both of these options have their pros
> and cons, which i will mention below. And since the most typical Q&A place
> for programmers (StackOverflow) doesn't approve the "... vs ..." questions
> calling them non-constructive, my best option is to look for practical
> advice from the Groovy community. Hopefully that won't be against any rules
> =).
> Long story short, in theory both variants are not perfect, and i would
> really like to cut some corners and learn from someone else's practical
> experience. Asking the Kotlin community doesn't seem like a good idea since
> they are corporately backed and may have some bias towards the competitors.
> And Groovy is an open tool nobody's paid to endorse, so who could answer my
> questions better than you guys =).
>
> Anyway, that's what i've read so far about Groovy as a tool for Android
> development.
>
> Pros:
>
> 1. As of version 2.4, Groovy officially supports Android as a platform.
> 2. I seem to like Groovy's syntax compared to Kotlin's.
> 3. It's been around for a while, much larger userbase, tons of answered
> questions on SO, several books from independent authors, so it looks like i
> won't be alone in the woods on this path.
>
> Cons:
>
> 1. No official Android development guides, and not much 3rd party info
> that could work as a guide for Android development using Groovy.
> 2. From what i know, the shaky situation with project sponsorship, so it's
> unclear how well will the project be evolving.
> 3. The benchmarks i've seen show that Groovy is substantially slower than
> Kotlin and its runtime is heavier, which means performance drawbacks and
> bigger binaries.
> 4. Lots of resources claim that Groovy is a dead end and that the interest
> to it is on a steady decline. Don't know if it's true but i'd definitely
> like to avoid studying a dying technology.
>
> As for Kotlin
>
> Pros:
>
> 1. Strong support from a big and successful company who knows how to make
> development tools.
> 2. Is said to be small and fast.
> 3. In every "Groovy vs Kotlin" discussion i've seen so far, Kotlin is the
> one people recommend.
> 4. Has a section in documentation dedicated to Android development, so at
> least setting up the required tools won't be a problem.
>
> Cons:
>
> 1. Kinda immature, still in beta, not so widely adopted.
> 2. I don't find its syntax appealing.
> 3. Best suited for use inside the JetBrains ecosystem, which means that
> outside of it there might be some issues.
>
> To make myself formal, i'm addressing only those of you guys who had an
> actual experience developing for Android using Groovy/Kotlin:
>
> 1. When developing for Android with Groovy, did you encounter any issues
> that you could not easily solve and that made you consider switching to a
> different programming language?
> 2. Could you recommend Groovy as a primary Android development tool to a
> programmer with no previous Android experience?
> 3. (Optional, answer only if you feel you have enough of an outlook on
> this topic) What language (and related tools) seems the most optimal to you
> for Android development, if we took into account flexibility, learning
> curve, stability and the public adoption?
>
> Please correct me if i did something wrong, it's my first time using a
> mailing list. And obviously thanks to everyone who'll find a time to read
> this email and answer my questions.
>
> - Dmitry Semionin
>

Mime
View raw message