Live data from Hacker News

How much can a Clojure developer do alone?

yyhh.org

71–80 of 106 posts

Re: How much can a Clojure developer do alone?

#71
post #23
post #7

The description here of using the Clojure REPL for development is one of the best I've seen. I think part of the issue is nomenclature -- Read Eval Print Loop applies to lots of systems in lots of languages that many devs are familiar with that are not really what Clojure devs mean when they say "REPL." The actual experience is closer to something like Smalltalk where you alter a running system and experiment with it…

I guess I need to watch some of the videos he links, because this sounds horrible to me. I mostly work in Python, which has a repl (though I'm sure not as complete) and sometimes I poke around in it. But if I am working on a real project, or even just a small script, I always want to run it from the beginning on every invocation, because anything short of that is not proof that it works. "Editing a running system" so…

I see REPL driven development more akin to writing music. I pick up the guitar and start playing. I can work on a small fragment and improve it until it sounds good to me. Or I can play the whole song. At all times I have instant feedback and I can hear what I'm working on.

In the case of the REPL you are playing your program. You can play a file, a function, or half of a function. Until it sounds right.

I lack the skill to use music notation for composition, so I rely on my instrument to give me feedback. And I lack the skill to execute the program in my head before I press compile, that's why I rely on the REPL.

Re: How much can a Clojure developer do alone?

#72

Earlier quoted context omitted.

> [1] Why aren't we all writing in APL/K/J if it matters that much? Because most programmers aren't nearly as productive as we could be. And because "concise" should be measure in the number of tokens needed to achieve certain functionality, not by excessive use of single character tokens.

I wonder if there’s a sweet spot for verbosity or if it doesn’t really correlate with bugs or productivity. I end up thinking about this pretty regularly. For example Kdb/q has always fascinated me, my initial reaction was that encoding meaning into fewer symbols surely causes cognitive overload and promotes programmer failure, and yet i saw some python code written by a quant converted to q by a kdb developer. The o…

This has been my experience as well. 10x factor reduction in LOCs and increase in performance when moving to kdb/q

Re: How much can a Clojure developer do alone?

#73
post #3

Great article. Even in a large enterprise, where the prevailing organizational ideology centers around building the largest headcount you can for political sway... I've kept my team small on purpose, and we were able to be very effective by adopting clojure. We have sway because we deliver- and that's a different type of leverage than headcount. We don't get thrown every hot potato, instead we're consistently aligned…

This totally makes sense in a startup context, but how does this work in a large enterprise? For instance, who signs off on "critical portfolios" being migrated to clojure, and who maintains these pieces when your team moves onto the next project?

Re: How much can a Clojure developer do alone?

#74

Earlier quoted context omitted.

>And because "concise" should be measure in the number of tokens needed to achieve certain functionality, not by excessive use of single character tokens. I am totally nitpicking here, but as a longtime Clojure programmer, I do have a bit of APL envy. Aaron Hsu (noted APL guy) made the point that brevity (in the linear, #-of-characters sense) let's you decrease complexity by avoiding indirection---when the body of a…

You may be interested in April[0], a version of APL embedded in Common Lisp so that it can be called as part of a CL program. Also, my own language BQN[1] is a rework of APL that comes much closer to Lisp in that it has first-class functions and closures. It's self-hosted (using a compiler that follows Aaron's strategy), allowing it to be embedded in other languages with relatively little effort, but currently poor p…

Wow, this is totally cool, thank you!

Re: How much can a Clojure developer do alone?

#75
post #23
post #7

The description here of using the Clojure REPL for development is one of the best I've seen. I think part of the issue is nomenclature -- Read Eval Print Loop applies to lots of systems in lots of languages that many devs are familiar with that are not really what Clojure devs mean when they say "REPL." The actual experience is closer to something like Smalltalk where you alter a running system and experiment with it…

I guess I need to watch some of the videos he links, because this sounds horrible to me. I mostly work in Python, which has a repl (though I'm sure not as complete) and sometimes I poke around in it. But if I am working on a real project, or even just a small script, I always want to run it from the beginning on every invocation, because anything short of that is not proof that it works. "Editing a running system" so…

> "Editing a running system" sounds like a nightmare! How could you ever know things would actually work?!

This is why Clojure developers love immutable data and pure functions so much. Say I am writing a web frontend for managing a list of users, and I want to implement some kind of filter and grouping flow on them for some business reason. Since I know the users are immutable, I know that when I am evaluating code in the browser to test out exactly what filter logic is correct I am not actually changing anything about the system.

Re: How much can a Clojure developer do alone?

#76
post #16

Earlier quoted context omitted.

I haven’t written any Clojure for a few years now. So my knowledge and technique is out of date, but I have a contrary opinion on “repl driven” development vs many Clojure advocates. In short: your repl compiled code is state that you now have to track in your head. Yeah, great, you can compile a single function and it hot loads. It’s pretty awesome for experimenting and debug, but the longer your repl session is ope…

If you write your code the correct way, there wouldn't be any states in your namespaces for you to keep track in your head. That only happens if your code is full of `(def some-state (atom {}))` or something like that. You are basically illustrating my point about "You probably cannot learn Clojure all by yourself". You need a mentor to show you how to do Clojure correctly, or you have the humility to learn the prope…

Function definitions and vars are a form of state that can accumulate in a REPL session. Its not just atoms.

This can lead to issues where you decide to refactor and rename a var (Clojure is all about concise and expressive names, so its not uncommon to do this.. At least not for me) but you might not catch every place the old var name is being used. Because both vars are still exist in the state of your REPL, everything seems to work, but once you compile your uberjar or whatever, things are broken.

A REPL isn't a replacement for good unit tests, and there are techniques for reloading your REPL state on save, but the issue of needing to keep the "REPL state in your head" is real, and not an artifact of doing things wrong. Just something that the developer needs to be aware of as a potential hiccup in the REPL experience.

Re: How much can a Clojure developer do alone?

#77

Earlier quoted context omitted.

Interesting mix :) I wonder why CLJS / Reagent is not enough, and where the others step in... I mean in my fantasy CLJS / Lisp is so powerful one never looks back to languages relying on commas and colons

Clojure uses colons for :keywords, and commas for unquote.

commas are whitespace in clojure

Re: How much can a Clojure developer do alone?

#78
post #35

Earlier quoted context omitted.

F# is a cleaner example of putting data first.

Does F# not put types first and data second? Would it be idiomatic to do clojure style maps where the map keys end up being treated like pure functions that return a value.

>Does F# not put types first and data second?

The F# and ML view of the world is, roughly, that data and types are not separable in any way that's useful. Types are just how programmers make sense of data, and they exist in every language. The difference is whether or not the compiler will use them to help you make sense of your data as well, or whether you have to do your own manual type-checking.

As for programming with maps the way it's done in Clojure, I would say generally no, that's not idiomatic F#, and it's a big blind spot for F#. OCaml has row polymorphic records, which would be a better fit for the treat-everything-as-a-map style of programming in a static language.

Re: How much can a Clojure developer do alone?

#79

Because Clojure is not terribly fashionable, I imagine the developer pool is much smaller but the candidates are higher quality, mostly due to self-selecting. I really like the sentiment of empowering individual developers to the max. It's funny, a lot of organizations want to beat the averages whilst engineering in an identical fashion to their competitors. You're not going to consistently get outstanding results if…

> I imagine the developer pool is much smaller but the candidates are higher quality People always say this about their favorite niche language and it always feels a little too self serving with little evidence to back it up. Learning languages is relatively simple and enjoyable, especially when the overwhelming majority of those people never end up working on difficult problems in said language. I think it often giv…

>Learning languages is relatively simple and enjoyable, especially when the overwhelming majority of those people never end up working on difficult problems in said language.

Learning languages is not simple and enjoyable for everyone, especially not when they're languages with a radically different paradigm. I will definitely look twice at a JavaScript programmer who says they're also interested in ATS and Forth, for example. It should be fairly straightforward to suss out a rough level of understanding, and beyond whether or not learning languages is easy, it's a fairly strong signal of intrinsic interest, which a lot of employers want from their employees.

Re: How much can a Clojure developer do alone?

#80

Earlier quoted context omitted.

I haven’t written any Clojure for a few years now. So my knowledge and technique is out of date, but I have a contrary opinion on “repl driven” development vs many Clojure advocates. In short: your repl compiled code is state that you now have to track in your head. Yeah, great, you can compile a single function and it hot loads. It’s pretty awesome for experimenting and debug, but the longer your repl session is ope…

To me, that's similar to waiting to save your Word document until you have finished editing your document. REPL should be used for rapid experimentation, but then the code should be transferred to a source file and saved before moving on to the next thing.

When doing REPL dev with clojure, I usually never type directly in the REPL, it's connected my editor and there are shortcuts for evaluating forms already typed in there (e.g. form under cursor, form before cursor, outer most form, entire file) and it outputs the results right after the form (as a temporary display or can even be output the text into the file).

There's also the handy "comment" function that lets you do something like (comment (+ 1 1)) in your code file that won't get compiled but keeps all the editing benefits (syntax highlight, structural editing) that you wouldn't get if an expression was commented out using comment syntax.

Post reply on HN