- Read Tutorial
- Watch Guide Video
- Complete the Exercise
Summary
Refactor the Macbeth XML parser/counter so it uses a functional programming approach.
Credit to Upcase for the great coding exercise.
Exercise File
Exercise Description
Split the macbeth_parser
method into multiple methods that utilize functional programming calls instead of the iterative approach. The RSpec tests should still pass, which means that the resulting output should be identical to the current implementation.
Real World Usage
This solution was more challenging to build out than the iterative approach. However the result will be a more scalable implementation that can be utilized by other XML files. Anytime that you are building a program, it's typically a good idea (and a good practice) to design with modularity in mind.
Solution
Can be found on the solutions branch on github.