Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12427

Re: Aspect questions?

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: Aspect questions?
References (10 earlier) <XnsA0057F0ABEC37jpnasty@94.75.214.39> <4f4a6b1d$0$290$14726298@news.sunsite.dk> <XnsA005A56D659E8jpnasty@94.75.214.39> <jieg2n$beo$1@localhost.localdomain> <XnsA0064B71D1BBjpnasty@94.75.214.39>
Message-ID <OsI2r.7680$py5.6176@newsfe09.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2012-02-27 05:58 -0400

Show all headers | View raw


On 12-02-27 01:20 AM, Novice wrote:
> Martin Gregorie <martin@address-in-sig.invalid> wrote in
> news:jieg2n$beo$1@localhost.localdomain: 
> 
>> On Sun, 26 Feb 2012 21:08:49 +0000, Novice wrote:
>>
>>> So, with respect to my common classes, should they all be in one big
>>> package, like com.novice.common? Or is it better to group them on
>>> some basis so that different types of common modules are in their own
>>> packages? If grouping them is a good idea, what's the best way to
>>> group them?
>>>
>> I'd say generally yes, unless you see a definite reason to put another
>> (set of) class(es) in a separate package. Example:
>>
>> My common set forms the  org.gregorie.environ package because I regard
>> these as setting an environment for the stuff I write. However, I also
>> do a bit of image manipulation and found I was writing repetitive
>> common code in this area, so that got refactored as classes in the 
>> org.gregorie.image package. And so forth....
>>
>> Any time you find this approach puts a class where you don't expect to
>> find it, consider changing your package structure. Its helpful if your
>> 'common' package only contains classes that are likely to be useful
>> for any program you write (e.g logging and command line parsing) and
>> that your other packages contain classes that are often used together.
>>
> I've really struggled with this. I have things set up a certain way now 
> but I'm constantly second-guessing myself and wondering if its the best 
> way to do things. 
> 
> For instance, I've got some utilities classes and I put them altogether 
> in a single package. But they are a mix of very different kinds of 
> utilities. Some deal with String manipulation, some with dates, some with 
> databases, etc. etc. Sometimes I wonder if I should take utilities that 
> deal with dates and group them with lookup classes that deal with dates 
> rather than group them on the basis of them being a utility or lookup. 
> After all "utility" is not something I could easily define in a 
> satisfying way and "lookup" is similarly unsatisfying. 
> 
> Thanks for sharing your views on this, Martin!
> 
The general guideline for Java packages is that, as Lew has pointed out
several times, they contain classes of related functionality. Often a
"utils" type class is specific enough to classes in one of your packages
(or a sub-hierarchy of packages) that there is an obvious package to put
that *Util or *Utils class into.

But sometimes a "utils" type class doesn't relate closely to any single
package you have. In that case it sure doesn't offend most people's
sense of propriety to have a separate "util" or "utils" package at some
level (typically fairly high in your package tree, though). This can
actually be useful to quickly locate a "utils" class in large codebases
also, because it becomes a convention. Like Patricia said, don't beat
yourself up over decisions like this.

Another note on "utils" type classes. If they really are that general
purpose, consider developing them in an IDE as a separate project
containing that "util" or "utils" package. Ultimately they should be
providable to other work as a JAR.

