• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

All client classes should be package private

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or should they? Any comments will be greatly appreciated.

Looking at my own client classes I would say most of them should not be public, since I seriously doubt that Bodgitt and Scarper, their affiliates or anyone else would ever want to use anything but the most central couple of classes.

These are the candidates for public access I can identify:

  • Starter (because it holds the main method). What's a good name for such a class anyway?
  • RecordTableModel (a Swing TableModel backed by a collection of database records, since it is, at least in theory, reusable)
  • Contractor, ContractorTableModel and ContractorTablePanel. These all deal with database records representing contractors and are also, in theory, reusable.


  • Any comments on what to make public are very welcome. I am thinking of choosing "Starter" alone.
     
    Ranch Hand
    Posts: 197
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I wanted to make a few of my classes package private, but decided against it. All my top level classes/interfaces were public because of the must requirement: 'You must provide Javadocs for all classes'. Since it is usual to provide only public/protected Javadocs this swung it for me.

    Starter : Runner is customary
     
    Mogens Nidding
    Ranch Hand
    Posts: 77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for the advice, Mike! I guess the requirement you mention either forces us to make all classes public, or to generate package-level javadoc.
    If there is no other reason to make the classes in the client package public than javadoc inclusion, then I'm going with the package-level javadoc, though, since I think it's the lesser of the two evils.

    By the way, the requirement also seems to force us generate javadoc inner classes, which are often private. This surely can't be the intention?
     
    reply
      Bookmark Topic Watch Topic
    • New Topic