ratouney / elixir_learn_avarteq

0 stars 0 forks source link

Finished 02_starcraft, just a few questions #2

Open ratouney opened 7 years ago

ratouney commented 7 years ago

@arkanoryn I have passed all the tests in this exercice but i was wondering about the use of the "funcname()" and "funcname!()" usage. Is it a convention to make these "check-functions" with a "!" at the end or was it just a random caracter ?

PS : since when can zerglings attack air units ? ("attack_air: true")

arkanoryn commented 7 years ago

They can not. I noticed it after pushing yesterday. Planned on fixing it, but things came up. ^^

To answer your question, it is a convention. Usually when you work with a Database or a server, for example.

Like when you want to access your Repo (database), you will do:

  Repo.get(...) # == {:ok, data}
  Repo.get!(...) # == data 

Or when you use Tesla (https://github.com/teamon/tesla). If you make:

  Tesla.get(my_url) # => {:ok, response}
  Tesla.get!(my_url) # =? response

In this case, it is just an exercise to make you try in an easy way pattern matching. :)

However: the point of the exercises is also to create modules. Please, create the appropriate Zerg.Units and Terran.Units modules. In new files, preferably. ;)

Cheers, Ark

PS: Is it normal that you are the only one from the school to have answered us? Are our emails on spam boxes? Benjamin emailed us back, but I am still waiting for his GH username... :/

arkanoryn commented 7 years ago

Oops. Actually Repo.get raise an error in case of error.

cf. doc: https://hexdocs.pm/ecto/Ecto.Repo.html#c:get/3

Should have taken insert as example. :) https://hexdocs.pm/ecto/Ecto.Repo.html#c:insert/2

ratouney commented 7 years ago

I've asked Benjamin and he did answer but he send his email adress and not his github id (which is #18555491 if you can add him to the project). But for the others, I just know that one gave up because he can't move to Saarbrücken but I've got no info about the rest

arkanoryn commented 7 years ago

I need his Username, not ID. ^^

arkanoryn commented 7 years ago

Thanks for the feedbacks ;)

ratouney commented 7 years ago

His username is "Prodjia"

arkanoryn commented 7 years ago

Thank you.

Unless you have further questions, I think that this ticket can be closed?

Unfortunately, I do not think that I will have the time to make further exercise tomorrow. I am leaving for vacation on Friday (one week). Before that, I plan on making chap. 3 and 4. Maybe 5.

In the meantime, if you do not know what to do: try the exercises at exercism: http://www.exercism.io/exercises/elixir/

ratouney commented 7 years ago

I'm not sure about what the Zerg.Units and Terran.Units are supposed to do

arkanoryn commented 7 years ago

Return Zergling and Marines map?

You should not have moved the Setup module out. I used it to make the 'testing code' a little bit clearer and cleaner. But you were not supposed to move it out. ;)

arkanoryn commented 7 years ago

Hey @ratouney

I just looked at your code. While your code compile and does the work, it is not the Elixir way.

Please, use pattern matching to determine which unit you wanna build. ;)