AHS
-- 
-- Gaiety is the most outstanding feature of the Soviet Union.
Josef Stalin, November 1935

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Aspect questions? Novice <novice@example..com> - 2012-02-24 20:10 +0000
  Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-24 13:05 -0800
    Re: Aspect questions? Novice <novice@example..com> - 2012-02-25 05:47 +0000
      Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-24 23:40 -0800
        Re: Aspect questions? Novice <novice@example..com> - 2012-02-25 17:02 +0000
          Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-25 12:08 -0800
            Re: Aspect questions? Novice <novice@example..com> - 2012-02-25 22:12 +0000
              Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-25 14:27 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-25 23:29 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-25 18:33 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 14:38 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 10:49 -0500
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 10:53 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 18:17 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-25 16:01 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 17:22 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 12:25 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 21:08 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:33 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 17:05 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 20:18 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 21:29 -0800
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-27 05:44 -0400
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 21:37 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-28 00:04 -0800
                Re: Aspect questions? Patricia Shanahan <pats@acm.org> - 2012-02-28 01:39 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 14:54 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-28 17:24 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 04:53 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:08 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 05:12 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 21:38 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 17:27 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-27 12:22 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 22:50 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-27 17:24 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 15:00 +0000
                Re: Aspect questions? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-29 09:14 -0800
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-29 09:55 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 21:31 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-29 23:06 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-02 04:33 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-04 23:00 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-04 17:07 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-05 15:33 +0000
                JavaDoc linking (Was: Aspect questions?) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-05 08:38 -0800
                Re: JavaDoc linking (Was: Aspect questions?) Novice <novice@example..com> - 2012-03-05 17:40 +0000
                Re: JavaDoc linking (Was: Aspect questions?) Patricia Shanahan <pats@acm.org> - 2012-03-05 21:25 -0800
                Re: JavaDoc linking (Was: Aspect questions?) Arne Vajhøj <arne@vajhoej.dk> - 2012-03-06 17:23 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-05 23:45 -0800
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-06 06:03 -0400
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-06 21:05 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:11 -0500
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:09 -0500
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-26 23:43 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 05:20 +0000
                Re: Aspect questions? Patricia Shanahan <pats@acm.org> - 2012-02-26 21:32 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 17:36 +0000
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-27 13:18 -0500
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-27 14:05 -0500
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-27 14:33 -0500
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-27 14:53 -0500
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-27 15:16 -0500
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-27 17:57 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 22:59 +0000
                Re: Aspect questions? Jeff Higgins <jeff@invalid.invalid> - 2012-02-28 05:50 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 15:03 +0000
                Re: Aspect questions? Patricia Shanahan <pats@acm.org> - 2012-02-27 13:17 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 22:55 +0000
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-27 05:58 -0400
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 18:14 +0000
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-28 00:12 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-28 02:04 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 21:22 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 15:11 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:14 -0500
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-28 23:09 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 15:25 +0000
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-01 00:22 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-01 01:44 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-29 23:24 -0800
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-01 21:19 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-02 01:52 +0000
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-03 01:39 +0000
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-05 15:38 +0000
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-05 22:50 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-05 23:46 -0800
                Re: Aspect questions? Patricia Shanahan <pats@acm.org> - 2012-03-06 08:14 -0800
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-06 21:23 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 20:10 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-02 01:49 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-01 22:38 -0800
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-02 06:05 -0400
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-02 14:25 +0000
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-02 18:10 -0400
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-02 14:12 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-02 08:57 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-05 15:57 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-05 23:48 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-03-07 20:33 +0000
                Re: Aspect questions? Lew <lewbloch@gmail.com> - 2012-03-07 13:09 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:20 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-03-02 14:28 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:16 -0500
                Re: Aspect questions? markspace <-@.> - 2012-02-26 10:10 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 20:52 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 13:48 -0800
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 13:47 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:40 -0500
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:36 -0500
                Re: Aspect questions? markspace <-@.> - 2012-02-26 16:04 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 19:38 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 17:09 -0800
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-26 20:08 -0400
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 19:43 -0500
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-27 22:03 -0400
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 21:18 -0500
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 13:43 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 01:11 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 21:49 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-27 18:37 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-27 12:28 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-28 00:55 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-27 17:37 -0800
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 15:57 +0000
                Re: Aspect questions? Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-02-28 03:21 -0600
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-28 09:19 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 21:12 -0500
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-28 05:59 -0400
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-28 17:27 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-29 16:07 +0000
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-02 17:26 -0500
              Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-25 18:22 -0500
                Re: Aspect questions? markspace <-@.> - 2012-02-25 20:22 -0800
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-25 22:20 -0800
                Re: Aspect questions? markspace <-@.> - 2012-02-26 00:04 -0800
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 00:21 -0800
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 00:33 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 10:43 -0500
                Re: Aspect questions? Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-26 11:18 +0000
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-26 11:04 -0400
                Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-26 10:22 -0400
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 21:04 +0000
                Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-26 14:01 -0800
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:46 -0500
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 09:50 -0500
                Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 10:38 -0500
                Re: Aspect questions? Novice <novice@example..com> - 2012-02-26 20:49 +0000
      Re: Aspect questions? jlp <jlp@jlp.com> - 2012-02-25 09:47 +0100
        Re: Aspect questions? Novice <novice@example..com> - 2012-02-25 17:03 +0000
          Re: Aspect questions? jlp <jlp@jlp.com> - 2012-02-25 20:02 +0100
      Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-25 10:20 -0400
        Re: Aspect questions? markspace <-@.> - 2012-02-25 08:18 -0800
          Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-25 12:04 -0500
        Re: Aspect questions? Novice <novice@example..com> - 2012-02-25 17:17 +0000
          Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-25 18:40 -0400
          Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-25 18:18 -0500
      Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-25 09:21 -0500
      Re: Aspect questions? Roedy Green <see_website@mindprod.com.invalid> - 2012-02-25 14:35 -0800
  Re: Aspect questions? markspace <-@.> - 2012-02-24 14:30 -0800
    Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-24 19:47 -0500
      Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-24 20:52 -0800
        Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-25 09:31 -0500
        Re: Aspect questions? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-25 11:05 -0400
          Re: Aspect questions? Lew <noone@lewscanon.com> - 2012-02-25 12:20 -0800
  Re: Aspect questions? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-24 19:00 -0500
  Re: Aspect questions? Tom Anderson <twic@urchin.earth.li> - 2012-02-25 00:22 +0000

csiph-web