1

I am hoping you may be able to give me some advice on class design and what would be best for the program I'm currently writing. This is being done in Java and the goal is to generate letter data fields for the mainframe to read and run through a program for further action. Imagine there are 50 different letters, 40 of them use the same fields and are considered standard, where 10 of them may have special fields.

The guidelines to pass the file to the mainframe for consumption are the following; basically they are looking for fixed width positions for the letter fields, all fields should be passed per line. If the fields are not being used then they should be padded with either spaces or zeros. So if I'm always supposed to be writing out the same number of fields I have kind of a thinking point or quandry.

The way that I've structured my calculations functions and properties, once I have the values I set them to the appropriate property and that's all that is needed.

-One person on my team suggested I have one class for the common fields and then other classes for specific letters. There are several setup fields that are common no matter what such as the SEND TO address. There was an idea to create a common letter, then create a specific letter and copy properties existing since inheriting does not inherit the values from the parent object.

-The more I think about it I feel it may be easier to have one Letter class. The fields in this would be the common ones in addition to the specific ones. This would be a one-to-one match of what is set in the constructor by default, and then also a match when I write the fields out to a file. This would certainly make the whole design and structure of the program simpler with less classes

  • Could you give some more concrete examples like how the output is supposed to look like, how letters look like, what a special vs. standard field means, what it means for a letter to be "unused" (is there some string input?), etc. I couldn't quite connect some of the leaps in thought about the designs you are contemplating since I couldn't fully comprehend the problem in the first place from the description. – user204677 Jan 31 '18 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.