
Learn ClojureScript in a Cloud IDE - gw
https://sekao.net/blog/nightcoders.html
======
dkarapetyan
> When I was a teenager, I got a Dreamhost account and learned web development
> by uploading PHP scripts and refreshing the page until I got what I wanted.
> The world of transpilers and SPAs has robbed beginners of this simple
> experience.

This is the thing that makes me angry the most. We started with interpreted
languages with fast feedback loops and then "real" software engineers got into
the game and turned all these interpreted languages with fast feedback loops
into "compiled" messes with nightmarish debugging experiences.

Fast feedback loops and obvious debugging trails should be a feature that more
people pay attention to and the more layers you add the less likely you are to
have either one.

~~~
optionalparens
I don't understand what you are getting at here, can you explain more? How is
an interpreted language turned into something compiled? It sounds more like
you have an issue with heavy weight frameworks, which I can agree with, but I
am not sure if this is what you are really trying to say. I also agree that
feedback loops and debugging trails are important.

Clojurescript tends to do well with 2 of the 3 you listed. Feedback loops are
quick with hot code reloading, side-by-side development, browser tools
integrations (ex: with chrome dev tools) and so on. The Clojure/Clojurescript
REPL itself is probably one of the best feedback loops I can think of that
I've used other than proper Lisp machines or good Smalltalk images. Add in
working with a data-oriented approach cljs encourages and using immutable data
structures, EDN, transit, and things like that, and again things are a fast
feedback loop predictable, and easy to debug.

The actual debug trails however in Clojure and Clojurescript leave much to be
desired but are getting better. I personally haven't had many issues but I
grew up on assembler, Lisp, C, C++, and that kind of stuff. After a few days,
most of the more obscure things are at least predictable and you understand
what they are. Given you can attach with a debugger from Emacs, Intellij, Vim,
etc. it's even easier to figure out what's going on. Clojurescript and Clojure
tend to discourage big monolithic things that aren't composable via the
standard library, 3rd party libraries, and language design. You simply will
shoot yourself in the foot if you start creating giant framework blobs and
things that can't compose, so to me that's a good thing. For instance, using
things like map, reduce, cat, transduce, apply, update, etc. become infinitely
harder. Of course like any language, anyone can still do dumb stuff but it's
nice that things are pretty simple from the functional point of view that
common sense hopefully sets off alarm bells for people.

Anyway, Clojurescript in general for me is a superior experience compared to
the old days when I messed around with Perl, CGI scripts, PHP, ASP classic
(COM+ add-ons!), and so on to get a dynamic website going for something.
Refresh, print line, and approaches like that are and have always been
garbage. I've never had better visibility into an app than with Clojurescript,
and given that most things are idempotent and pure that I write where
possible, testing is also even easier. In most SPA frameworks in
Clojurescript, you also have a single source of truth and visibility into it
is as simple as running a built-in function to grab a map key or just printing
the map if you want the old school approach.

~~~
dkarapetyan
I have nothing against clojurescript. I was making a general point and
agreeing with the author. His approach is the right one when compared to what
is required to "compile" one form of javascript into another form of
javascript and then "link" it with some monolithic framework.

That is the state of affairs that upsets me. Each framework and toolset in the
js ecosystem is basically a virtual machine with its own idiosyncrasies and
incompatible bytecode that doesn't interoperate with anything else in the js
ecosystem.

Clojurescript commits some of the same sins but at this point things are too
far along and diveristy in general is not necessarily a bad thing. I just wish
the debugging experience was better and the tooling was a bit more
standardized so I wouldn't have to relearn everything every time I wanted to
try another flavor of js.

~~~
optionalparens
Oh didn't think you had anything against Clojurescript, just maybe pro-old
school PHP ways or something.

I've been a bit spoiled by ClojureScript and I can't imagine using much else
as far as js tooling. I'm less familiar with Elixir and some other newer
options. I've only played with Elixir a bit and not used it on a real deployed
project, but some people like the experience of that too. For me what puts
Clojurescript over the top is it brings most of the sane things about Clojure
and allows me to write JavaScript essentially in a sane way. It also does so
without stopping me from being able to use JS libraries when I absolutely have
no choice. The isomorphic code potential is just a side benefit - most of the
time I can just take a Clojure file and rename it cljs or cljc and it just
works as long as I'm not doing anything obviously pure Java there.

