Fork me on GitHub
#clojure-uk
<
2017-06-28
>
thomas07:06:06

morning 😼 mogge

agile_geek07:06:53

On the subject of do's and don'ts for Clojure, I'd really like to see more material describing (and forgive me for using this term as short hand) "best practices". Specifically, I see huge variation in the way Clojure is structured in the micro and the macro. One of the huge advantages with Clojure is the speed with which it can be used to explore a problem. However, I believe we pay the price in the fact that the characteristics that make Clojure a powerful exploratory/new development tool (dynamic typing, terseness, meta programming) also tend to lead to a lot of variation in the way code is structured and the cues we use to scan code (especially determining what inputs and outputs look like). As we tend to spend approximately 80% of our time reading and understanding code we should really spend more time optimizing for maintenance. This is also why I take the deeply unpopular view that Frameworks are not evil and certainly give that consistency. Spring and Rails have their issues but you can get an awful lot of sh*t done with them over a long period of time once you learn the idioms. We should spend more time giving higher level idioms for how to structure Clojure and, even more so, Clojurescript. To that effect, I'd like to see more material like "Clojure Applied". Phew, that's a lot to type on my phone!

agile_geek07:06:33

@thomas it's a good investment IMO

thomas07:06:11

I'll put it on my list of things to read

thomas07:06:03

just realiser that Carin Meier is this week in Rotterdam for Joy of Coding... and I should have gotten a copy of living Clojure for her to sign!

glenjamin08:06:18

Dan North has some good thoughts on best practices

glenjamin08:06:35

in short s/best practice/in context X, Y worked well for me/

dominicm09:06:21

Morning 🙂

yogidevbear09:06:01

Good to see Clojure Applied being mentioned here. I was literally looking at it yesterday after reading another thread on books for Clojure newbies and thought it looks like a good companion to Living Clojure which I got for Christmas

yogidevbear09:06:35

Will definitely add it to the top of my "must buy this book next" list

yogidevbear09:06:00

@seancorfield shared this on another slack group I'm on and I thought it made some interesting points so re-sharing here 🙂 https://blog.bradfieldcs.com/in-2017-learn-every-language-59b11f68eee

dominicm09:06:38

That article took an improving slant 🙂

thomas09:06:04

I like it... but I have only three problems. Time, time and time.

dominicm09:06:06

Although, coming in a C → Python → Clojure direction, I feel like that has captured most paradigms. Particularly as Clojure has good OO, and I've been able to use Datalog a lot (declarative). Though I'd like to do more declarative.

mccraigmccraig09:06:21

type-classes as a macro - my current fave example of the sort of new stuff you can do when you mix up some of those paradigms in new ways (in this case - syntactic abstraction of lisps, functional abstraction, static typing) - https://github.com/LuxLang/lux/blob/master/stdlib/source/lux/type/auto.lux#L308

glenjamin09:06:49

A language that captures side effects in the type system is worth learning too I’d say

otfrom09:06:15

@agile_geek in some ways I think clojure is a framework (as far as lisps go) in that if you so things that look like seqs and maps then everything works really well. Stray from that and you end up building a lot yourself.

maleghast11:06:46

Hello everyone... Anyone in the vague vicinity of Chancery Lane -> Liverpool Street and fancy getting lunch?

thomas11:06:08

@maleghast how long did it take you to get to London form "up north"?

maleghast11:06:18

The usual amount of time (1hr 15min flight), sadly we took off a little over 3 hours late, so I could only get to my accommodation in a reasonable timeframe by hopping in an Über

maleghast11:06:43

Got to where I was staying at around 0300h

maleghast11:06:48

Still good trip, all things considered and I am off to Stanstead later - should be home at around 2200h as long as there are no delays.

thomas11:06:07

ok, that doesn't sound to bad actually. but lots of flying I guess.

seancorfield15:06:25

