Fork me on GitHub
#off-topic
<
2019-08-26
>
jaide21:08:00

Any coder-radio podcast listeners here? Did you listen to the episode where Mike reports his 2 weeks of trying Clojure?

borkdude22:08:24

@jayzawrotny I'm a regular listener

jaide22:08:16

Oh yeah! I think I got it from you if I remember right. What did you think of that episode?

borkdude22:08:24

Of course I hoped he would have liked it, but 2 weeks might be too short to get past the superficiality of the syntax

borkdude22:08:27

I'm one of those people who loved the Lisp syntax from day 1, but there's a lot of people who it will have to grow on over time, and some people will just never like it

jaide22:08:50

Same. It also sounds like he didn't even use the REPL at all.

borkdude22:08:21

if you listen to the episode after it or the one after that, you'll note he might try it again

jaide22:08:30

He did mention it in the episode too. He seemed to be receptive to his merits, just doesn't enjoy lisp. It's kinda funny since the reason he disliked it was the reason I liked it: Not having to think about syntax almost at all. However, he also didn't make use of any LISP editors such as paredit or parinfer.

jaide22:08:33

This got me thinking would it be worth creating a git-book that serves as a modular getting started guide that covers most the popular tooling choices and some of the philosophies of working with Clojure?

jaide22:08:20

Admittedly Clojure did lose me my first go of it. I found learning BOTH the syntax and FP concepts a bit overwhelming. However, after studying FP concepts in my day-to-day JS for a year, my second attempt really clicked.

jaide22:08:03

But if there was one git book for beginners that cover VS Code, Atom, Spacemacs, and VIM with helpful guides and pointing to the many more detailed resources out there: Would it ease the pain for people coming to Clojure having a stronger background in imperative, c-style syntax trying to use the tooling their comfortable with?

seancorfield22:08:51

My general recommendation to anyone learning Clojure is to stick with the editor you already know if possible, to at least avoid two learning curves at the same time!

jaide22:08:05

That makes sense. I suspect most would agree with that. Unfortunately, the host did not understand why working with the REPL was important or what the LISP tooling offers which I think soured their first taste. Treating this as a UX test, I feel it unveils a strong starting place for improving getting started documentation.

jaide22:08:06

I quickly brainstormed the structure of such a guide. Any thoughts? https://www.dropbox.com/s/wzyi7m3nnfzthap/getting-started-clojure.pdf?dl=0

seancorfield22:08:02

I wouldn't bother with Boot at all in such an introductory guide, and I'd choose a different name than "inferior" for the non-nREPL flavor because everyone except Emacs weenies is going to get the wrong idea.

jaide22:08:23

How would you describe that behavior? Sub-process REPL vs nREPL?

seancorfield22:08:27

I think it needs to be pretty minimal overall with the goal of getting people up and running a.s.a.p. with a "correct" workflow.

seancorfield22:08:54

Well, for Atom/Chlorine, it's actually a Socket REPL, not even a plain/standard/basic REPL.

seancorfield22:08:10

I think the whole distinction is distracting, when you get started.

jaide22:08:18

That's a good point

seancorfield22:08:45

I would have a very short intro section that emphasizes the real basics of Clojure and that RDD is important, then a section for each editor that readers might already be using: IntelliJ -> Cursive, VS Code -> Calva, Atom -> Chlorine (ProtoREPL is pretty much abandoned at this point), Emacs -> CIDER, Spacemacs -> CIDER (presumably).

seancorfield22:08:38

With absolutely the bare minimum to get up and running and get "productive". And I'd stick to the standard CLI/`deps.edn` if possible since the docs for that are official (and the Powershell install for Windows is pretty solid at this point, even for a pre-alpha).

seancorfield22:08:42

That said, some of the editor options are going to rely on nREPL and that's easier to start up with Leiningen -- but I'd only go that route if the editor/integration does not work with CLI/`deps.edn` easily.

jaide22:08:15

I think we're on the same page about the short intro\part 1.

seancorfield22:08:52

Your mindmap suggests a longer intro than I would suggest 🙂

seancorfield23:08:26

Even easier:

clj -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"}}}' -m nrepl.cmdline -i

seancorfield23:08:41

(but, yeah, it makes sense to add it as an alias in deps.edn)

