Fork me on GitHub
#beginners
<
2015-06-15
>
grounded_sage02:06:45

I'm currently picking up JavaScript to use Meteor to build my startup. Though I am also learning a bit of Clojure/Script where I can to improve my programming and possibly use it where I can or where I have to build my own service then perhaps link it up by using a Microservices architecture. I'm wondering whether there is really much need for me to learn Java to make use of the Java libraries in Clojure. Or would it be best to just focus on ClojureScript purely. Node seems to be incredibly popular meaning more libraries will grow and mature, there will be more and more speed optimisations, on top of that there is a lot more places I can run my code when I can target Node. The only real benefit I see with the JVM is multithreading. Can anyone comment to this?

sveri05:06:07

@grounded_sage disclaimer, I never used Node myself. 1. Where can I run node, where the JVM cannot run? 2. All the libraries that are growing in the node ecosystem are most probably already there in the JVM ecosystem (talking about 20 years versus 5). 3. No matter how much speed optimisations you make within node, it still will be slower than programs on the JVM in most of the cases. Not even talking of multithreading here. Tbh. I never understood the hype around node. The only advantage that I see is that I can write backend code, even if I only know JavaScript, so there is no need to learn a new language for some. So, yes it is OK to stick with with cljs only, if you can live with the limits of node. But if you want a fast, multithreaded and mature ecosystem, choose java...

sveri05:06:44

Or clojure ;-)

grounded_sage06:06:47

@sveri: Well I'm a designer and entrepreneur who is also interested in programming. So learning Java isn't something I am interested in unless there is significant benefits for learning another whole new language, runtime and clojure interoperability. I get that there would already be libraries already existing on the JVM but with the big push from business on Node I would say the libraries and speed will be good enough and eventually reach a point it would eclipse JVM outside of the whole multithreading thing (which I still don't fully get). The popularity is exactly what you said you can use basically the same language. Which is one of the key benefits of Clojure/Script aside from immutability etc. partly the reason why I am here. Looking to do as much as I can without having to become a full time multilingual computer science student. :p If I really need to use JVM At least ClojureScript will make it so I am somewhat familiar.

sveri07:06:07

OK, that makes sense, use the language that you know, are familiar with. BTW, not sure if you are aware of that, clojurescript compiles to JavaScript and clojure to bytecode running on the JVM. If the performance of node is enough to fit your project, is something only you can judge, which is perfectly fine. Still, that node can outperform the JVM most of the times is something I want to see proven, until then, I don't take that argument :-D

grounded_sage07:06:44

@sveri: yea that's the conclusion I am drawing. I'm interested in the ClojureScript in ClojureScript compiler and whether that would allow me to build with Meteor in ClojureScript.. Would make for fast development. The way I see it if I hit roadblocks I'll just jump over to Clojure instead of learning Go like a lot of other Node people seem to do for performance. Etc

thomasdeutsch15:06:48

Hi everyone. when i use clj->js on a clojure map like {:myns/test "test"} it will return a js-object without the namespace: {:test "test"} how can i prevent this behavior? on the other hand, can i tell the reverse function js->clj to add a namespace to every prop?

rauh16:06:15

It'll always use name so will remove the namespace. You can implement IEncodeJS for Keyword type though and do your own de- and encoding

shaun-mahood21:06:41

I'm having some trouble figuring out how to combine routes in compojure. I want to have my base "/some-core-page" routes defined in core.routes, and "/some-context-page" routes defined in context.routes, and tying everything together using the 'routes' macro in my main app handler. Can't seem to get it working properly and I'm pretty sure I'm doing something dumb. Does anyone have any good links that explain how to combine routes using different namespaces, in more detail than the compojure wiki?

markstang21:06:46

@shaun-mahood: Which server are you using?

shaun-mahood21:06:52

Oh sorry, using lein ring right now, just trying to figure it out in dev

markstang21:06:44

What does your handler look like?

markstang21:06:45

@shaun-mahood: Yeah, like what he said...

shaun-mahood21:06:28

(def app
  (-> (routes other-routes core-routes)
      (handler/site)))

shaun-mahood21:06:54

I can get to everything from my core-routes namespace, but nothing from the other-routes namespace

shaun-mahood21:06:35

It works if I move everything into the same base namespace, so I'm guessing I'm doing something wrong with the namespaces rather than the routes, I'll try and narrow it down from there. Thanks.

markstang21:06:04

they have to be ns qualified

shaun-mahood21:06:41

Yeah I've done that, must be somewhere else I'm going wrong

markstang21:06:48

try doing something wrong 😉

shaun-mahood21:06:01

I'm good at that!

yusup21:06:57

Hi, what is the correct way to add jmx options to a lein project?

yusup21:06:58

I tried a many but none of them is working.

yusup21:06:30

I am trying to profile remote server.

markstang21:06:01

@shaun-mahood: When I have had issues in the past I assumed it was my ClojureScript, it might be the pages themselves or the functions (other-routes). My point is you may have the routing correct...

shaun-mahood21:06:57

@markstang: I found the problem - I was missing a set of brackets in one of my route definitions and just didn't see it. Always a stupid mistake... thanks for the help.

markstang22:06:54

I am sure there was an error you missed 😉

bcobb22:06:59

Are there any beginner-Clojurian/new-to-the-JVM guides on logging?

bcobb22:06:08

I feel like I have a hazy idea as to how slf4j/logback/log4j fit together, but something to condense it all would be super helpful (bonus points for what it means for people using Clojure)

meow23:06:10

bcobb: Not sure if this will help but you might want to take a look at it: https://github.com/ptaoussanis/timbre

bcobb23:06:49

@meow: looks like a nice library, thanks for passing it along -- https://github.com/palletops/log-config has some stuff that looks interesting and relevant, too

meow23:06:57

@bcobb: cool, thanks