I agree Clojurescript commits some of the same sins. As far as tooling, I feel
at least Clojurescript's is pretty standardized. I agree there are too many
ways of doing the same things out there. JavaScript in my eyes is a terrible
language that needs to be taken out back and shot - faster VMs and the browser
are not an excuse - the browser itself is in a similar position, but that's
another discussion. I've been programming a long time and I've been exposed to
some pretty terrible things so I don't say that lightly. JavaScript is doubly
awful in the browser. And yes, I get it and am aware of the new enhancements
to the language long overdue. Clojurescript is the best current compromise for
me, but like anything, I'm happy to use something else if it makes sense.

I'd still advise everyone to be wary and there's no one size fits all. In the
past, I tried things like GWT and various approaches in .NET to transpiling
and found them lacking or inferior, but I understand they work great for some
people. Clojurescript is the first time I've found a happy medium, but it's
not for the inexperienced programmer. Some people complain about the barriers
to entry, but I'm somewhat glad they are there. Trying not to sound like a get
off my lawn guy or an elitist, but I'll say that learning a language and to
program in general is best first before trying to do things like networked
service i.e. web and mobile apps. I understand people sometimes need immediate
gratification and feedback, but it's also why we have so much trash just put
out there - it's so easy and people who don't really know how to program often
speak the loudest. Patience to learn and overcoming adversity are really
valuable skills for programmers. For as many steps we've taken forward, there
are so many back.

Clojurescript is a good compromise for me. The signal to noise ratio is a bit
better vs. other JS-related offerings for now. I don't feel like we should
always chase the lowest common denominator, and I wish people would stop the
TLDR approach to programming. To that end, I feel being responsive and
positive when interacting with new-comers to programming, and not trying to
proselytize <insert your favorite one true way> to everyone is a better
approach. Moreover, writing good documentation, organizing things cleanly, and
so on is valuable to helping people get off the ground easier. I think we've
reached a bit of an age where people want to fly the plane before learning
what flaps or a landing gear are. I'm all for helping people, just the right
way.

So from that point of view, I do somewhat disagree with part of the article's
implied premise of wanting to be friendly to non-programmers with regard to
Clojurescript. I've heard this promise so many times, from Visual Basic to
Smalltalk to Visual Development Environments to various Web Apps - let's just
do better with what we have and focus on taking some risks to replace the bad
stuff we're so attached to rather than trying to make everyone into a
programmer. Many better choices out there and I can't really see Clojurescript
itself as being too friendly to non-programmers. I'm also not a believer in
free lunches. But what do I know, I'm just another guy that learned the old
way with pencil and paper and believes in learning concepts more than syntax.

------
zimablue
This is really cool, I gave up on Clojurescript partly because the weight of
tooling combined with everything being bleeding edge when I didn't even
understand Javascript tooling buried me at the time.

~~~
yogthos
The tooling is actually much simpler than equivalent Js setups from what I've
seen. All you need is a copy of the JVM and Leiningen installed. Then you can
make a new project simply by running:

    
    
        lein new reagent-frontend myapp
    

You can start it up by running

    
    
        lein figwheel
    

You now have your app running at localhost:3449 and you can open it in the
browser.

You can now edit any source in the src folder and see changes reflected live
in the browser without having to reload the page.

------
abrax3141
BioBike (originally BioLingua & BioLisp) has had a full CL, incrementally
compiled, cloud IDE since ~2002. It was also pre-loaded with tons of
bioinformatics software and data, statistical software, and a theorem prover.
The concept was for biologists to use it. Some did. [Edit: And it had a
precursor to clojurescript, called lispscript, due to Peter Seibel.]

------
kenshi
Nice. Have been meaning to play around with ClojureScript but the tooling has
always put me off.

~~~
jeremiep
What's wrong with the tooling?

My current CLJS setup is boot with boot-cljs, boot-reload and boot-cljs-repl.
They're configured using normal Clojure code in a build.boot file and the
entry points are configured in live-reloadable *.edn files.

