data Blog = Blog { me :: Programmer, posts :: [Opinion] }

exercises

Understanding the Strategy Pattern
Apr 3, 2022 programming concepts rust exercises
Conditionals (if, switch, and match statements) are usually the first tool programmers reach for when we need to vary the execution of a function. They’re easy to understand and convenient to use, as long as the variations are simple. As software grows, though, extensibility and comprehensibility begin to require that we create ways to “hook” new functionality into our functions. The strategy pattern offers a method to accomplish that: Define a family of algorithms, encapsulate each one, and make them interchangeable.

Loops and Recursion
Dec 22, 2019 programming concepts exercises
Recursion was a concept that took me a long time to understand. It wasn’t until years after I’d started programming that I felt I really understood it, and it wasn’t until years after that that I felt confident reaching for it as a tool. Like almost everyone, the first way that I learned to think of iteration was with loops. If you wanted to add something together, for example, you would create a “bookkeeping” variable and modify it inside the loop.