Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

worth to learn groovy? [closed]

the question im asking, is it worth to learn a new language like groovy? cause if i learn groovy, it feels like i code in groovy and not java. and how smart is that when i have to be good in java to code desktop applications too in the future. so if i use groovy a lot for web applications, i will just be worse and have to start over to be good in java when i code desktop applications right?

so why don´t I just stick with java and be good at ONE language instead of having to switch between 2 languages and their syntax. Cause it would be so confusing...

like image 519
ajsie Avatar asked Jan 09 '10 21:01

ajsie


People also ask

Is Groovy worth learning 2022?

There is a great chance that you already know a couple of these tools as they are quite popular in the Java world, particularly Gradle, but if you don't know, 2022 is the best time to learn them. Groovy tools and frameworks are simple, easy-to-learn and can improve your productivity a lot.

Is it worth to learn Groovy?

Groovy programming language is much easier to learn and much of the code that you write using it will compile and work as expected. The learning curve for Groovy is small. It is not difficult for someone who is proficient in Java to get started with Groovy. The build tool is rapidly gaining popularity.

Is Groovy outdated?

Groovy is still actively developed by a group of contributors - the next 3.0. 0 release will drop the support for older JDK version (requires JDK8+) and will introduce a lot of new features and improvements, like Parrot parser that will allow using e.g. Java lambdas and method references in the Groovy code.

Is Groovy in demand?

The same is the case with Groovy vs Scala. Both the programming languages are in demand for their unique characteristics and need. Mobile and web applications are in constant demand for various reasons. And this results in over 5 million mobile applications available.


3 Answers

Groovy is a nice, scriptable and easier-to-use Java "knockoff" – and I don't mean that derogatively. while Java is a language to be compiled, deployed and (often) run on Enterprise servers where performance matters, Groovy is a language where you can quickly create a program to get something done. Often that something is fairly simple, so it's an hour's or a day's coding effort. Often the code is only run once and then thrown away. Because Java has more boilerplate and formalism in it, you can do this kind of program more quickly and hence more efficiently in Groovy.

However, just to give you some perspective, Groovy is a relative newcomer stomping on the turf of various other, better established scripting languages:

  • Perl is one of the grandfathers of scripting languages; rarely does a Unix server get installed without Perl on it, and Perl scripts are the lifeblood of many servers. However, Perl is a write-only language that looks like line noise to the uninitiated. There's more than one way to do everything, so styles diverge drastically. Perl coding tends to be a bit messy.

  • Python is a fresher, cleaner script language than Perl, and is these days preferred by many as a scripting language. It's fun to program in, it gets things done and because it's been around for a few years, lots of people know it. Python is found behind/inside a number of Linux system utilities.

  • Groovy leaves Perl and Python in the dust when (a) the environment already makes use of a JVM and/or there's a requirement to use existing Java code, including libraries. So far so good. Groovy is not blazingly fast, but faster than Python. Being dynamically typed, it's "fun" and "easy" to program in a way that Java's not.

  • But then came Scala. Scala is like Java on steroids. It is statically typed so it's not quite as "fun" to program as Groovy, but it has type inference so often you can leave off the types and the compiler can figure them out. Scala works really hard to make the most of types; it does generic types a lot more seamlessly than Java. It dispenses with a lot of Java's boilerplate, so Scala programs are typically about 30% shorter than similar Java programs. Scala runs on the JVM and interfaces pretty well with Java code. It also runs about as quickly as Java, which most of the other languages don't.

  • Finally in historic order, there's Clojure. Clojure is a Lisp derivative, so it has a programming style very different from languages you'd otherwise know, and it burns through a lot of parentheses! But Clojure runs on the JVM, is very compatible with all the rest of Java, and it's dynamically typed. You can use it as a scripting language or treat it like a compiled language... it's up to you. I find it fun to program in, and the fact that it's an almost pure functional language forces you to think in new ways about programming. It hurts your head at the beginning, but if you survive it's a very worthwhile exercise because you learn some techniques that will become more relevant (I think) in future programming.

In summary, it would probably do you good (put hair on your chest, if I may be so sexist) to learn one or more of these "alternative" / "scripting" languages. You may find them useful. Usually when there's something to be hacked up quickly in my project, I get the job because all my colleagues only know Java, and by the time they finish setting up their class framework I'm already done.

like image 142
Carl Smotricz Avatar answered Oct 11 '22 03:10

Carl Smotricz


Quote:

so why don´t I just stick with java and be good at ONE language instead of having to switch between 2 languages and their syntax.

This seems like a more general question about learning programming languages than learning a new language (Groovy) which runs on top of the Java Virual Machine.

Here's a question:

Suppose you are learning a foreign language because you want to be fluent in multiple languages so you can converse with many people. You're learning German right now, but you're getting good at it, but you also want to learn Spanish. Would you just suddenly forget German if you start to learn Spanish? If you are indeed worried that you will, what would you do?

If you were going to learn Groovy, but don't want to forget how to write Java, then why not continue to use both languages at the same time?

One of the things about being a programmer is going to be learning to adapt to new technologies as they come along. It's a good thing to be able to learn new languages, as it's going to be a skill that's going to be very useful in a field which is constantly changing.

like image 38
coobird Avatar answered Oct 11 '22 03:10

coobird


Why don't you code your desktop apps in groovy too? Just because groovy is the choice of a web framework (grails) doesn't mean that you can't use it for desktop apps.

Indeed, it is great for desktop apps too. It's more a matter of dynamic or static languages...

In my opinion, it is quite good to have for each task the right language at hand. So go ahead and learn groovy - the result will be that you'll miss groovy features when you try to use java again ;-)

like image 7
rdmueller Avatar answered Oct 11 '22 05:10

rdmueller