I'd started a new job recently and am in the process of learning about / taking ownership over some of the existing systems that we've got in place. Within the past few days I'd discovered that one duty will include the maintenance and modification of a system that generates flat, non-delimited text files for output (the files you traditionally associate with Mainframe systems or institutions that used to use mainframes).
A past position of mine involved a very similar situation, just with CSV files. The original implementation was pretty hack-y (manual string parsing, a lot of corner cases for comma-escaping left unhandled, etc.) which ultimately led me to find and use SuperCSV, with which I had a great experience. One of the things I really enjoyed about SuperCSV is that the code allowed you to be really clear about columns, data types and their associated conversions. This made it really easy for others to make changes and kept me from scratching my head when I'd coming back to the code after a prolonged absence.
The flat-file code is in a similar state to the CSV handling I'd mentioned: a lot of fiddling with strings and manual escaping/manipulation. Since I'm assuming ownership over this code I'd like to make similar improvements here but am unsure of where to start.
What's a library or framework that'd serve as a basis for a refactor here? I'm particularly interested in the following:
- Ease of maintainability (since flat files are positional it's tough to move the output around without fiddling with counts and needing to update comments, which is what I'm looking to avoid)
- Documentation creation: I'm interested in both creating as well as consuming flat files and a part of that ends up involving documenting what the various fields are. If it could either create a document or generate some intermediary data that'd help in its creation that'd be great.
The codebase I'm in now is Java once again, but since this would constitute a pretty significant rewrite I'm open to pretty much any platform.