Hi Michal,
my constructor [...] reads the header, [and] then the schema, and then checks to make sure that all the flags in the file are either 0 or 1, and all the way it checks if there are any deviations from the format, and if so then it throws and exception.
(Highlighting and additional "and" is mine)
I think you already know the answer to your question, but here goes anyway ...
Doesn't your description of your constructor sound like you might want private methods that would (say) readTheHeader(), then readTheSchema(), and then validateTheData()?
It is a good practice to break up methods when they start trying to do too much. One of the goals that we
can try to achieve when programming, is to have our methods
do one thing and do it well. The same thing applies to our classes (in fact some candidates consider this a reason for making the Data class a Fa�ade - it is trying to handle file access
and record locking: it is breaching the "do one thing only" suggestion).
The moment you start using the
word "and" when trying to describe what your method (or class) is doing, then there is the
possibility that it is trying to do too much (which then raises the possibility that the could may be hard to read / maintain).
In your initial question, you already identified different things that your constructor was doing. Imagine how much easier to maintain your program will be if you do break up the code based on those functions you identified. If the schema (and only the schema) changed in some way, would you prefer to try and modify one constructor that performs multiple functions, or would you prefer to jump right to the method that is clearly marked as reading the schems?
Regards, Andrew