DEV Community

Jasterix
Jasterix

Posted on

You should be on Exercism.io

Developers of all skill levels should be on Exercism.io. It's one of my favorite study tools as a new developer. While I was initially drawn to the site as a practice tool, I quickly realized that was the wrong approach. The reason is the slow pace you're forced to assume to get through the problems.

I know that sounds counterproductive, but stick with me.

Exercism.io is a programming education site that focuses on problem solving. There are a 50 language tracks that students can join, including JavaScript, C++ and Typecript.

The JavaScript track has 101 exercises which includes 18 core exercises. Each core exercise that you complete unlocks the next core exercise, as well as additional non-core problems that you can work on. But what sets Exercism.io apart is its mentor network of experienced developers.

In order to progress through the core exercises, a mentor needs to review your solution for efficiency. So it's not just a matter of solving each challenge, but doing so in an efficient way.

Below is my solution to the Resistor Color exercise. I will include several my original answer, feedback from my mentor and the refactoring that followed to showcase the power in getting feedback from a more senior developer.

The prompt:

Resistors have color coded bands, where each color maps to a number. The first 2 bands of a resistor have a simple encoding scheme: each color maps to a single number. Mnemonics map the colors to the numbers, that, when stored as an array, happen to map to their index in the array.

Solution #1:

Because this was such an easy problem, I raced through the solution and submitted the thing to pass the tests.

//
// This is only a SKELETON file for the 'Resistor Color' exercise. It's been provided as a
// convenience to get you started writing code faster.
//
  let colors = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]
export const colorCode = (string) => {

  return colors.indexOf(string)
};

export const COLORS = colors;
Enter fullscreen mode Exit fullscreen mode
Feedback from my mentor
  • L1 Remove dead comments.
  • L5 Why not just name this COLORS and be done with it?
  • L8 Is the return necessary?

Solution #2:

let colors = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]

export const colorCode = (string) => {
  return colors.indexOf(string)
};

export const COLORS= colors;
Enter fullscreen mode Exit fullscreen mode
  • L1-- removed the comments

  • L5-- tried to rename the colors variable but that resulted in the following error

    • Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled
  • L8-- also wasn't able to pass the tests without the return keyword. I think it is necessary for colorCode to explicitly return the result

Solution #3:

In the end, I was able to export const COLORS. I learned the error happened when I defined COLORS in line 1 and then tried to export it in line 7, instead of exporting it when I declared it. I left a comment explaining this for my mentor, who later clarified.

export const COLORS  = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]

export const colorCode = (string) => {
  return COLORS.indexOf(string)
};
Enter fullscreen mode Exit fullscreen mode
Feedback from my mentor
  • Yes, you can't do that. I believe you're trying to say "export this single thing" with that syntax - but you've already told it you're exporting colorCode also.

  • If you simply want to export them both the easiest way is to prefix them both with export (as you've already seen).

  • Approving solution 3.

  • And yes, is it possible to remove return with implicit return

Solution #3 (final solution):

export const COLORS = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]

export const colorCode = (string) => COLORS.indexOf(string)
Enter fullscreen mode Exit fullscreen mode

My final note to my mentor

  • Can't believe how much more succinct this solution is compared to my first one. Thanks, you're a great mentor!

Personally, I'm a great fan of Exercism.io. More than just being able to write code, I want to be able to develop clean, thoughtful solutions to problems.

But there's a reason I said developers of ALL skill levels should be on Exercism:

That means you beginners and definitely you pros.

Several months after my first Exercism solution, I've only made it through 5 core exercises. This is partly because of the many rewrites I go through before my solutions are approved. But this is also due to the many days it can take for a mentor to be assigned to review my solution.

It takes time for 112 JavaScript mentors to work through solutions submitted by 47,413 students. I've been suggesting Exercism.io to any and everyone trying to learn JavaScript. Even though there are language tracks, I've learned a lot from the seemingly random feedback of my mentors.

So whether you're a newbie developer who could use the feedback or an experienced developer with feedback to offer, you should go Exercism.io right now to create an account. Run- don't walk!

Also checkout this great Exercism solutions blog I just found. I prefer to solve the problems first, but if I get stuck, I won't mind peeking!

Top comments (6)

Collapse
 
stevenyholm profile image
Steve Nyholm

I also recently started on their C# track. It's one of the best coding challenge sites. It's not as slow now as described in this article. Mentoring is optional, but really cool to do. It's really nice that they separate the challenges into tracks by language.

Collapse
 
jasterix profile image
Jasterix

I totally agree

Collapse
 
cod profile image
N/A

I just started using it 3 days ago . I was thinking I would use it for my 100 days of code challenge ,learn something new then use the exercises to revise , but its not working out. I haven't being able to do an exercise a day like I inintially planned. You are right about it forcing you to take a slow pace because the exercises deserve some brain power (or maybe they seem that way to me cause I am a newbie in JS). I guess I was thinking they would be straight to the point like freecode camp. Ultimately,I would reccommend it to anyone out there. I also tried out their python exercises and it also seems quite solid. I really liked your article by the way!

Collapse
 
thisisyashsha profile image
Yash Sharma

hii N/A ,I'm also on my 100days of code challenge, also tried freecodecamp and exercism, jschallenger ,codewar, and few more sites , but felt more comfy in exercism, it provides good community solutions and roadmap to further the learning,
I want a accompany of someone who's also learning javascript or python at exercism to discuss the question, so dm me on my twitter @yashsharmatwts

Collapse
 
mustapha profile image
Mustapha Aouas

Thanks for sharing, really great ressource πŸ‘ŒπŸΌ

Collapse
 
reyuerr profile image
reyuerr

Thanks!