That setup is simpler and far more powerful than anything else I've seen in
other languages.

I was using leiningen previously but boot proved to be more powerful for less
work in my case.

[https://github.com/boot-clj/boot](https://github.com/boot-clj/boot)

[https://github.com/boot-clj/boot-cljs](https://github.com/boot-clj/boot-cljs)

[https://github.com/adzerk-oss/boot-reload](https://github.com/adzerk-
oss/boot-reload)

[https://github.com/adzerk-oss/boot-cljs-repl](https://github.com/adzerk-
oss/boot-cljs-repl)

~~~
WillPostForFood
What are you using to edit? I don't think the any one piece of the tooling for
Clojure or ClojureScript is a problem, but getting it all going together for
people who aren't familiar with the ecosystem and terminology (possibly
including Java, Lisp, Emacs, functional programming, and Clojure itself) can
be an obstacle. Even by your choice of boot over lein, means a majority of
beginner tutorials are going to have a gap because they tend to focus on
Leiningen.

~~~
yogthos
I highly recommend using Cursive [https://cursive-ide.com/](https://cursive-
ide.com/) for editing. It's an excellent IDE with lots of great features. For
as simple editor Atom is a good choice as well
[http://yogthos.net/posts/2016-10-15-AtomWithLuminus.html](http://yogthos.net/posts/2016-10-15-AtomWithLuminus.html)

I maintain Luminus
[http://www.luminusweb.net/docs](http://www.luminusweb.net/docs) specifically
to make it easier for people to get started. For example, if you wanted to
make a new web app with Clojure you could do:

    
    
        lein new luminus myapp
        cd myapp
        lein run
    

That's all there is to it.

I would recommend using Leiningen, just because it is more popular. If you're
starting out, then you don't really need to change that much stuff in the
project file aside from adding dependencies.

~~~
WillPostForFood
But to my point about friction in Clojure tooling, you can't just download
Cursive, run it, and try Clojure. You have to download and install Java,
Leiningen, IntelliJ, get a Cursive license, then install the Cursive plug in,
create a project configure a REPL (local or remote?). None of that is a big
problem, but cumulatively, all these little points of friction deter
beginners.

And thank you for your work in the community. Luminus is great, and I
Macchiato looks really nice as well.

~~~
yogthos
Thanks, always good to hear these things are useful.

As I pointed out in the original comment, you don't really have to use Cursive
if you're starting out. Cursive is great for working on serious projects, but
it's certainly not a requirement for trying Clojure.

Aside from Atom, you also have Light Table, VS Code, Vim, Emacs, and Eclipse.
Chances are a lot of people would be using at least one of these tools. As far
as having to download the JVM and Leiningen, it's not really different than
what you'd have to do for Python, Ruby, or Node.js.

So, I don't think the situation for Clojure is really any worse than most
languages. That said, I think that Nightcoders could remove any friction in
starting with the language.

~~~
WillPostForFood
I think it is a little harder to set up (compare to Ruby and Python, which are
preinstalled on Macs), plus throw in the functional concepts,Lisp syntax, and
Java errors. Together it makes for a bunch of small initial pain points that I
am certain causes some people to drop out, which is frustrating because
Clojure is awesome. DrRacket might be a good comparison for a more similar
language with an easier initial ramp up.

------
zubairq
This is great. I built something similar over the last two years, but I
pivoted to something else, as it is a hard problem to build a cloud IDE

------
pcr0
I can't run the IDE.

After signing in to my Google account, the popup disappears and nothing
happens.

I seem to get this in my browser console everytime I load the page:

Uncaught DOMException: Failed to read the 'sessionStorage' property from
'Window': Access is denied for this document.

I tried disabling adblock as well.

------
EamonnMR
I got an out of memory error when I tried this out-if the author is following
along, they can apparently find the error log at:

/home/sekao/nightcodersdeploy/data/308/317/hs_err_pid25822.log

~~~
gw
Yeah the server's a bit bombarded right now, I'll have to upgrade the memory
when I get a chance.

------
joeevans1000
Looks really cool! Any chance you'll let us sign up at some point with an
email and password, or username and password, and not google?

