0

As I'm sure the title is less than clear, I'll elaborate on my question.

I am currently in the middle of a software development project that involves image processing for letter recognition. One of the more primitive feature extraction methods involves storing a pre-compiled data file and checking against it. Now, for this to work, at some stage in the process the data must be compiled from a known source of images and what-have-you and we have done that all fine, but where should the functionality of the data compilation occur?

I have a package called featureExtraction that contains a class called VectorAnalysis which uses the pre-compiled data. Currently the VectorAnalysis class contains the functionality to generate the data if requested, but I wanted to extract all that functionality out into a separate package (as there are a few other extraction methods that also need pre-compiled data and therefore have their own data construction methods, having a data generation package seems logical).

The problem with this is that the data generation functions often rely on private or protected functionality within their respective extraction classes.

So ultimately my question is:

Is it better practice to have the data generation within the extraction classes or should I open up access to the inner workings of the extraction classes so that the generation methods can access them from external packages?

Or is there some other completely different practice that I have overlooked?

TheMerovingian
  • 648
  • 4
  • 14

1 Answers1

0

Not completely understand your question, but I'll try to answer. Better practice is to separate all functionality into many classes: each for its small function. All classes should be reusable as possible and have appropriate well-thought public interface (class' public members, not Java interface I mean). Thus, you can use as low-level and high-level functions in any package.

Stanislav Mamontov
  • 1,734
  • 15
  • 21