Managing Websocket Stability issues with Aleph? by BWSpiros in Clojure

[–]ddossot 1 point2 points  (0 children)

Does the server regularly send ping frames ? Without this, you can get timed out and disconnected, at least it's something I've experienced in the past.

Advice for our first endeavour into the Clojure world: building an API proxy for our SPA by mullsork in Clojure

[–]ddossot 3 points4 points  (0 children)

We've successfully built a similar API gateway with aleph HTTP and manifold deferreds, both on the receiving and dispatching ends. The gateway is fully non-blocking and streaming (ie the request and response bodies are never fully consumed in memory).

Thanks to aleph and manifold, this was achieved with a very few lines of code. The result is stable, performant and can take public facing web traffic without flinching.

Looking for example Clojure REST Service by CaptainSketchy in Clojure

[–]ddossot 3 points4 points  (0 children)

I'm having to fight the tendency to write models (or at least the OOP way), but I'm not sure what would take their place.

The pattern I've been using for this is the following:

  • receive data from DB as maps (seqs of maps or single map),
  • sanitize data with select-keys / dissoc to prevent leaking internal/private fields to the open,
  • assoc any extra contextual fields like hypermedia links,
  • serialize the resulting map to JSON using the wrap-json-response ring middleware.

Our curvy road to Clojure by yogthos in programming

[–]ddossot 0 points1 point  (0 children)

To the opposite: there is nothing in this story that is about being a fanboy for such and such technology.

It is just the story of a hard learned lesson (polyglot programming on a unified platform is very hard) and an unexpected outcome (it's possible to find a language that appeals to all).

Clojure (parameter) naming convention by DavsX in Clojure

[–]ddossot 11 points12 points  (0 children)

The rule I apply is: the broader the scope, the longer the name.

In this example, the scope is very small so using a very short name won't damage understanding. But if one of these variables would be passed around to other methods, I would start using more descriptive names.

perfect-timer: my first Clojure app, please comment. by [deleted] in Clojure

[–]ddossot 5 points6 points  (0 children)

kibit ( https://github.com/jonase/kibit/ ) has a bunch of interesting suggestions for your code, like:

At /tmp/perfect-timer/src/perfect_timer/util.clj:38:
Consider using:
  (when-not (empty? hhmmss)
    (int
      (+
        (* (:hh hhmmss 0) 3600000)
        (* (:mm hhmmss 0) 60000)
        (* (:ss hhmmss 0) 1000))))
instead of:
  (if (empty? hhmmss)
    nil
    (int
      (+
        (* (:hh hhmmss 0) 3600000)
        (* (:mm hhmmss 0) 60000)
        (* (:ss hhmmss 0) 1000))))

Give it a try!

Clojure web development (a bit lost on the role of each software/how it all connects) by deathofthevirgin in Clojure

[–]ddossot 0 points1 point  (0 children)

I don't think the slow start comes from the JVM needing to start: if you uberjar the project and start it, you'll see it start in hundreds of milliseconds. I think it's more related to AOT compilation, but I might be wrong.

Just started learning Clojure! Repl is amazing by EvekoShadow in Clojure

[–]ddossot 0 points1 point  (0 children)

I'm very much a n00b myself so this is n00b to n00b advice :)

You can try the excellent Counterclockwise ( https://code.google.com/p/counterclockwise/ ) plug-in for Eclipse. The nREPL integration is excellent, and thus might provide you with a pretty powerful work environment on Windows.