Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Learning Elixir better through Collaboration an...

Learning Elixir better through Collaboration and Giving Back

This talk is basically about my experience of Learning Elixir as a beginner to the language. In the talk, I've also made an attempt to highlight how the journey of learning Elixir has given me opportunities to contribute back to the Elixir community even as a beginner to the language.

I had given this talk at the Singapore Elixir Meetup in January 2018. Thanks to the awesome folks of behind https://engineers.sg/, the video related to this talk is present here - https://www.youtube.com/watch?v=UFfw1Iy9BxM

Mohnish G J

January 09, 2018
Tweet

More Decks by Mohnish G J

Other Decks in Programming

Transcript

  1. Many resources out there Learning a new language with so

    many resources out there can get overwhelming
  2. Learning a new language can be challenging and fun The

    journey of learning a new language can be - thrilling and deeply uncomfortable
  3. • Learning by Reading ◦ Programming Elixir 1.3 by Dave

    Thomas ▪ Explained concepts nicely with small examples of how one concept can be applied in different ways ▪ Read only first few chapters ◦ Official Getting Started Guides ▪ Read more chapters from these guides ▪ Concise and to the point How I started learning Elixir? Official Getting Started Guides
  4. • Learning By Doing ◦ Why learn this way? ▪

    Easier to understand ▪ Closer connect to real world problems ▪ Learn Multiple concepts at one time How I started learning Elixir better? Recently posted by a user on elixirforum.com - This was me
  5. • Learning By Doing(contd.) ◦ What were my learning goals?

    ▪ Get confident • I’m approaching problem solving in the right way • Applying the right concepts to solve a given problem ▪ Being able to • Make and Track regular progress as a beginner • Connect underlying concepts with real world problems • To write idiomatic Elixir code • To apply multiple concepts to solve a given problem • Compare my solutions to others in order to identify areas of improvement How I started learning Elixir better?
  6. • Learning By Doing(contd.) ◦ How could I possibly do

    it better? ▪ Collaboration using a combination of platforms like • Exercism How I started learning Elixir better? How can Exercism.io help you learn better?
  7. • Some of the other platforms to help with learning

    Elixir better • elixirforum.com ◦ Uses Discourse - by Jeff Atwood(co-founded Stackoverflow), Sam Saffron and Robin Ward • elixir-lang slack - you can get your invite here How I started learning Elixir better?
  8. • The classical introductory exercise to any new programming language

    ‘Hello World’ in Elixir Sample Failing test case that we have to make pass Sample script in which we have to write code to pass the failing ‘Hello World’ related test ‘Hello World’ solution that makes use of Default Arguments
  9. Documentation was confusing wrt usage of Default Arguments Gave some

    Context as a beginner on why the usage of IO.puts as part the Default Arguments was confusing
  10. Hello World exercise led to my initial contributions to Elixir

    Backed up my proposal with an example on how we could do without ‘IO.puts’
  11. • Jose Valim shared some context on why IO.puts was

    added earlier and acknowledged that it could be more confusing PR contribution by a total beginner Jose Valim clarifying the intention behind why IO.puts was used in the first place
  12. • Exercise 1 - Gigasecond ◦ Problem Statement ▪ Given

    a particular date ▪ Calculate the moment when someone has lived for 10^9 seconds(Approx. 31.70 years) Solving the Gigasecond exercise on Exercism My initial solution to the Gigasecond exercise A sample test case wrt the Gigasecond exercise
  13. • Learnings from the Gigasecond ◦ Learnings through conversations around

    the solution ▪ Unlearning from some of our past habits of solving problem in a particular way ▪ Thinking Functionally about problem solving Unlearning imperative style of problem solving Discussion about a different way of representing constants and the usage of pipe operator
  14. • Gigasecond ◦ Summary of Learnings from one exercise ▪

    Different ways of representing a constant in Elixir ▪ How to call Erlang specific code in Elixir ▪ Replace usage of variables with a Pipe operator ▪ Pipe Operator - What’s the bigger picture? • A series of transformations on data Learnings from solving the Gigasecond exercise Final Solution => Initial Solution =>
  15. • Exercise 2 - Bob ◦ Problem Statement ▪ Bob

    is a lackadaisical(lacking enthusiasm and determination) teenager. ▪ In conversation, his responses are very limited. ▪ Bob’s responses usually are: • 'Sure.' if you ask him a question. • 'Whoa, chill out!' if you yell at him. • 'Fine. Be that way!' if you address him without actually saying anything. • 'Whatever.' to anything else. ◦ Test “shouting in Russian” - Place where I got stuck wrt the Bob exercise Solving the Bob exercise on Exercism
  16. • Exercise 2 - Bob ◦ Enter elixirforum.com Learnings from

    solving some of the other Elixir exercises Another user asking about a similar question on the same exercise
  17. • Exercise 2 - Bob ◦ Solving the Bob Exercise

    using Exercism & Elixir Forum How different pieces fit together - Exercism & Elixir Forum The suggestion The test case that needed to be checked against all letters being uppercase The suggestion in IEx The solution
  18. • Exercise 2 - Bob How different pieces fit together

    - Exercism & Elixir Forum Applying the suggestions on elixirforum to my solution
  19. • Exercise 2 - Bob ◦ The solution could still

    be improved further using Typespecs! Can the solution be improved any further? My initial solution on Exercism A solution that involved usage of typespecs Explained via a comment(wrt my solution) on Exercism what led to my curiosity to explore typespecs further
  20. • Exercise 2 - Bob ◦ Discussed importance of typespecs

    in the #beginners channel ▪ Has over 2700 members! How different pieces fit together - Exercism, Elixir Slack Wrote a blog post based on the learnings discussed via slack
  21. • Exercise 2 - Bob ◦ My final solution Used

    Exercism, Elixir forum & Slack to improve my solution
  22. • Exercise 3 - Word Count ◦ Problem Statement ▪

    Given a phrase, count the occurrences of each word in that phrase. ◦ This is a good exercise to get more into Functional Programming, let’s see how ◦ Thought Process ▪ At a high level I knew that I wanted a key value pair with • Key being the ‘word’ • Value being the ‘count’ wrt the word ▪ Drawing Parallels between Enumerable module of Ruby and Elixir Solving the Word count exercise on Exercism One of the test cases as part of the word count exercise
  23. • Exercise 3 - Word Count ◦ This exercise was

    a good way to get more into Functional Programming ▪ This was pretty much me Solving the Word count exercise on Exercism A question asked on how to loop through a map in Elixir
  24. • Exercise 3 - Word Count ◦ This exercise was

    a good way to learn more about how to use Map & Reduce in Functional Programming ▪ This was pretty much me Solving the Word count exercise on Exercism This was answered on StackOveflow by the creator of Elixir - José Valim
  25. • Exercise 3 - Word Count ◦ Identified the appropriate

    gaps in documentation and sent a PR to fix this Sent a PR to further clarify how to use Reduce in Elixir This was answered on StackOveflow by the creator of Elixir - José Valim
  26. • Exercise 3 - Word Count ◦ Ebert Bot collaborating

    on the Exercism Word Count Exercise PR submitted on Github Did you Know? - Bots can Collaborate too! Ebert Bot offers a valuable suggestion via Credo to help one write better Elixir code
  27. • Exercise 3 - Sublist ◦ Problem Statement ▪ Given

    two lists determine if • The first list is contained within the second • The second list is contained within the first list • Both lists are contained within each other • If none of these are true ▪ A challenging problem that really tested me ▪ Thought Process • Approach 1 - Trying to check if one list is a subset of another list • Found out that there’s a functional called MapSet.subset ◦ The Catch ▪ Mapset’s subset function doesn't take into account the order or duplicate items Solving the Sublist count exercise on Exercism The sublist exercise related test case for which Mapset’s subset function did not pass
  28. • Exercise 3 - Sublist ◦ Thought Process ▪ Approach

    2 - Find the difference between two lists ▪ Make use of ‘--’ to find the difference between lists • The Catch ◦ This didn’t work for the recurring values unequal related test ◦ Test for huge sublist not in huge list took too long to execute ▪ Decided not to wait for it Solving the Sublist count exercise on Exercism In Elixir it finds the difference between the lists on a per element basis
  29. Found a similar solution where somebody was stuck at the

    same place Huge sublist not in huge list related test case
  30. • Have you a. honestly tried fixing things yourself b.

    found ways to get unstuck c. fast enough at getting unstuck so that you could keep moving forward? d. identified the missing gaps between your thought process and that of others? • It’s completely ok to go ahead and ask for hints on Exercism Looking Beyond Impostor Syndrome - Lessons Learnt from the sublist exercise This is not Impostor Syndrome, this is Reality.
  31. • Currently working on adding a Debugging Chapter as part

    of the Getting Started guides on elixir-lang site Sublist exercise made me realize - A missing debugging chapter
  32. Comparing my solutions to others helped me write better Elixir

    code Other Exercism users discussing what their takeaways from another user’s solution
  33. • ElixirForum ◦ Some of the different categories under which

    people post questions @ https://elixirforum.com/ Some of the ways through which Elixir Forum can be helpful
  34. • ElixirForum ◦ Some of the questions around learning Elixir

    that people have asked Some of the ways through which Elixir Forum can be helpful The possibilities one can leverage with ElixirForum
  35. • Elixir Lang Slack ◦ The Elixir Lang Slack is

    super useful especially when you are getting started ◦ One can also see older conversations on some channels via - http://elixir-lang.slackarchive.io • Some of the Popular Elixir Lang Slack Channels include: Some of the ways through which Elixir Slack can be helpful
  36. • Some Options: • Try some of the exercises in

    the Elixir Track on Exercism ◦ Kick off a conversation by explaining your thought process • Other resources one can try ▪ Advent of Code ▪ Elixir Koans ▪ Dave Thomas’ video series on Elixir for Programmers Next Steps? A user on Elixir Forum sharing his experience with trying out Dave’s online course A user shared his learnings on the #adventofcode channel of Elixir Lang Slack
  37. You can contribute to Elixir even as a beginner •

    The importance of contributing documentation Jose Valim encourages and supports Documentation related PR’s The Bigger Picture - Why write good docs?
  38. Takeaways • Elixir community is very approachable for beginners ◦

    Actively engage with the community to make the most of it! • Just like how life is about small things ◦ Do smaller problems ◦ Use platforms like Exercism that provide countless small wins. • If using Exercism ◦ Be proactive and have conversations explaining your thought process behind each of your solutions ◦ Make use of hints ◦ You can learn a lot just from seeing other people’s solutions ◦ Ask for help or feedback on elixirforum.com, #beginners or #exercism channel on elixir-lang slack • Believe in Yourself • Give Back - You can contribute to Adoption of elixir even as beginner to the language! ◦ It’s about connecting the dots, finding gaps • Collaboration can be in the passive form as well
  39. Keep Having a Beginner’s Mind! Benjamin Tan Wei Hao -

    Author of The Little Elixir & OTP Guidebook
  40. Credits • Image Credits ◦ Are your ramping up in

    a new langauge ◦ Many resources out there ◦ Being Stuck ◦ From Not Knowing to Knowing • Review credits ◦ Anil Thaplar for some good feedback around my slides
  41. Thank You and Feel Free to Get in touch! Mohnish

    G Jadwani Twitter @mohnishgj Github boddhisattva Blog medium.com/@mohnishgj Site http://www.mohnishjadwani.com/ Gmail mohnishgj