DEV Community

Cover image for Writing User Info to files in CSV format ( TDD Kata ) - Part 2
Chiranjeev Thomas
Chiranjeev Thomas

Posted on

Writing User Info to files in CSV format ( TDD Kata ) - Part 2

Part 2 of the Writing User Info to files in CSV format kata.

In this particular kata, we are faced with the challenge of batch-processing our user data, as importing and writing millions of records resulted in our server crashing.



Summary :



We continue from Part 1 ( start with this post ) , where we defined the problem and suggested the probable solution for it , given the scenario .


Now, we have a different requriement. Our product manager has informed us that because we're trying to write millions of customer records to a file , our backend server keeps on crashing ... and because of that we're been tasked with creating a batched processing feature .


So , in this case , we'll be able to specify the amout of Customer Info we'll batch together and write in 1 go , before the next batch comes in . Thereby preventing the backend from getting overwhelmened and eventually crasing !


We need to also ensure that previous tests don't break, which can be achieved by building on top of the previous impelemtations , rather than modifying them , i.e : adhere to the Open Closed Principle and the Single Responsibility Principle .

Objectives of ths Post :


1 : Create a batched processing system

2 : Extend the functionality of the existing app , without failing previous tests

3 : Manage the test suit , while expanding the functionality

4 : Follow the SOLID principles ( particularly Single Responsibility and Open Closed Principles )

Top comments (0)