Confused about scope
Blake McBride <[email protected]> Fri, 27 Sep 2024 14:04:16 -0500
| Newsgroups | gmane.comp.lang.groovy.user |
|---|---|
| Message-ID | <CABwHSOs6w4miLSq_Wmwg=fJBMVp4LKsJQq=odWVg2sYr_Y9WLg@mail.gmail.com> |
Greetings, Although I have been using Groovy for years, I have largely been ignoring scoping as it relates to classes, methods, and fields. It is my opinion that having private and package-level scoping is critical. Controlling scope is critical to managing a large project. The way I've been ignoring the issue is: 1. I just assume it's the same as Java and treat it that way. 2. Since my large project (~9,000 classes) is broken down into small packages, I also control visibility by not cross-accessing packages. (I understand the field property bit.) My problem is because of two factors: 1. The documentation that comes with Groovy is not explicit about this. 2. My IDE (IntelliJ) grays out "public" trying to tell me it isn't needed. So, I'd like to get a clear explanation of scope control for classes, methods, and fields. Thanks! Blake McBride