Project Euler hacking sessions

26 views
Skip to first unread message

Renato Cavalcanti

unread,
Dec 16, 2014, 3:52:28 PM12/16/14
to scala-us...@googlegroups.com
Hi guys, 

As mention on a previous email, the BeScala is running hacking session based on Project Euler exercises. 

I just want to share with you our experience. Maybe some of you can try it as well.

If you don’t know the Project Euler yet you can find more information on their website.

The main goal of this hacking session was to create an environment where seasoned Scala developers could help novices in learning Scala. 

The exercise have of course a math nature, but we were not focusing on that. The goal was more to explore some Scala features and API. Mainly Scala collections, tail recursive functions, inner method definitions and so on. 

Up to now we had only one physical session and many people shown up. And most important with already setup project. Yeah!

The setup was as follow: 
We selected 10 exercises that we thought could be interesting for beginners. 
We choses exercices: 1, 3, 5, 6, 7, 9, 10, 13, 15, 18, 21, 24 and 25

Our members got a project if some test like classes that they had to fill.
For instance:

class Problem001 extends EulerSuite {
  /**
   * Multiples of 3 and 5
   * If we list all the natural numbers below 10 that are multiples of 3 or 5,
   * we get 3, 5, 6 and 9. The sum of these multiples is 23.
   * Find the sum of all the multiples of 3 or 5 below 1000.
   */
  euler(problem(1)) {
    TODO
  }
}

They had to replace the TODO with something that returns a Long. Every Project Euler answer is a Long. The value is then checked against the correct answer. After running a problem we print the total elapse time. Amasing to see how different if could be. The brute force guys were taking a bunch of seconds or minutes to find the solution.

After the session we decided to continue the exercises online and pick one exercise per week. 

For that we took a private GitHub repo to avoid that the answers got published on the Internet. That’s not a big deal, but the organisers of Project Euler kindly asks to not publish the answers. 

Each member that want to participated on the project was granted access to the private repo. And it was asked to push the solution on separated branches. 

For each problem, we create two issues on GitHub. One intended to discuss Scala features and explain the beginners how to use them and another issue intended to discuss math/algorithms. 

After the holidays, we’ll organise another physical session to discuss the solutions and do some more hacking together. 

As mentioned before, the repos are private, but I can grant access to whoever is interested in having a look or fork for local usage. Just drop me a message with your GitHub username if you are interested.

Cheers,

Renato


Tomer Gabel

unread,
Dec 16, 2014, 4:53:59 PM12/16/14
to scala-us...@googlegroups.com
Can you share a little of your experiences actually running one of these sessions? What were the challenges, from an organizational standpoint? What feedback did you get?

Looks interesting!
Tomer



--
You received this message because you are subscribed to the Google Groups "Scala User Group Organizers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user-gro...@googlegroups.com.
To post to this group, send email to scala-us...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-user-groups/etPan.54909b8a.74b0dc51.8f6b%40styped.local.
For more options, visit https://groups.google.com/d/optout.


Renato Cavalcanti

unread,
Dec 17, 2014, 2:56:15 AM12/17/14
to Tomer Gabel, scala-us...@googlegroups.com
Hi Tomer, 

Yes, for sure. 

The organization went quite smoothly. 
The material was prepared as mentioned already and provided to the attendees beforehand. 

We split the group into experienced and beginners. Each experienced Scala dev had to pair with a beginner. And we had three guys walking around, answering questions and bringing beer. Yes, we are in Belgium! ;-) 

The initial idea was to dedicate 20 minutes per exercise. We had in total 13 problems, but we were not aiming to solved them all. That was just a first selection. 

In practice, we didn’t enforce any time constrain. We saw that some pairs were trying different implementations for the same problem. They were having lots of fun in comparing the benchmarks. So we decide to let each pair choose which problem to solve and for how much time they want to spent on it. 


Later when we started to solve the exercises online and share the solutions via GitHub, we realised that practically only the most experienced devs were publishing their solutions and we started to loose focus. The discussions on GitHub were more focused on math and algorithms or details of Stream implementation for instance.

At a certain moment we had to ask people to re-focus the discuss back to the initial goal.
However, we didn’t want to demotivate those willing to discuss more advanced aspects or pure math. So we came up with the idea of having two GitHub issues per problem. We ‘tag’ the issues with [Language] and [Algorithm].


The feedback we got was very positive. People were very enthusiastic.
Someone complained about the math nature of the exercises. Well, you can’t make everybody happy. 
He was expecting a session about how to model a domain in Scala. It was clear that he didn’t read the description.

One thing that we could have done better is to clearly state what we understand by ‘beginners’. We had someone (the same guy as above) in the room that had never saw a piece of Scala code before. That was unexpected, but not a big deal. 


Cheers,

Renato

Tomer Gabel

unread,
Dec 17, 2014, 3:15:04 AM12/17/14
to Renato Cavalcanti, scala-us...@googlegroups.com
That's very impressive! I wonder if the same model can be adapted to non-algorithmic questions, but we'll have to come up with a good repository for challenges. 

I'd love me some access to the repo, can you send an invite? I'll show it to my cofounder, who's running a TDD a dojo in Scala every couple of weeks; we definitely need to improve the format on that, your ideas might be very helpful...

Renato Cavalcanti

unread,
Dec 17, 2014, 5:48:00 PM12/17/14
to Tomer Gabel, scala-us...@googlegroups.com
Hi Tomer, 

You were added to the team ‘sug-leaders’ that have access to the repo. 

The project can be adapted for other kind of exercises. Actually, we have done something very similar to Scala Koans. 

The diference is that every problem must return a Long as result and we don’t have to solve Problem001 to move to Problem002 which is the case in the Koans. 

Have a look on the project and tell us your experience in transforming it into something else.

Have fun!

Cheers,

Renato

Paulo "JCranky" Siqueira

unread,
Dec 18, 2014, 7:06:09 AM12/18/14
to scala-us...@googlegroups.com, Tomer Gabel
Hi,

I'd love to have a look at the repo as well =)

[]s,


For more options, visit https://groups.google.com/d/optout.


--
[]s,

Paulo "JCranky" Siqueira
youtube | site | lojinha

Pedro Furlanetto

unread,
Dec 18, 2014, 7:25:11 AM12/18/14
to scala-us...@googlegroups.com

Me too! Btw can we be in of one of the online installments?

Renato Cavalcanti

unread,
Dec 18, 2014, 7:50:01 AM12/18/14
to scala-us...@googlegroups.com
Hi Paulo, hi Pedro,

Can you send me your GitHub usernames? 

Pedro, maybe I didn’t express myself correctly. What I meant with online was via GitHub and not physically. 

We don’t have fixed date/hour to chat or to have a video conference. We only solve the exercises and discuss the implementations on GitHub.

Cheers,

Renato

Paulo "JCranky" Siqueira

unread,
Dec 18, 2014, 7:54:21 AM12/18/14
to scala-us...@googlegroups.com

Pedro Furlanetto

unread,
Dec 18, 2014, 7:55:13 AM12/18/14
to scala-us...@googlegroups.com

Hi, Renato. Mine is pedrofurla.

Reply all
Reply to author
Forward
0 new messages