jaide23:08:48

Haha ok, I'll trim it then 🙂

jaide23:08:53

What would you consider basic\important enough to put in that brief intro?

seancorfield23:08:10

For Atom/Chlorine, you'll want something like

:chlorine {:extra-deps {compliment {:mvn/version "0.3.9"}} :jvm-opts ["-Dclojure.server.repl={:port,5555,:accept,clojure.core.server/repl}"]}

seancorfield23:08:47

Intro: REPL - brief explanation, key to productive Clojure; Parentheses - Clojure-aware editors make this a non-issue "No, really!"; FP/Language - just link to relevant http://clojure.org pages. No need to duplicate anything from http://clojure.org really.

seancorfield23:08:02

REPL section could link to (extensive) REPL guide on http://clojure.org at the end.

seancorfield23:08:47

Skip build tools. Not relevant to starting to use Clojure. Point to getting started on http://clojure.org for installing CLI/`deps.edn` stuff at most.

seancorfield23:08:56

Then pick an editor.

seancorfield23:08:41

For each editor, show the deps.edn alias, show the command-line to start an interactive REPL, explain the minimum packages needed in the editor, explain how to connect to the existing REPL, explain eval form / eval top-level form / and how to view doc / source for each editor.

seancorfield23:08:46

Real bare bones stuff.

💯 4
jaide23:08:52

Do you think it would be valuable to at least introduce deps.edn\clj and how to install it in a section between the intro and editor configs?

seancorfield23:08:40

That is on http://clojure.org -- just tell folks to read (& do) that one page.

jaide23:08:45

Assuming this isn't their first clojure resource, they may have seen a few tutorials, guides, etc.. for many different tooling setups. No need to explain them all.

seancorfield23:08:30

Depends on your audience -- if you want this to be "Try Clojure (the right way)" or "The Right Way (to do Clojure)"? 🙂

💯 4
seancorfield23:08:04

But seriously, pick one (I think you started by going after the first one?) and streamline everything to match that.

jaide23:08:19

Fair point. Perhaps add an optional FAQ section below.

seancorfield23:08:32

I'm not going to agree that lein/`boot` are geared to bigger projects -- given that we happily manage a 90K line monorepo with clj 🙂

seancorfield23:08:51

Good call on adding vim!

seancorfield23:08:32

Atom: rainbow parens has performance issues -- avoid. Minimal setup is chlorine, parinfer I think. lisp-paredit is a "nice to have". Check with @U0ETXRFEW about minimal Calva setup.

seancorfield23:08:06

Yeah, overall, looks good!

seancorfield23:08:28

I would say of lein/`boot` that they are older and therefore they (esp. lein) are more common in books/tutorials at the moment. I would also categorize them as "easy" rather than "simple" -- and indicate that CLI/`deps.edn` is "simple" and is designed (by Cognitect) to follow Clojure's principles.

jaide00:08:28

Ok thanks for the feedback! Going to copy it into my notes and bust out another iteration in a couple of hours.

pez05:08:58

About Calva setup. Calva includes Paredit, and also bundles rainbow parens. There is no need for a deps.edn alias. When you connect Calva to the project it starts it for you, injecting its dependencies.

seancorfield05:08:24

Right, but I think it would be good for the guide to be consistent and have each editor integration described in terms of starting a REPL from the command line and then connecting the editor to it -- because that's a "common denominator".

pez05:08:12

Why is the common denominator important? Each reader is supposed to pick up the section of his particular choice of editor, right? To me it makes sense to write each such section tailored towards the Tao of the tool.

👍 4
andy.fingerhut06:08:31

I believe the suggestion is that if you have some common denominator among all of the editor environments, like the clj/`clojure` CLI and deps.edn being used for the project, then you can have N versions (N=# of editor environments) vs. N*M (M=# of non-editor build/deps environments, e.g. leiningen, boot, maven, deps.edn)

andy.fingerhut06:08:00

Who would want to write N*M versions of this?

borkdude06:08:50

@jayzawrotny one piece of feedback: for editor integration I really recommend setting up a linter ;-)

jaide06:08:34

My instinct here would be to start with Pez’s option as a quick connect then at the bottom cover deps.edn alias — which may be a good practice for projects that are intended for collaboration with devs that may not be using Calva? If it means anything the host of that podcast did start with deps.edn as well.

