This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-26
Channels
- # babashka (5)
- # beginners (21)
- # cider (26)
- # clojure (46)
- # clojure-art (3)
- # clojure-dev (36)
- # clojure-europe (24)
- # clojure-norway (64)
- # conjure (28)
- # cursive (2)
- # datomic (1)
- # honeysql (12)
- # improve-getting-started (5)
- # introduce-yourself (5)
- # kaocha (1)
- # malli (17)
- # polylith (36)
- # reitit (3)
- # shadow-cljs (8)
Is it important to understand Java and its ecosystem before one can write Clojure applications? I wanted to know this before I hop on a journey to learn Clojure. Thank you
You need to have some grasp of dependencies and classpath for running code and building projects, which are JVM ecosystem concepts. But you can get a long way without understanding Java (the language).
"Is it important to understand Java and its ecosystem before one can write Clojure"
Nah, go for it. Just remember the Java libs are there if needed, and to run screaming to SO or https://clojure.org/reference/java_interop when you, soon enough, bump into "interop". And you can delay that a lot because a lot of Java libs have been wrapped by Clojurians.
Speaking of interop, if an #object
lands in your lap this will help dig into it: https://github.com/clojure/java.data
ps. Word up on the classpath thing, but that is straightforward.
> important to understand Java and its ecosystem it doesn't hurt, but unless you're doing something really advanced (or very performance-oriented) you can go very long ways without needing to interop with java
I knew nothing of Java when I started writing Clojure. And I would say, as long as you are able to read Java Docs you will be just fine getting started. Experience with any language using C-like syntax, even JavaScript should go a long way on that front. You will figure out if and where to go deeper into Java along the way.
Definitely just go for it! I came into Clojure from Python with no JVM-ecosystem experience. You can pick up what you need, when you need it. When it comes to interop with Java libraries, I find that their API docs tend to be sufficient to figure out what you need, without needing to know any actual Java.
Apart from https://practical.li/clojure/clojure-cli/install/java.html (via JDK or SDK) then the rest of the Java platform can be ignored. Although there are some useful function calls to the Java language API, they are not essential for most situations (it depends what kind of app is being written and if any Java libraries are useful - many common Java libraries used in Clojure have Clojure wrapper libraries to abstract away the Java). Clojure CLI uses Maven and Git dependencies. Most dependencies come from http://Clojars.org and some will come from Maven Central which is used by man JVM languages. I think the only time I use Maven Central is to look up the latest version of the Postgresql JDBC library. If deploying to production, it may be useful to know a few java optimisations especially in memory constrained environments, although the Java Virtual Machine that runs the Clojure code is highly adaptive and self-optimising in most situations. If doing very high performance or low latency apps there may be some performance analysis and tweaking of the JVM, but there are some great Clojure talks on that aspect if required. As there are so many languages on the Java Virtual Machine, there are lots of ways to help in the more niche cases. Many Clojurians have come from a Java background so there is plenty of advice available in this slack community if required.
maybe this is a silly question, but when people use html generation like with hiccup, do they care about formatting the html? So if you view source in the browser it's not all on one line? And if so what do they commonly do? I read that this functionality was removed at one point for performance reasons
My first thought was "web inspector", which is similar to the chain of conversation here - https://github.com/weavejester/hiccup/issues/65 - going back a decade - links to a simple solution of piping it to this: https://github.com/px0/clj-beautify-web
@U049G64P8LE Asked similar question yesterday: https://clojurians.slack.com/archives/C053AK3F9/p1669372014340469
If your plan is to view it in the browser, Developer Tools is much more powerful than View Source. Press F12 in Firefox or any Chromium-based browser to open Dev Tools, The first tab shows a collapsible tree of DOM nodes, and you get lots of other tools for inspecting your webpage and its behavior.
should i use keywords or symbols for dict keys? looking at examples i see that keywords are overwhelmingly used for this purpose what are the differences between symbols and keywords and why are keywords preferred by the community