# E26: Five problems every software engineer should be able to solve (Part 1)

Santiago Valdarrama wrote a blog post entitled five problems every software engineer should be able to solve in less than an hour. Stop for a second and check it out!

If these five problems really take an hour to solve, that’s much too long for a WOD, so let’s just try to solve the first one. More important, we’ll use this as an opportunity to practice using GitHub, git, IntelliJ IDEA, Javascript, Underscore, and ESLint.

### The WOD

For this practice WOD, solve the following variation of the first of the five problems that Santiago Valdarrama thinks should take less than an hour.

Ready? Let’s begin:

1. Start your timer.

2. Create an empty GitHub repo called “sumofnumbers” and clone it to your local computer. Don’t forget to check the box so that a README file is created.

3. Create an IntelliJ “Static Web” project called “sumofnumbers” within your local sumofnumbers repo directory. If IntelliJ asks if you want to add a .gitignore file, you can say yes.

4. Set up your project to use our Javascript coding standards. Once you have done the one time tasks, then all you should need to do is:

• Download sample.eslintrc into the project directory, and rename it to .eslintrc.
• Download sample.package.json into the project directory, and rename it to package.json.
• Download sample.gitignore into the project directory, and rename it to .gitignore.
• CD into the project directory, and run npm install to install ESLint.
5. Create two files: index.html and sumofnumbers.js. The index.html should load the Underscore package (available at <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>) followed by sumofnumbers.js. Note that the order of loading is important!

6. Write four functions that return the sum of the numbers in a given list using a for-loop, a while-loop, recursion, and underscore. Call them sumFor, sumWhile, sumRecursion, and sumTheSimpleWay.

7. Make sure ESLint is running. For example, add newlines to the end of a file to see that an ESLint error is triggered.

8. Make sure that there is a green checkmark indicating that ESLint does not detect any problems with your code.

9. Commit your finished program to GitHub.

10. Check that your code is on GitHub.

11. Stop your timer and record your time. Be sure to record it, because you will need your WOD time data when you write your technical essay.

Rx: < 20 min Av: 20 - 25 min Sd: 25 - 30 min DNF: 30+ min

## Demonstration

Once you’ve finished trying the WOD for the first time, watch me do it.

NOTE: The steps for installing ESLint have changed since I recorded this video. Just skip over that material.

## Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it is usually strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

• Start a new branch off master to hold the new attempt, or else delete your prior attempt so you cannot refer to it;
• Don’t look at my screencast while you WOD; and
• Reset your timer.

Feel free to keep trying until you make Rx if that’s of interest to you.

## Submission Instructions

By the time and date indicated on the Schedule page, submit this assignment via Laulima.

Your submission should contain:

• A link to the GitHub repository created as a result of your latest attempt at this practice WOD. Make sure you include the complete URL so that I can click on it in my mailer. Note: the final commit to this repo must have been made before the submission time and date, otherwise you will not receive credit for this assignment.

• The number of times you have attempted this practice WOD so far, and for each time, how long it took you.

You will receive full credit for this practice WOD as long as you have attempted it at least once and submitted the email with all required data before the due date. Your code does not have to run perfectly for you to receive full credit. However, if you do not repeat each practice WOD until you can finish it successfully in at least AV time, you are unlikely to do well on the in-class WOD. To reduce the stress associated with this course, I recommend that you repeat each practice WOD as many times as necessary to achieve at least AV before its due date.