jaide06:08:49

@U04V15CAJ Hmm if readers are just starting with Clojure wouldn’t they have enough errors barking at them?

jaide06:08:19

I’m not against that idea though. 😀

borkdude06:08:57

Since they might have trouble working with the REPL at first, static linters like joker and clj-kondo are really helpful imho, e.g when making typos or wrong number of args

borkdude06:08:52

Or even just basic syntax

jaide06:08:52

I’ll add it to the doc. Would anyone else like to weigh in on if linters are helpful while learning the language?

pez06:08:15

Sounds good with the quick-connect first, @jayzawrotny. Calva does ask about which aliases to launch with, so if the instructions are ”Leave all aliases unticked, for now”, it could be added that there is reading about aliases below.

👍 4
pez06:08:26

About linters, they can save your sanity beginning with Clojure, I think. Figuring out what is stopping your code to work can be a really tricky. (To this end I am aiming to get linting down to an opt-out setting in Calva, where the user does not need to install anything else but Calva, and linting is just there.)

borkdude06:08:30

@jayzawrotny I think the linters I mentioned give you a lot of the static benefits that Cursive give you, without using IntelliJ. Obviously I’m biased.

borkdude06:08:11

Gives. Phone. Spelling...

jaide07:08:01

Those are great points. I think trying to set it up myself will guide my slant on that more. If it’s easy to setup I’ll include it for each editor, if I struggle or the setup process is too involved I may choose to reprioritize it on an editor-by-editor basis.

pez07:08:40

For VS Code I think it is not easy enough yet. It gets messy with all the OS specific stuff in such instructions. Maybe just recommend the user to consider adding a linter to the setup, providing a link to instructions. I can write a Calva wiki page you can link to. I should write that page anyway.

jaide07:08:04

That sounds good to me.

calva 4
pez07:08:32

The Calva quick connect doesn't need this split: * start an interactive repl * connect to existing REPL It is rather something like: * Let Calva launch the project and connect the REPL.

andy.fingerhut07:08:48

I have never used Calva -- does it auto-detect boot/Leiningen/deps.edn and use whatever, or is it limited to a subset of those?

pez07:08:59

Leiningen, deps.edn and shadow-cljs, so far. Boot yet to be added.

borkdude07:08:29

Boot is a bit more difficult since it’s not a predictable config file format I guess?

pez07:08:41

And also lein-figwheel, Figwheel Main and shadow-cljs. Amd project custom cljs repls can be configured. (We are working with improving that last part a few notches right now.)

pez07:08:27

Yeah, I don't know how to deal with Boot, tbh.

borkdude07:08:05

What I usually do is start an external REPL with boot and then cider-connect

borkdude07:08:28

I’m also doing that with lein and tools.deps

borkdude07:08:57

Jack-in is a bit too magic for me

pez07:08:24

Yes, Calva lets you connect to projects with nREPL. This is a jack-in limitation.

Mno07:08:08

in clojure-nl there was a guy who did an intro for true beginners with clojure and I think he used: https://sekao.net/nightcode/

Mno07:08:02

so for trying it out it might be nice as well, I dunno. It takes away the vast majority of the mental overhead apparently.

pez07:08:43

It sure does. I think you can include Nightcode in the project? Might be nice for people who just want to check Clojure out. No need to install anything for the RDD.

pez08:08:52

About lein and boot being ”Other build tools somewhat similar to clj/deps.edn but more geared towards bigger projects”. deps.edn is not a build tool, right? I think I have read someone at Cognitect stressing that point even.

jaide08:08:42

I was thinking about that one too. It deserves mentioning but I think it should go into the FAQs... I had another idea for a project that it might be better suited for. Imagine a survey you fill out that pairs you with your ideal Clojure learning experience. If you don’t like books, don’t want to configure editors, then Nightcode is perfect!

Mno08:08:12

That sounds like a cool project idea, maybe I could annoy the meetup guys into working on it.

Mno08:08:06

maybe! Gotta sell them on the idea first though.

yuhan12:08:15

Maria definitely has a place in this, it's tailor-designed for beginners and you don't have to install anything to jump in and get started

yuhan12:08:15

