4 ms·
Apache Groovy: Combining the Best of Python and Java
- skitter 3y agoOdd choice to tell readers to stay tuned for the other articles instead of linking to them. The intro seems a bit superficial – if Groovy combines Java & Python, wouldn't it make sense to at least mention what inspiration it takes from Python and where it's on the untyped-typed scale is? The tone of the series feels like marketing speech: "Variables in Apache Groovy: Powerful, concise and easy" Instead we get an entire article about getters and setters, which uses a Java example with pointless getters and setters that just directly read/write a variable. > Groovy has syntactic support for maps using [] to get and set the value based on the variable within the square brackets Why variable? Does that mean you can't use expressions for indexing? System.err.println "Usage: groovy Groovy01.groovy input-file" System.exit(0) Why does only the second call need parentheses? String s s = 42 Looks like Groovy is weakly typed? strParam != null && strParam.isInteger() ? Integer.parseInt(strParam) : 0 Doesn't Groovy already have if-else? Why also add `?:` ? > In the previous article, you learned that Groovy’s version of truth means you don’t need to test for not null The previous article doesn't even mention the word truth.