Live data from Hacker News

Practicing Elixir or any programming language

ericdouglas.github.io

21–30 of 59 posts

Re: Practicing Elixir or any programming language

#21
post #13

I always find it interesting how people learn so differently. Personally, I learn a language by building something in it. I want a feel for it, before digging deep and learning about theory. I only do that stuff much later, after I'm relatively proficient in the language. This is probably why I wasn't very good at picking up musical instruments. I was never satisfied learning at a slow pace and only being able to pla…

Spoken languages are like that too. A 3 year old doesn't know what verbs are. They just speak.

Another interesting thing is how people forget their path to personal journey regarding learning. "I did `y`, but you should do `x` because now that I look back I should have done `x`." "But, but, you did `y`! "Yes, but `x` is the way to go."

You mentioned musical instruments: great topic. The very best musicians have always been around music, sometimes not even being able to read music. There is no clear path, the only clear thing about this is the time + effort regarding learning something well: just have to put in the time.

Re: Practicing Elixir or any programming language

#22
I actually really enjoy doing katas on https://www.codewars.com/, especially when I'm ramping up on a language.

You solve a short problem, and then immediately see how other people solved it. I'll frequently write something and then see a solution that uses a library function I wasn't aware of, or a solution that's similar but better follows the language conventions.

It's really helpful to solve something short and get immediate feedback on it. You aren't learning how to write big programs with the language, but it's still useful at first.

Re: Practicing Elixir or any programming language

#24

I would like to mention http://exercism.io . It has unit tests written also

Yes, I've used exercism to broaden my knowledge and I've recommended the site to friends and colleagues who wanted to learn programming.

You mentioned tests: on exercism you don't write unit tests by yourself, the tests are only for you to check your solution. It certainly helps to see how tests can be written in any language, but you aren't forced into a strict TDD style.

The best feature on exercism for me is to be able to see the other solutions and learn from them.

Re: Practicing Elixir or any programming language

#25

I actually really enjoy doing katas on https://www.codewars.com/ , especially when I'm ramping up on a language. You solve a short problem, and then immediately see how other people solved it. I'll frequently write something and then see a solution that uses a library function I wasn't aware of, or a solution that's similar but better follows the language conventions. It's really helpful to solve something short and…

Agree, I have learnt both Clojure and Haskell on codewars when I was bored in lab. Another advantages is that the typical problems in codewars often does not involve learning extra libraries or IO, which often distracts me from learning the language itself.

Re: Practicing Elixir or any programming language

#26

I actually really enjoy doing katas on https://www.codewars.com/ , especially when I'm ramping up on a language. You solve a short problem, and then immediately see how other people solved it. I'll frequently write something and then see a solution that uses a library function I wasn't aware of, or a solution that's similar but better follows the language conventions. It's really helpful to solve something short and…

I do that with Exercism and Elixir. It's pretty awesome.

Re: Practicing Elixir or any programming language

#27
post #13

I always find it interesting how people learn so differently. Personally, I learn a language by building something in it. I want a feel for it, before digging deep and learning about theory. I only do that stuff much later, after I'm relatively proficient in the language. This is probably why I wasn't very good at picking up musical instruments. I was never satisfied learning at a slow pace and only being able to pla…

Yes, I'm the same.

With Ruby, I actually learned Rails first, and built a few apps with it (one of which is in production and going well). Then I went back and took the approach in this article to learn Ruby better. I still wouldn't call myself an idiomatic Ruby programmer, but I know enough to do any task I'm faced with without writing complete rubbish.

With the little Elixir I've done I took the same approach: dived in with Phoenix and started porting one service from a large, complex API from Scala to Phoenix. I picked up some Elixir on the way, and later took some more time to look at Elixir, the language.

Building by doing is great. It gives you motivation and concrete rewards, which keep you inspired to learn more.

Re: Practicing Elixir or any programming language

#28
Great article, thanks!

I'm not an expert Alchemist by any means, but whenever I see a `cond`, I try to see if it can be refactored out using pattern matching (after I was picked up on the same thing during an interview!)

   defp formatted_hour("AM", "12"),  do: "00"
   defp formatted_hour("AM", hours), do: hours
   defp formatted_hour("PM", "12"),  do: "12"
   defp formatted_hour("PM", hours), do: 12 + String.to_integer(hours)

Re: Practicing Elixir or any programming language

#29
post #17
post #13

I always find it interesting how people learn so differently. Personally, I learn a language by building something in it. I want a feel for it, before digging deep and learning about theory. I only do that stuff much later, after I'm relatively proficient in the language. This is probably why I wasn't very good at picking up musical instruments. I was never satisfied learning at a slow pace and only being able to pla…

I am reading Haskell Programming from First Principles right now. If I did not know how the language works from doing this reading, then I do not see how I could make anything useful without quickly getting annoyed by the compiler

But in Haskell your "do, see reaction" loop is the compiler. Most of the interesting bit of it is incrementally defining types and functions for your program and verifying that it's still legal. That way, when the compiler responds with something very confusing looking you know what caused it and that can help a lot with understanding what it's saying. And when it still doesn't help, you can ask on one of the various forums and gain some important new understanding that I don't think I would ever associate or understand from a book reading.

Re: Practicing Elixir or any programming language

#30

So his approach is to go through hackerrank exercises to learn the language. Anyone familiar with hackerrank able to comment on that vs say project Euler?

Last time I tried hackerrank i wasn't impressed - the problem specification was lacking, input/output wasn't defined well enough. Quality varied wildly between problems.
Post reply on HN