Worth knowing groovy?

The question I ask is, is it worth learning a new language like groovy? because if I recognize groovy, it seems to me that I'm code in groovy, not java. and how reasonable is it when I have to be good at java for coding desktop applications too in the future. so if i use groovy a lot for web applications, will i just get worse and have to start working to be good in java when i use desktop applications correctly?

so why I just don’t stick with java and can't speak the same language instead of switching between the two languages ​​and their syntax. Because it would be so confusing ...

+6
language-agnostic groovy
source share
12 answers

Quote:

so why don't I just insert java and be good in ONE language instead of switching between two languages ​​and their syntax.

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

Here is the question:

Suppose you are learning a foreign language because you want to be fluent in several languages ​​so that you can communicate with many people. You are learning German right now, but you understand it well, but you also want to learn Spanish. Do you suddenly forget German if you start learning Spanish? If you really care what you want, what would you do?

If you are 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 will be learning to adapt to new technologies as they become available. It is a good thing to be able to learn new languages, as it will be a skill that will be very useful in a field that is constantly changing.

+11
source share

Groovy is a nice, easy-to-write script and easy-to-use Java "knockoff" - and I don't mean this digression. while Java is the language that must be compiled, deployed, and (often) run on corporate servers where performance matters, Groovy is the language in which you can quickly create a program to do something. Often, something is pretty simple, so it's an hour or a day of coding effort. Often, code is run only once and then discarded. Since Java has more templates and formalism, you can make this program faster and therefore more efficient in Groovy.

However, to give you some perspective, Groovy is a relative novice stomping on peat other other better established scripting languages:

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

  • Python is a more recent, cleaner scripting language than Perl, and today it is preferred by many scripting languages. It is fun to program, it does everything, and because it has been for several years, many people know this. Python is behind / inside a number of Linux system utilities.

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

  • But then came Scala. Scala is like Java on steroids. It is statically typed, so it’s not really “fun” to program like Groovy, but it has type inference so often that you can omit types and the compiler can figure them out. Scala works very hard to make the most of types; it makes generic types much smoother than Java. It does not use many Java patterns, so Scala programs are usually 30% shorter than similar Java programs. Scala runs on the JVM and interacts quite well with Java code. It also runs as fast as Java, which most other languages ​​do not.

  • Finally, in historical order, Clojure. Clojure is a derivative of Lisp, so it has a programming style that is very different from the languages ​​you would know, and it burns a lot of parentheses! But Clojure runs on the JVM, is very compatible with the rest of Java, and is dynamically typed. You can use it as a scripting language or consider it as a compiled language ... it is up to you. I am very interested in programming, and the fact that it is an almost pure functional language makes you think in a new way about programming. At first you have a headache, but if you survive this very useful exercise, because you will learn some methods that will become more relevant (I think) in future programming.

All in all, this is likely to benefit you (attach chest hair if I can be sexist) to learn one or more of these “alternative” / “scripting” languages. You may find them useful. Usually, when something quickly breaks into my project, I get a job because all my colleagues know only Java, and by the time they finish setting up their class structure, I already did.

+38
source share

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

Indeed, it is great for desktop applications. It is rather a matter of dynamic or static languages ​​...

In my opinion, it’s nice to have the right language for each task. So, continue to study groovy - the result will be that you will skip the grovy functions when reusing java; -)

+7
source share

I would say that in general, it is always good to study in this area. I try to constantly learn new concepts in order to add to my toolbox, improving the main things that interest me, for example, Java. I recently purchased a book on learning Clojure, another functional language for the JVM.

The disadvantage of learning something without using it every day is that some details do not stick to the head. However, I'm glad I spent some time with Clojure; important things are stuck, and I know that I can quickly see the details if and when I need. You might want to take a similar approach to Groovy.

+4
source share

The Java platform is gradually starting to shift in the direction where the JVM is aimed at several source languages ​​(the .net trick is demonstrated from the first day, but it takes Java to catch up there). The Java7 class file format even adds new instructions to speed up these dynamic languages.

If you want to keep yourself up to date, then learning Groovy is a good way to do this without giving up all your investment in the Java platform.

In addition, Groovy (and Grails) is now supported by SpringSource, so its popularity will only increase.

+3
source share

Switching from java to groovy is not a lot of work. No where do you need to switch to a less java language like clojure.

I really like groovy for one-time applications and for scripting existing Java code. I used it to parse data from REST calls and transfer data to the JMS queue. I used it to create scrambled test data for a partner from our production data. For such things, this is awesome.

If the goal is to learn a dynamic language to add to the toolbar, Python and Ruby are a good choice. They run on the JVM and have their own versions. Both of them are well supported on a large number of platforms.

If the goal is to learn an alternative JVM language, groovy is a great choice. Both Scala and Clojure would also be a good choice.

I used to adhere to the rule "learn a new language every year" from the "Pragmatic Programmer", but this was before I gave birth to children. Now I learn the toy of the new building every six months.

+3
source share

First of all, I am a very subjective question.

In my humble opinion, it is worth learning a new language, especially if it changes in paradigms (as is the case with groovy). I am quite young, so for me learning a new language is not a big problem, but as I see it, if you like this language, you think that coding in X will be profitable, you should learn it.

This does not hurt your resume. It will not make your head hurt (a lot). The only problem you will use it. For this you need to use the language. If you are going to study it now and never use it tomorrow, then you probably should not study it.

+2
source share

Learning something new does not take away what you already know. When you return to Java, you may be a little rusty, but it will return very quickly.

And -

I'm not a Java guy, but I believe Groovy is targeting the JVM. If so, then programming in Groovy will make you a better Java programmer, because you will continue to focus on the same structure as Java (language), so that you continue to gain experience with Java libraries. Knowing the available libraries is what really matters, not how well you know the details of a particular language every minute.

+1
source share

I find that when I learn new languages, I always get new ways to think about problems. Each language helps you solve problems most easily expressed by the language. Learning new languages ​​only makes you stronger because you are learning new ways to solve problems.

You may have to reorient yourself with libraries after a long time from the language, but even then it is not a very difficult test - more frequent Google searches, etc.

The benefits, however, are worth it. I recently did some functional programming for the first time, and he really taught me different ways to think about some situations. I found that I now use some functional aspects of C #, and in some cases my code is much cleaner. The bottom line is this: if you are going to do this for a living, you will want to learn more than one language, have you ever met a mechanic who knew only one model and a car model?

+1
source share

It’s always good to learn a new language to be the best programmer. Groovy is a natural choice for a Java programmer - it's easy to learn, and you can still use all your java knowledge.

Groovy is a dynamic language, after learning any functional language (e.g. Scala). With this experience you will see java from different perspecitve. Some task that was painful in Java would be trivial in Groovy / Scala.

0
source share

you can program your desktop application with Griffon, Groovy is the language of choice, try

0
source share

If you are looking for online help, visit the website:

-one
source share

All Articles