@thomas I think a lot of people assume learning other languages takes more time than it actually does -- have you tried the Seven Languages in Seven Weeks books? I found I could work through those, an hour or two a night while watching 📺 with my wife. Took longer than seven weeks but it wasn't a huge burden.

seancorfield15:06:57

Although I will say Io totally kicked my butt 😐

seancorfield15:06:42

And they pick a really good spread of paradigms across the two books. Four months of an hour or two here and there and that's thirteen languages covering nearly all the main types of languages! Clojure crops up twice (once for the language itself, and again for mini-Kanren).

yogidevbear15:06:07

I like that they do "uncourses" for minikanren via hangouts and post the links afterwards. This is a really neat approach https://www.youtube.com/playlist?list=PLO4TbomOdn2cks2n5PvifialL8kQwt0aW

maleghast15:06:00

@thomas - Hi (been getting to the airport)... Yeah, it's a lot of flying, but barring emergencies I'm only doing the trip one more time before the end of the summer, so it's not so bad... 🙂

peterwestmacott16:06:48

I think that the more languages you learn, the easier it is to learn more languages.

mccraigmccraig16:06:48

and some languages have an outsized effect on your future language comprehension abilities, so you should deliberately pick those languages to learn

seancorfield16:06:58

@mccraigmccraig Definitely! I tend to advise folks learn a handful of “really different” languages first, even if they never program in them later. I always used to suggest APL, Haskell, and Prolog. But APL has become harder and harder to actually practice (given all the symbols) and I think J just looks like line noise so I’m not sure what to recommend there.

yogidevbear16:06:10

seancorfield: It might be time for me to "dust off" my copy of 7 in 7

yogidevbear16:06:04

But as Thomas says, it's a matter of finding time. I've got that talk I've volunteered myself for which is a Clojure learning experience, and I've got some moonlighting I need to do inbetween which "complicates" my evening schedule

seancorfield16:06:55

But at least you’re on the path… and the conference talk will ensure you learn enough Clojure to be dangerous 🙂

yogidevbear17:06:01

That's my hope anyway simple_smile

seancorfield16:06:42

Also, a Lisp of some flavor (so many to choose from — but I’d definitely recommend Clojure these days).

mattford16:06:31

hey hey! 🙂

mattford16:06:39

What’s this doing (potemkin/import-vars [clj-ssh.ssh connected? connect disconnect]) above and beyond what :refer would do?

mattford16:06:03

Is :refer even equivalent? Kinda looks like it to me…

maleghast16:06:09

This is why I am (slowly) learning Elixir alongside attempting to ascend to "competent" with Clojure 😉

mccraigmccraig16:06:28

@mattford the imported vars will appear def'd in the namespace, so referenceable from other ns ... a :refer makes the name usable within the namespace but not referenceable from elsewhere

mattford16:06:07

ah excellent explanation thanks

seancorfield16:06:44

Warning: Potemkin does “magic” and can cause all sorts of compatibility problems with some other libraries 🙂

mccraigmccraig16:06:21

oh - i haven't had any of those problems - i've found potemkin to be quite useful for structuring apis

mccraigmccraig16:06:32

what are the compatibility probs it causes ?

seancorfield18:06:56

@mccraigmccraig I don’t recall specifics — just that I’ve seen several people warn others off using it (and I have run into problems with Potemkin when it’s been pulled in as a transitive dependency… I think I just solved it by switching to a library that didn’t use Potemkin).

seancorfield18:06:27

That said, we’re using clj-http 3.4.1 and that pulls in Potemkin 0.4.3 and we’re OK at the moment…

mccraigmccraig19:06:14

us too - we're using aleph and a few other libs which pull in potemkin 0.4.3, and our stuff uses it in a few places - i've not seen any problems

mccraigmccraig20:06:29

creates a new var with the same content and a copy of the metadata of the original var... plus a watch on the original var so that changes are reflected to the new var

mccraigmccraig20:06:44

tho i guess you could have problems if you are depending on atomicity of alter-var-root or alter-meta!