Hi folks. All of you are way more experience than what I am. I am still busy studying Erlang and I love it. the syntax is crazy but I love and somehow understand it. Now I have a weird issue. This morning I looked at the small modules that I had done from the programming books and I suddenly had a “sort of realization” that I have no idea what I am doing and reading through the code, I could not understand anything.
Does this mean that I am not cut out to be a Erlang programmer or is this just some “bump in the road” and if so, how did you folks (if you had these moments) overcome this. Do I need to take a break for a few hours / day?
I guess something like this is to be expected in the early days of picking up something new, don’t let it dishearten you You have to juggle a lot of (more or less new) things in mind at the beginning after all, but they will become natural with time and you won’t have to think about them any more, so can focus more on what you are trying to do instead of how to do each little step.
My advice would be to take some time off, do something entirely different for a day or two (just a few hours might not be enough, depends). Let things settle down in your mind by themselves. If, after that, you find that you still can’t understand what you did, start it again from a blank slate.
When it comes to learning something new, think of your mind as a piece of lawn where many people walk about without directions. They all have their purpose, some may have an idea about where they should be going, some might even know their way there. But most of them just walk about and get in the way of each other, all the time trodding down the grass. No paths will emerge, just a muddy mess that is getting messier by the minute.
Instead, give it a little rest once in a while, take it easier, let some grass grow back, let fewer people walk about, and mostly those who already know where to go, and only a few who have yet to find their way, then a few more, and so on.
After a while, you will end up with a nice network of paths across the lawn. Now pave some, put up sign posts, warning signs where appropriate, etcetc. You can take the analogy further from here
That takes time, yes, you can’t rush it. But if you “cram”, you will probably end up with nothing but the confused muddy mess, I think.
If I’m stuck on something, I usually do something completely different for a while, this might be going outside for running, do some handycraft, taking a shower…
Often I have the best idea on how to solve something when not thinking about it
I’m a beginner, too, and have been learning Erlang longer than you. I still regularly deal with these mental blocks. It’s perfectly natural when you’re trying to process so much new information that requires you to think differently than with other languages you’ve used in the past. I’ve been working through exercises on the site Exercism.org. I’ve gotten to the point where some of the problems are simple, but others that are supposed to be easy sometimes completely mess with my brain and I can’t figure them out. When that happens, I ask for help on the Erlang Slack, on the #learning channel. Come join us!
I completely agree Maria! In fact I specifically mentioned something like this in a blog post - to not be afraid to take a step back or to re-read chapters - it is completely normal, just go back a step or two whenever you’re feeling a little lost Dmitri
Thanks. I took a ride yesterday to clear my head. This morning I opened up my editor and glanced at some of the modules that I did. It is still murky. It could also be external stress that is causing this issue. I think that I am struggling to see how Erlang gets used in OTP. I know that that sounds weird but somewhere along the line, I missed the “bridge” connecting the two. (If that makes sense).
Don’t worry, that’s also a normal reaction in the early stages of learning OTP, which poses sort of an extra (mental) layer on top of Erlang itself But the feeling of “OMG, how will I ever understand this? ” will turn into “OMG, how could I ever live without it? ” as you get more comfortable over time.
The jump from learning Erlang syntax to understanding OTP is really big one and taken too early might be daunting. Perhaps consider reducing expectations you put on yourself today - that is focus on having something that works without understanding why - take a note of questions/doubts you have and come back to them later.
When you feel ready to formulate an exact problem - ask a question in a place like this forum.
You can also check my other post, which is maybe related.
I’m a decent programmer. And there are some languages I’ve decades of professional experience with. But you know what: sometimes I look at code I’ve written only days ago and I’m in the same position as you were (“WTH is this? What does it do? Who wrote that rubbish?”)
I think most of the time the problem is (at least) one of:
a chunk of code I try to understand is too big - its not well structured
bad naming. I was lazy and did not take time to name stuff right.
no names at all, just functions that call functions
So what I try to do to keep these WTH-moments at minimum, is: take my time to write code, that does not make my future-self hate me.
What I do is overdo the comments in the code. As I am only using my personal laptop to learn, I print out all the modules that I have done. Having the comments on top helps me remember what I did. Maybe I should get into the habit of writing docs to be viewed on HTML on my browser, but I prefer reading from good old fashioned paper
I think, for you as the developer of the code, comments should not be the thing you read first when you try to understand your code. That’s for people using your code (if you write a lib for example). Your starting point should be the code. And this code should be as clear as possible, Sasa Juric did a great talk on this topic: Clarity | Saša Jurić | ElixirConf EU 2021 - YouTube
This does not mean that you should not write comments for yourself. You should, but the ones important for you are the “Clarification comments” (as in the article above) - I’d like to add “missing clarification comments” to my list above.
But the most important comments for you as a developer in my opinion are are good names, but …
There are only two hard things in Computer Science: cache invalidation and naming things.
Hey man Sorry Im late to the party but I just wanted to echo everyone who said, take a break! My approach to learning erlang (which im still learning) was to charge through the learn you some erlang book. I greedily soaked up chapter after chapter, and somewhere mid gen_whadjamakallit I realized I was getting lost. So I stopped, and looked for non OTP problems to solve in basic erlang to just train those muscles instead. I found the advent of code problems and exercism (and the erlang koans). Doing that let me keep compacting my confidence in the actual language, not the frameworks and soon enough I was fresh and ready for the OTP stuff.