Fork me on GitHub
Petrus Theron11:09:53

Need some teaching advice for code. I want to start an initiative at work for everyone to start coding and JavaScript seems like the obvious go-to as the assembly language of the Internet, but it's so badly designed. Is Clojure a good idea as a first programming language?


people will be put off by braces


python is commonly used as a first language


simple, limited punctuation, range of libraries for varying skill levels

Petrus Theron11:09:13

You mean braces in JS?


braces/brackets in clojure

Petrus Theron11:09:38

Python has lots of syntax. These are non-coders who have no preconceptions of code, so I'm unsure if the Clj/cljs parens will be an issue.


If they’re just learning for fun, I would absolutely just do clj.


The initial learning curve is pretty steep, but, for an absolute beginner, it always is, so not a real net loss there.


My biggest issues with language advice is when someone wants to make a living doing it. I pretty much gotta say “clj is the way things should be, but, unfortunately, you have to learn these other piles of crap to get a job"


Don’t get put-off by the braces anyway, there aren’t actually more than JS or Java, its just that due to the structure and concise nature, it is a higher percentage of what you write. Actually try taking equivalent Java / JS / Clojure and removing all the code, just leaving braces (assuming the preferred form of using braces, i.e. you can do a single line if without braces, but don’t) you will find Clojure to be no worse than its compatriots. Obviously if you compare to something like python with very little brace usage that is a different story. But I have seen that demo done, and it is a good way to retire those mis-conceptions. In general though what I have learned is that people who start with a functional language like Clojure tend to be able to learn OO and imperative languages easily, however the inverse is not true, starting OO breaks your mind a little bit and makes functional work realllly hard.


@petrus: For absolute beginners it's important to have quicky/easy results early on. For that I think is fantastic. It also comes with an IDE so it's super easy and a lot of fun. Otherwise python, yeah.


Scratch is simple to get going with and give people quick feedback, python is not bad, but personally I think it encourages bad practices, the spacing as code is good for enforcing good presentation, but that’s where it ends, the “idiomatic” way to solve things in python is often horrific practice for example using falsyness to check for if something has been set is fraught with peril, my fianceé for example got caught out by the fact that midnight is also false, or was until recently, so it’s not even consistent, and that is only one of the many cases. I have also found python to be awkward on a Windows environment if you end up with both 2.X and 3.X. It’s certainly a traditional starter, but I’m not sold. Scratch if you want absolute basics, JS tends to be a good starter in that people can be playing quickly and producing fun and useful things like lots of people are up for making a website, as opposed to more scripty or backend languages where people will often get bored of seeing terminal apps very quickly, indeed many of them wont have even seen a terminal. We had a similar initiative at my place, the second we moved from simple JS / HTML our group halved and quickly dropped to 0, people just were not as interested in the backend. Of course Clojure and JS can do both, but it’s still likely too much for your average non-coder

Petrus Theron12:09:36

Hmm. Good points, @dexter. What about ClojureScript + figwheel or boot w/reload? That way they learn Clojure and they have immediate feedback w/o JS. There's an extra build step for publishing. The stack traces are hell, though. And I have to explain about Cljs -> JS.

Petrus Theron13:09:17

The big downside is that the resources for Cljs are lacking far behind those for JS/Python.


yeah, same problem I think, we scared people off even just with git, build processes will be confusing, lisps with their odd way of even doing a simple add are a bit dodgy (by which I mean the unfamiliar polish notation), dodgy single files or folders are better, we just had people using Brackets which can run your site / has autocomplete etc and python -m SimpleHTTPServer for just simple files / folders. Another good option is it will just serve the stuff in the folder.


@petrus Do they have a background in Excel? If so, learning clojure isn't a huge transition - functional, prefix notation, etc. I was an analyst heavily using excel and learned clojure as a first language bc it made the most sense to how i was already thinking about problems.