Skip to main content
Software Engineering

Questions tagged [groovy]

Groovy is a Java-based "next generation" programming language designed to improve Java while adding popular features from Smalltalk, Python and Ruby. Groovy syntax is a super-set of Java which allows Java developers to begin coding in Groovy as they learn it. Groovy is fully object-orientated, dynamic and seamlessly integrates with Java. Market-wise, the success of Groovy is anybody's guess. Main competitors are Ruby, Scala and Closure.

Filter by
Sorted by
Tagged with
1 vote
2 answers
99 views

Test-doubling a file path in Java/Groovy

I am trying to write a unit test for a helper method in my ApiRequestHandler which handles APIGatewayProxyRequestEvent . This class uses an EFS file path, which is where it writes files to. I have ...
2 votes
2 answers
161 views

Is the process of building a model from a dictionary necessarily the builder pattern?

I am working on a tool that scrubs Do-Not-Call (DNC) phone records from a skip-traced CSV file. I have this PhoneModel for child phone entries for each row. It consist of the following fields: isDNC ...
0 votes
0 answers
142 views

Is it a code smell to have to query a dictionary for a key whose value matches some criteria?

I am working on a ChildModelListSheetHandler, that has a childModelListDict. As what you're probably thinking, it maps the foreign keys that are the IDs of the parent models, to the list of child ...
0 votes
2 answers
244 views

Is it a code smell to put selection strategy concerns in an enum class?

Right now, I have this enum, called MemberCategory, defined to be: public enum MemberCategory { MEMBERSHIP("Membership"), GOLD_MEMBERSHIP("Gold"), SILVER_MEMBERSHIP(&...
1 vote
2 answers
593 views

How to design a process and use the business rules for sending alerts/notifications

Currently working on designing a process which demands me to send alerts like email notifications to the users which meet a business criteria(we can also call business rules). I want to make this ...
2 votes
2 answers
306 views

Is it clean to place method for comparing 2 objects of same class into that class?

Let's say I have class Car (just for illustration) class Car { ... boolean isRed(); ... } where to place methods which acts with objects of same class, in my example Car, but not just on ...
0 votes
0 answers
2k views

Are groovy automatic getters and setter effectively any different to public variables?

To provide a very blunt example (as I am at work and can't currently think of a sensible example). If I write a groovy class like this class Wendy{ byte[] frank String doSomethingWithFrank(){...
WendyG's user avatar
  • 133
1 vote
3 answers
151 views

POLA, Constructor and Getters

As a followup to this question and one I asked a while ago, suppose if I had an Author class structured like this: class Book { private String title; private Set<Author> authorsSet; ...
user avatar
user313955
1 vote
3 answers
829 views

Is calling .sort() in the constructor a violation of the guideline that a constructor shouldn't do work?

Suppose I have the following List to hold a list of fruits. Example: def fruits = ["Apple", "Orange", "Grapes"] def fruitsBowl = ["Apple", "Grapes", "Orange"] // Will print false println(fruits....
user avatar
user313955
2 votes
2 answers
379 views

Highlighting importance of order when using short-circuited conditions

I was working on a piece of code when I noticed that an if statement could work or crash depending on the order used for the parts connected with and. You can replicate the problem like this: ...
13 votes
1 answer
1k views

What does 'syntax vinegar' mean

I was reading through Groovy in Action, Second Edition and on a footnote, I found the following text Java pours "syntax vinegar" over such a construct to discourage programmers from using it. What ...
1 vote
1 answer
240 views

Does Groovy/Grails have code completion/pre-runtime error detection/find refrences like Java?

I have been using Java for a while and PHP recently. Some things I miss from Java is Code completion suggestions from the IDE Error detection before runtime Find places where a method/function is ...
1 vote
0 answers
130 views

Updating class property inside the method vs. returning a value from the method

In a large code base, what is a good practice between: Updating class properties inside the method vs. returning a value from the method and updating the property in the place where the call to the ...
31 votes
2 answers
24k views

When to use def in Groovy?

I have been developing in Groovy for a little while now and I'm wondering how often I should be using the dynamic casting def? A co-worker of mine believes we should use it always as it helps Groovy ...
PJT's user avatar
PJT
  • 413
-1 votes
1 answer
16k views

Groovy date/time compare [closed]

I have this string got from JIRA as the date/time I need to compare which one is earlier:"21/Sep/12 2:01 PM". How can I do this in Groovy? Thanks Jirong

15 30 50 per page
1
2 3

AltStyle によって変換されたページ (->オリジナル) /