best practice Java package design -


i'm trying figure out how design small application. application service, has files input (excel files or pdf files, represent reports 3rd party companies), , output shall generate pdf invoice various reports. these invoices sent hand report-issuing company. know how make app want, classes in 1 package "default package". i'd change that. started renaming classes, fit metaphore: "office". these current classes , interfaces:

  • officedesk (the hub of kind-of everything)
  • translator (opens pdf , excel files, parses them string)
  • report (an object represents content of pdf or excel report file)
  • reportbook (a list of reports)
  • bookkeeper (converts report strings reports, adds reports reportbook, implements readingskill)
  • readingskill (interface, forces bookkeeper able convert string report object)

  • typesetter (some general string utilities)

  • typist (converts reportbook pdf, uses typesetter, implements invoicetypingskill)
  • invoicetypingskill (forces typist implement methods such typereporttable(), typeduedate(), etc..)
  • jobagency (a service briefly looks pdf file decide source (reporting company) pdf is, , provides specialised bookkeeper (a sub-class of bookkeeper, f.e. weylandcorporationbookkeeper bookkeeper knows how read reports weyland corporation) or typist job)

with have lots of classes need use reportbook , report, planning put package "filingcabinet". bookkeeper imports filingcabinet. typist too, etc... how can package this, packages don't need each other? or practice use each other? f.e.

  1. bookkeeper.writerecordtobook( reportrecord record, reportbook book )

versus

  1. bookkeeper.writerecordtobook( string[object] record, vector book )

i think (1.) more readable, forces bookkeeper have dependency. (2.) on other hand, there no dependency, common java types, less readable. better practice here? how name packages (or should there one, such small amount of classes)

my current packages are

  • office (classes: officedesk)
  • filingcabinet (classes: reportbook, report)
  • services (classes: jobagency, translator, typesetter)
  • services.bookkeeping (classes: bookkeeper, readingskill, bookkeeper sub-classes)
  • services.typist (classes: typist, invoicetypingskill, typist sub-classes)

i realise have been written in more concise example, reading , input / opinion!


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -