How to code? — 11
2 min readNov 6, 2019
Read post-10 here.
I will summarize our journey in creating a backup application so far.
- We wrote a copy() function that copies files from a source folder to a destination folder (or backup folder)
- The copy() function also recursively calls itself if it encounters a sub-folder until it deep copies every file under it to unlimited levels
- We examined the incremental copying to be done by maintaining the last copied file in a meta file in the destination, dropped it as it does not guarantee the sanity of the meta file contents when a PC shutdown happens abruptly.
- We looked at finding the last modified timestamp in the destination and continue to copy source files beyond that for a incremental backup. But then we dropped it as there could be source files that might have got modified as the backup proceeded.
- We settled finally to always prepare a source file list based on the size of the file whenever backitup runs.
Some of the things we learnt while doing this are
- Explore, question, iterate on the problem until we know what we want to solve exactly.
- Sort the needs as business or technical. Business needs drive technical needs.
- Some needs are far fetched like the ability to backup to cloud. Leave them for later rounds.
- When there are multiple things of the same thing (like multiple sources feeding data to the program), abstract the interface to them and make them plug-able.
- Applications that deal with data have to be largely reliable or need to handle failures from day one. The design for this have to be addressed right in the beginning.
- Start thinking about how the user will use your application. And design the simplest way in which that can be accomplished.
- As soon as there is a clarity on the key functions, begin to code and learn things that can be bottlenecks in the design.
- Key algorithms should be succinct and describable. Keep refining them until major design bugs are uncovered.