Don't feel confident with Elixir

It’s my first week of learning elixir properly from the start, and I can remember the generic syntax, though when I solve coding problems or try to build something, I just can’t do it without looking at other peoples code or searching it on Google.

Is that normal for only one week of learning? :thinking:

1 Like

Honestly just stop worrying about what’s “normal” or time periods and just keep going forward. People is different, some will learn in a week and to some it will take months. Find an excuse to use Elixir and go from there, use learning materials as a complement and as a reference. If you need to google 100 times something it’s fine too, nobody knows everything at all times, I have a couple hexdocs tab open most of the time.

But by all means start writing something by yourself to get the ball rolling and getting out of the tutorial hell. Write some code, bad code, ugly code, it doesn’t matter, it will eventually get better in a month or in a year, but you won’t improve if you don’t even start.

5 Likes

I think you are a bit too self conscious, which is fine and absolutely normal when learning. Just be aware that you might be worrying too much for things that don’t matter too much, and will eventually improve as you gain experience.

Oh yeah :slight_smile: but writing bad code is not a problem. Rather, it’s the only way to learn to write good one. The objective is not to never write bad code, but rather to get to the point of writing good enough code when it matters. As a matter of fact, I have written more than my fair share of bad code, and I suspect everyone around here has. Actually, I still write bad code, it’s just not the code that I normally publish or advertise. We write bad code whenever we are challenging ourselves with something outside of our comfort zone, which is how one develops the “mental muscles”. Writing good code is a discovery process, which necessarily involves producing bad code and improving on it.

No worries, there are no additional developer points for remembering the syntax by heart :stuck_out_tongue: You might eventually remember it. I honestly do still forget basic methods or constructs and have to look them up, but since search engines and API documentation are there, I don’t see a problem with using them. Eventually, the things you use the most will come naturally. The others, you can look them up.

Imagine if you were learning a spoken language: it would be unreasonable to expect you to speak perfectly after studying a few books, without practice, or to remember all the new words and expressions at first try. Try to be easy on yourself, the more you practice the better you get, especially the kind of practice where you make mistakes and reflect on them.

7 Likes

Wow, thanks for the detailed answer. I feel a lot better now. :grinning:

The spoken language example is a really good one, thanks again.:+1:

3 Likes

Honestly, that’s totally normal. Learning something new takes time. Don’t focus on how much you can or can’t yet do without referencing a tutorial or code example. Concentrate on understanding something, no matter how small, every time you sit down to learn.

2 Likes

This. Thanks to Elixir, pattern matching has become such a fundamental part of my thought process when coding. Working without it seems absurdly verbose.

1 Like

I would also add to the “stay away from macros”, “stay away from genservers”. They are imo a huge antipattern for 98% of coding tasks. You should understand how they work (because they are important, and using genservers that other people have written is core to erlang and elixir) and then almost never write one unless you are building shared state in a game, writing a stateful connection driver (tcp, some udp protocols, http), or creating a “soft avatar” for something that exists IRL.

7 Likes

Everyone here wrote bad codes. :stuck_out_tongue:

I highly recommend Exercism.io which has been already recommended by @crispinb because that is the most efficient way I think for beginners.

Skills get improved by good practices. A perfect practice would go through these steps:

  1. you perceive one of your weaknesses
  2. you plan some exercises to practice against it
  3. you focus on doing the exercises
  4. you get your feedback, from your mentor, or by comparing it with what an expert does for the same exercise. The most valuable feedback is how an expert thinks about the problem.
  5. you understand it. It becomes part of your skill and it’s so natural that you’ll never notice that.

You can’t read to become a great basketball player. The only way to it is to practice against weaknesses.

Possibly you don’t know your weakness and that makes learning inefficient. That’s why having a mentor would be great. I’ll be happy to help as a mentor because I’m quite interested in theories of skill acquiring and practicing my mentoring skill.

3 Likes

Yeah I tried Exercism though felt like building actual programs is more fun. About mentors, I use Exercism in practice mode. :no_mouth: I guess I gotta change it.

OF COURSE.

Syntax means nothing. It’s super subjective whether it’s “good” or “bad”. There are people who swear by Brainfuck and APL after all. Others think LISP is the greatest thing ever (and I can understand why since it’s super simple and recursive and thus easily composable). And others, likely many in this community, dig Ruby / Elixir / Crystal syntax.

The point remains though: syntax means absolutely nothing, especially if you have some sort of an IDE that helps you with autocomplete – and nowadays you don’t even need a full IDE, any language with a good LS (Language Server) implementation is giving you that.

So yes, understanding what does the thing beneath do is much, much more important, by a very long shot.

4 Likes

Great explanation, thanks! :+1:

Another vote for Exercise.io -in mentored mode-. Sometimes it takes a day or two before you get the review and can continue but so far the reviews have been of excellent quality. It’s also nice to see how others have solved the problems if you had any.

2 Likes

“Coders code”, it’s just the way it is.

Staying motivated can be a real challenge though. One problem with learning a new language these days is that you have to know a lot to get to the point where you can do something “interesting”. Try working at two levels:

  1. Basic exercises and simple “obvious Katas” - these are like playing musical scales, not wildly engaging but really good deliberate practice at learning the syntax, the standard libraries and idiomatic code.
  2. Doing something “real”, this may need to be small at first but should be interesting to you. Discord bots have a clean API and can be fun, or use Phoenix to present an existing API-accessible data set in a novel, and useful-to-you way.
    BTW, simple Liveview projects are a great entry point! There are a lot of free resources to get you started and working on them gives great real-time rewards.

The “real” stuff keeps you motivated and the “deliberate practice” of doing a kata or two every day helps you improve faster.

4 Likes

This is excellent advice (from the perspective of a recent Elixir learner to whom all this is pretty fresh!). Starting with portions of learning time devoted to both ‘bottom-up’ and ‘realistic’ material works well.

Unless they’re mainly concentrating on bit-twiddling or maths problems, a learner just has to accept that they will be surrounded by a fair bit of mystery to start with. Ideally that gets peeled that away in layers over time, but while still getting actual coding done. Elixir’s tooling really helps here, as it scaffolds projects so well. It’s amazing what you get with mix phx.new ..., and you don’t have to thoroughly understand all of it to get web apps up and running.

Agree also that playing with LiveView is an pleasingly motivating exercise. I enjoyed the video course at Phoenix LiveView Free Course | The Pragmatic Studio - the free sections are worth going through to get a taste of LiveView.

1 Like

:+1: Thanks for the resource, will check it in a second.

Yeah I’m currently building a Discord bot using the Nostrum library. It’s pretty cool and I already learned a lot of new things. :slightly_smiling_face:

1 Like

I do feel the same way, but I realized last night that the test projects I’ve been thinking about have been way, way too big in scope, so I’m going to build something very simple, that incorporates the parts that I am interested in, and learn from that.

3 Likes

Start coding simple problems, and then increasingly complex ones.

For example, pick a simple program in the language you use or know best, and port it to Elixir.

Also avoid mixing many new concepts from Elixir in your first exercise programs.

You will get confident very quickly, and then come here again to tell your experience.

Good luck.

2 Likes

Should I learn Phoenix with OTP or after OTP?

1 Like

I see, thanks. I’m working on a Discord bot right now, it’s fun. :slightly_smiling_face: