Getting Back to Programming
At the beginning of the year, I was messing hard with Haskell trying to build a MVP. Got burned physically and emotionally. So I took 2 month off from programming, wrote, read and travelled instead.
April
May
Burning out on a project and falling flat on your face can significantly decrease your confidence on being a "programmer", no amount of Redbulls or potions are going to fix it. But:
You are not defeated unless you give up.
To my good fortune, I met with Matus, the guy behind Ethlance this month. We talked about crypto and most importantly about why he is building stuff with Clojure.
He gave plenty of good reasons. So in that instant, I knew I had to jump into it.
With my brief experimentations with Clojure, I am going to layout some tricks from the "self taught" - "self-tutorials" mindset. Here we go:
The repl is your best friend.
The tools I currently use:
- iTerm: for my favorite shortcut
cmd + ]
to go back and forth between panes/screens - vim fireplace: identation + prettyness +
shift K
to look up clojure lang semantics definitions - repl with Leiningen: fast iteration aka messing around
Fast tricks on the cli
tab to autocomplete both on the terminal or while on the repl.
to check whether a helper exits on Clojure core just execute the command straight to the repl.
- If it worked you will get the memory address of the method
- If it doesn't you will get a "Unable to resolve symbol"
Function signatures, anybody?
If you messed around with Haskell, you learned to love function signatures. With Shift K
your can have the documentation of any functions while the repl is on. The length tend to be not too long, not too short, and you get the function's signature on top.
For instance the definition for reduce:
When I got this hahah moment, I was like here I go: "notorious Clojure hacker". The feeling is awesome.
Then looking at the function signature of apply:
I instantly knew I could do this:
(apply + [8 9 8])
; 25
The command dir is very useful:
It literally prints out all helper functions at your disposal on a specific namespace.
tip first run
(all-ns)
to get all your namespaces.
And by the way, if you are feeling handy at the keyboard, you can just do:
(doc `command`)
to get the documentation of a particular command.
Stalk on repos
Another trick is looking how one helper function got used by a programmer you look up to.
For instance, I read the doc for doseq
and I'm not getting it. so I jump to the ethlance repos then:
For the most part the feedback loop with this can be 2 seconds or less. So in under an hour, you can learn a lot. If you get in the zone, you'll be crushing it.
All about the process
This is not just about jumping into Clojure. You can do this with any language you want to learn. The most important thing, is having tricks to figure things out on your own.
Motivation: rather not, seek clarity in your intent
At the end of the day, I think "Getting back" is somewhat harder or at the very least different. The weight of doubts can lead you into a path of never-ending procrastination or you kind of "half-assed" your getting back.
Though I am not going to end this with some motivational quotes. I think in anything you want to undertake: "clarity of intent" is the most important thing. That's how individuals, teams, companies (i.e. Elon Musk minions) succeed.