The trainline coding challenge and solution.
Summary
Please complete the two coding exercise steps; a brief code review and then a refactor of a class.
We do not expect you to spend more than two to three hours on this exercise.
Exercise
A junior developer was tasked with writing a reusable implementation for a mass mailing application to read and write text files that hold tab separated data. They implemented the CSVReaderWriter class as part of this project. The implementation, although it works and meets the needs of the application, is of very low quality.
Your task:
-
Review the CSVReaderWriterForAnnotation.cs file and using comments at the top of this class list three to five key areas of concern that you would discuss with the junior developer. This is a quick review so please don't spend more than 15 minutes on this task.
-
Refactor the CSVReaderWriter.cs file implementation into clean, elegant, rock-solid & well performing code, without over-engineering. You are not required to update the AddressFileProcessor as part of this task. Assume this code is a small part of a larger production system and backwards compatibility of the CSVReaderWriter must be maintained.
- Where you make trade offs, comment & explain why.
- You'll notice there are some other files in the AddressProcessing project that aren't relevant. These will come into play in the next stage in the interview process and can be ignored for now.
- You may introduce nuget based references.
- Git is integral to our process but we understand that not everyone has previous experience with the tool. If you're not yet familiar with Git we recommend that you read some online tutorials and use the SmartGit client to get started or visit http://git-scm.com/ for the official git client.
- If you need a copy of visual studio you can use the free edition available to download from: http://www.visualstudio.com/downloads/