An open API service indexing awesome lists of open source software.

https://github.com/muhamed-didovic/exercises

collections
https://github.com/muhamed-didovic/exercises

Last synced: about 2 months ago
JSON representation

collections

Awesome Lists containing this project

README

        

# Refactoring to Collections: The Exercises!

The exercises for the book are broken down into three categories:

1. Beginniner

These exercises focus on fundamentals. You'll get to practice reimplementing cornerstone collection operations like `map`, `filter`, and `reduce`, and practice using those operations to solve simple problems.

2. Intermediate

The intermediate exercises focus on learning how to apply multiple operations in sequence to solve a problem. Each one is a little trickier than the last, and you'll need to use operations beyond just `map`, `filter`, and `reduce`.

3. Pro

The pro exercises build on what you practiced in the intermediate exercises, but start to introduce longer pipelines and problems that require more creative solutions.

## How to do the exercises

All of the exercises are organized into PHPUnit test cases. I've bundled any necessary vendor dependencies with the exercises, so you don't need to download anything extra to get started.

To start working on an exercise, open that exercise file and look for a comment block with instructions. Edit the exercise file directly to add your solution.

To run a test you are working on, run PHPUnit from the command line, passing the test file name as an argument.

For example, to run the first test in the `beginner` category, make sure you are in the directory where this README is located and run:

```
./vendor/bin/phpunit beginner/1-ReimplementMapTest.php
```

I've included my solutions to the exercises in a separate folder for you to compare against when you come up with a solution. Don't cheat though, the best way to learn this stuff is to practice! Don't check the solutions unless you've already finished the exercise and want to compare your work with mine, or unless you are really stuck and can't figure out the solution.

Good luck!
– Adam