Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API access to solutions? #4333

Closed
pepasflo opened this issue Sep 5, 2018 · 8 comments
Closed

API access to solutions? #4333

pepasflo opened this issue Sep 5, 2018 · 8 comments

Comments

@pepasflo
Copy link

pepasflo commented Sep 5, 2018

Thanks so much for creating exercism!

Recently I was using 4clojure.com, which is like a clojure-only version of exercism. I found tremendous value in browsing other's solutions to a problem. Unfortunately, they don't make it very convenient to access solutions en masse, do any sort of machine processing on them (complexity analysis, etc).

I'm new to exercism, so I'm not sure if it suffers from the same problem. Is there an easy way to get machine-friendly access to problem solutions?

Thanks!

@sshine
Copy link

sshine commented Sep 17, 2018

Defining a public API is on the 2-3 month roadmap.

If you don't mind adding this request to the wishlist on #4087, this issue can be closed.

@iHiD
Copy link
Member

iHiD commented Sep 17, 2018

do any sort of machine processing on them (complexity analysis, etc).

We'd be very open to doing this in partnership with you, but I'm not sure we're actively going to expose other people's solutions over the API without some serious thought. Maybe you could tell us a little bit more about what you hope to do?

@pepasflo
Copy link
Author

pepasflo commented Sep 17, 2018

do any sort of machine processing on them (complexity analysis, etc).

We'd be very open to doing this in partnership with you, but I'm not sure we're actively going to expose other people's solutions over the API without some serious thought. Maybe you could tell us a little bit more about what you hope to do?

Sure, so when I was looking through some of the solutions at 4clojure, it quickly becomes apparent that many of the solutions are functionally identical, but simply have different variable names, etc. So it would be great if I could run some sort of analysis which says:

"Though there are 237 answers, really, they can be lumped into these 5 main approaches. Here is approach #1, which was the most popular with 37% of the answers, approach #2 was...".

This would of course be much easier in a lisp-like language, where the syntax is trivially easy to parse, but even without machine analysis, a human can do a pretty decent approximation by just quickly visually scanning through a few dozen answers.

As an example, here's 4clojure problem #27, which is "Write a function which returns the first X fibonacci numbers."

screen shot 2018-09-17 at 10 25 50 am

The solution I came up with was very verbose:

(fn fib 
  ([n] (fib n '(1 1)))
  ([n l] (cond
           (= n 1) '(1)
           (= n 2) '(1 1)
           (> n 2)
             (if (= (count l) n)
               (reverse l)
               (fib n (cons (+ (first l) (second l)) l))
             )
         )
  )
)

And here's where you can browse through solutions:

screen shot 2018-09-17 at 10 27 43 am

Even by just scanning through the answers, you realize there a few approaches which occur pretty frequently, for example #(take % (map first ....

My experience was that I learned more about clojure in one hour by browsing through other people's solutions than I had in the previous week of trying to read through tutorials. Something about this is just fundamentally more engaging.

So when I see that you guys are sitting on top of a giant pile of solutions, that has tremendous value! Even better, you have piles of solutions to the same problem implemented in different programming languages! That's like insanely valuable!

So:

  1. It would be fantastic if there were an easier way to quickly browse through these solutions (especially, being able to compare two languages: "I already know how to solve this in Python, now show me how to solve this in Clojure..."

  2. The cherry on top would be some sort of machine analysis which would boil down 582 solutions down into 10 piles of similarity, but that's a more difficult problem to solve than simply making a "solution browser" web interface.

Anyway, that's where I'm coming from. I'm an iOS dev by trade, but perhaps its time to roll up my sleeves and learn enough about webdev to submit a PR for a "solutions browser" 🤓

@pepasflo
Copy link
Author

Another thought: this weekend I watched a talk by Angelina Fabbro about transitioning from being an intermediate developer to an expert developer: https://www.youtube.com/watch?v=v0TFmdO4ZP0

Perhaps these two approaches serve two audiences: programmers who are beginners benefit the most by working through problems and using the mentorship feature, but perhaps programmers who are already intermediate in one language (but a beginner in another language) would benefit the most from a "solutions browser" interface.

@mrtnmgs
Copy link

mrtnmgs commented Nov 5, 2018

Codewars has a great UI for browsing results. Filters + grouping of solutions similar to what @pepasflo is talking about... ("x similar code variations are grouped with this one")
screen shot 2018-11-05 at 10 45 13 am

No comment on the idiotic terminology ("war" / "warriors")...

@mrtnmgs
Copy link

mrtnmgs commented Nov 5, 2018

Actually there's already an open issue about this, #4067

@iHiD
Copy link
Member

iHiD commented Feb 15, 2019

Sorry this got lost :)

So two things firstly:

  1. https://exercism.io/blog/automated-mentoring-support-project
  2. As @mrtnmgs says Order of community solutions is suboptimal #4067 is a good discussion on this

I'm really excited about how we can combine (1) and (2) to achieve this. We're looking for key people to work on the static analysis for each language track, so if any of y'all would like to volunteer for specific tracks, then we'll definitely share some anonymised data to get started on this stuff. I'm thinking that to start we could return profiles on solutions (number of lines, conditionals, methods, etc) and then both give users the option to filter themselves for solutions they're interested in based on those things, or use a more data-science model to do the automatic groupings (as you say with "Though there are 237 answers, really, they can be lumped into these 5 main approaches. Here is approach #1, which was the most popular with 37% of the answers, approach #2 was...").

Can I suggest we continue this discussion at #4067 as I think the real thing is planning this as a project, over how the access to the data is achieved. I'll point to this from there too.

@ErikSchierboom
Copy link
Member

Hello 👋

With the launch of Exercism v3, we are closing all issues in this repository to help give us a clean slate to detect new problems. If this issue is still relevant to Exercism v3 (e.g. it's a feature that we haven't implemented in v3, or a bug that still exists), please reopen it and we will review it and post an update on it as soon as we get chance.

Thanks for helping make Exercism better, and we hope you enjoy v3 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants