elixirschool / elixirschool

The content behind Elixir School

Home Page:https://elixirschool.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Suggestion] Provide code comparison between Elixir and imperative languages

theevangelista opened this issue · comments

In the basics lessons, such as Enum, we could provide some examples of pseudo imperative language, so the student would assimilate their previous code with a new way of expressing the same intent. Think of learn by translating between spoken languages. For example given Enum:

To apply our function to each item and produce a new collection look to the map/2 function:

iex> Enum.map([0, 1, 2, 3], fn(x) -> x - 1 end)
[-1, 0, 1, 2]

Adding, could help remembering what to reach for when facing the same problem, with a known solution in student's previous language.

You might have seen this in other languages as:

new_list = []
for (item in [0, 1 ,2 ,3]):
  new_list.append(item - 1)

Any thoughts? Is this needed?

This is a great idea @sleepiejohn. I've been thinking about overhauling the homepage to better "sell" Elixir. Highlighting some key benefits and strengths.

I think a blog post could also be useful if you wanted to contribute something like that 😀

Nice! Yeah a blog post could be useful for now since we can then expand into more idioms we see people struggling with. I will see what I can come up with in the weekend

@sleepiejohn this came up again today when I was discussing Elixir with my friend @jcarouth, I think it would do Elixir/Elixir School a lot of good to provide a better "sell". I added a starting page to the new beta site but it really needs to be expanded: http://beta.elixirschool.com/en/why

I was thinking in the footer we could have links to pages like "From Ruby to Elixir", "From Java to Elixr", that focus on comparing the languages and selling Elixir's strengths in the comparison.

@sleepiejohn yeah, i totally agree. Speaking of myself, I have a java background and at the beginning of elixir studies, it was always easier to understand something new I was learning when I could compare it with something I already had studied in java, but it was hard to make these comparisons sometimes, since my knowledge in elixir was very shallow. So, i believe it would be very helpful for beginners to have something to compare their previous knowledge in other languages with what they are learning in elixir.

I think the @doomspork 's idea of having some sections like "from java to elixir", comparing both languages, not just in theory, but showing the code, as in the example sleepiejohn gave in the beggining, would be supper cool. I totally support it.