oops, just realised it's already in the above spreadsheet

👍 4
seancorfield17:08:01

The reason I suggested the "start REPL, connect editor to REPL" approach for all editors is that it is "baby steps". Nearly all Clojure intros start with a bare REPL and expect beginners to type into it. So the only difference here is to start the REPL in such a way that they can connect an editor to it and then see how they can switch from typing-into-REPL (per most tutorials they'll encounter, and the http://clojure.org guides!) to evaling-from-editor without having to deal with a whole new way of getting an editor started inside the editor.

seancorfield17:08:51

@U0ETXRFEW Re: Nightcode -- the whole point of this guide is to encourage folks to try out Clojure in the editor they already use -- which is why VS Code was one of the first listed.

pez18:08:43

Yeah, maybe Nightcode doesn't fit neatly into this guide. To me Nightcode just seems like such an excellent approach to the task of removing barriers to entry.

pez19:08:01

Regarding the REPL prompt. I think it makes sense to introduce it with the simplest command line possible, clj, no aliases, no nothing. Then continue with that another way of getting to a REPL prompt is to open a Clojure project in your favorite editor, and jack in. Then introduce that the same editor gives you access to the REPL inside the files themselves. (Maybe even mention that some people only use the prompt occasionally, staying inside the files for most explorations. But that might be occurring to me because it happens to be my personal preference for using the REPL)

seancorfield19:08:19

@U0ETXRFEW I know this is a (very) long thread but I wanted to check you've read all the initial discussion around this?

seancorfield19:08:41

This all came about because of a blog post by a guy who tried Clojure but dismissed it because he didn't get up and running with his existing editor enhanced with some bare minimum necessary add-ons and a good RDD workflow. So the point of this guide is to provide a very simple, straightforward path to a good RDD workflow with whatever your current editor is.

seancorfield19:08:54

It's not meant to be a full guide to any specific editor.

seancorfield19:08:46

Each editor-specific section should be simple, offering a single, basic approach for folks completely new to Clojure to get that editor -- that we assume they already use -- up to speed in the minimum number of steps.

seancorfield19:08:29

Each section can then point off to deeper documentation about the editor, Clojure integration, and stuff like integration with lein/`boot`/jacking-in and so on.

seancorfield19:08:45

But the baseline is: get CLI/`deps.edn` installed. Learn how to start a REPL (with clj) that you can type into and that your existing editor can connect to. That's it. The quickest, simplest path to RDD.

seancorfield19:08:12

The guide should not overwhelm users with options -- they can deep dive later into any particular editor. The guide benefits from having all editor sections follow roughly the same path so that readers can see that they're not locked into any particular editor based on the choices they make about how to start REPLs etc: the same simple approach works for all editors.

seancorfield19:08:02

The only real difference is whether to start nREPL from the command line or also start a socket REPL (for Chlorine).

pez19:08:16

I've read the thread. And I have also started to listen to the podcast episode to gain more context. Will finish listening to that tonight. I think I am pointing at a very straight path to getting started, and I am totally aware that it is not about a specific editor. Also agree about not overwhelming with options.

pez21:08:57

Right, so now I have listened to the full episode. Very good stuff, all of it. Because they used Calva I learnt tons from listening to it. And I do wish I could do more about the Parinfer situation (that was a painful part to listen to). Anyway my takeaways are that I am glad I had colleagues introducing me to Clojure, that people need to quickly find the structural editing help, and that the Clojure coding workflow needs to be highlighted much more. I think the guide being developed here will do wonders, and I will think really hard about how Calva can be adapted to help in these first steps.

12
👍 4
Mno07:08:19

@U04V70XH6 but what If you've never used any editor before (as in absolute beginner?) The closest way to "not learn an IDE at the same time as learning the language" would be an app that has all that stuff all included.

Mno07:08:14

but if that's not the scope of the idea, I guess it's fine.

seancorfield15:08:54

@UGFL22X0Q complete beginners need a different guide, I agree. This guide is for programmers who want to try clojure -- to get them into an RDD workflow with their existing editor because that's the past that is so very different with clojure.

seancorfield15:08:26

I think night code is a good place for complete beginners to start

Mno16:08:23

Yeah, totally agree then, wasn't sure of the demographic.