CSE Roadmap

Core tier · about 4 hours · 6 parts

Part 1 of 6 · 1 min read

Why this page comes last in Level 7

In this module you will

  • Turn a file-system question into requirements for paths, files, folders and operations.
  • Model the tree with the composite pattern, so a file and a folder share one base type.
  • Parse paths, including . and .., and walk the tree one name at a time.
  • Build create, write, read, list, size, move, delete and find on top of one lookup method.
  • Name the edge cases: missing paths, a file used as a folder, moving a folder into itself, and the root.

The file system is the best place to see the composite pattern of Level 4, module 9, do real work. A folder holds nodes. A node is a file or another folder. One method such as size works on both, and the recursion does the rest. The page also practises careful input checking, as in Level 5, module 1. No book was supplied for this track, so the content is common practice, not from the books. The Java code was compiled and run before it was written here. Numbers marked "made up" only show the idea.