Hacker News new | ask | show | jobs
by tombert 1902 days ago
> However, it also makes me wonder if this advantage for writing code might later on turn into a shortcoming for reading, i.e., understanding code - either someone else's or your own code six months later.

I understand your concern, if you're used to old-style PHP or Perl, which many people say is "write-only", because it's incredibly fast to create code, but a nightmare to maintain it.

That said, I think Clojure is a bit difference, since the entirety of the language is designed to make it easier to actually make abstractions. It's trivial to break things into smaller functions and compose them, it's easier to compose stream-based computations, and it's even not too hard to do a fairly compositional concurrent system once you've gotten used to core.async.

Very often when I write Clojure, I do a "quick and dirty" version of whatever I'm trying to do (giant functions, everything in one file, single-letter variable names, etc), just to get something working, and yet I still find it fairly straightforward to read, and also fairly straightforward to make non-gross later when I have more time. Most of the time refactoring really is as simple as "cut and paste".

EDIT, Cont'd:

There are definitely exceptions to this. Occasionally people new to the language will find out about macros and try and build a bunch of custom constructs that are incredibly hard to debug. There's definitely an art to figuring out the best time to use a macro (one that I still haven't mastered, if I'm being honest), because abusing that feature definitely can lead to problems of maintainability.