Fork me on GitHub
#clojure-uk
<
2016-08-01
>
agile_geek06:08:08

Morning. Sitting on train with table to myself this morning. Working on a website for my company and putting finishing touches to SOW I wrote on Friday before I send it out this morning.

paulspencerwilliams07:08:38

I’m playing with CircleCi today. Evaluating it for our iOS builds. We’re generally a little obsessed with keeping things in house like maintaining various Jenkins workers etc when we could be lazy and farm it out. Then we could spend more time ‘adding value’ rather than god damn yak shaving.

agile_geek07:08:16

@paulspencerwilliams: I've used CircleCI for my pet projects for almost two years now. I like it better than Travis. Not done any seriously large or complex build pipelines though.

otfrom08:08:48

trying things out from erc. Biggest drawback is lack of history

otfrom08:08:51

but I can always go to the website for that

gjnoonan08:08:07

We've been using GitlabCI for a few months, I like it

thomas08:08:38

We now have a travis server internally… so far so good. but haven’t it used it extensively yet.

otfrom08:08:03

we're using circleci for our stuff. I presume it works with gitlab (if/when we migrate)

dominicm08:08:53

may not, iirc

glenjamin09:08:36

using circle at work at the mo, had no real problems with it. Used travis heavily for OSS stuff, mostly works well also

glenjamin09:08:08

main thing you’re lacking vs jenkins is being able to wire lots of disparate jobs together with complicated rules

glenjamin09:08:13

which could be a plus point

agile_geek09:08:18

Of course if you need/want to 'grow your own' CI you could look at http://www.lambda.cd/

otfrom09:08:15

agile_geek: feels like you could put other types of flows together with that. I wonder at what point it would start to be annoying that the domain was CI/CD rather than some other job DAG

xlevus09:08:24

:O lambdacd looks tits

agile_geek09:08:09

@otfrom I had similar thoughts

otfrom09:08:04

that's annoying. It looks like slack edits don't come through on the irc interface. :-\

glenjamin10:08:50

xlevus: is that positive or negative?

agile_geek10:08:19

Always hard to tell with a comment like that 😄

xlevus10:08:30

The ol' Australian contextual derogative

korny10:08:35

I’m Australian and I was confused… was thinking “tits on a bull”...

korny10:08:28

#”m[ginor]+g"

korny10:08:44

re: asciidoc - the thing I’m currently loving, though it’s a bit hacky, is the diagram plugin. My docs have UML sequence diagrams embedded, in plain text, which show up as images in the final output. http://asciidoctor.org/docs/asciidoctor-diagram/

xlevus10:08:19

Maybe "tits" is a kiwi term

mccraigmccraig10:08:31

is it a short-form of a more obvious expression ?

dominicm10:08:56

@korny: Why do you think hacky?

korny10:08:24

@dominicm: it had some peculiar bugs for me with where images got written - I had to have it creating images in the source images directory, which then means they have to be explicitly ignored from my git commits.

korny10:08:20

That, and I’m always a bit conservative about plugins that involve shelling out to command-line apps - it does work, but it’s pretty loose integration. Not that I can immediatedly think of a better option 🙂

dominicm10:08:23

I've had success with it in that regard, but I'm not sure why it would be different. I've only used it for fairly simple diagrams, on linux. Everything works first time on Linux I find 😉

glenjamin10:08:27

I’ve used websequencediagrams a lot, and someone recently showed me a flow-chart version

glenjamin10:08:40

which I promptly forgot the name of, and failed to find again via google

korny10:08:54

I’ve used plantuml all over the place, it’s the main diagramming thing I use now in asciidoc as well

dominicm10:08:05

https://github.com/asciidocfx/AsciidocFX this implements it's own version of the uml diagram plugin, and it's plantuml is native java.

korny10:08:52

The asciidoctor plantuml integration pulls down a ruby gem that embeds the plantuml jar file, then shells out to java to run it.

korny10:08:42

That reminds me my other pain point with the diagramming stuff - when something goes wrong, you get no information - no logs, no diagnostics. For someone whose ruby is a little rusty, it was quite painful diagnosing what was broken.

korny10:08:10

Anyway, @otfrom wanted us to change the subject, so lets go back to talking about tits

dominicm10:08:01

@korny: In the ruby asciidoctor it does, it would be tricky to do something else though. It'd be nice to have cross-platform apis for every language for every tool. We don't have that yet though really 😕 AsciidocFX uses AsciidoctorJ, and my understanding is that because it runs in the JVM already, it depends on PlantUML dep, and calls into it for doing plantuml, instead of java->ruby->java

glenjamin10:08:15

which runs nicely in the browser, so the feedback look is pretty good

glenjamin10:08:10

the many ads on that page put me off a bit

korny10:08:12

@glenjamin: mermaid is one of the tools wrapped by the asciidoctor diagram plugin - it does look nice, be handy sometimes to generate gantt diagrams

glenjamin10:08:37

say what you like about the “we build our tools in JS” crowd, but they generally also know how to make a nice website 😄

korny10:08:39

I just run plantuml via the jar file for quick diagram growing - it works pretty well

dominicm10:08:11

@glenjamin: I adblock. I didn't even know it had ads.

otfrom10:08:30

korny: arrrrgh! ;-)

dominicm10:08:16

@glenjamin: I think it's quite interesting that libsass is being written in C so it can target nodejs and ruby.

dominicm10:08:26

I wonder if they have any plans for the browser too..

glenjamin10:08:47

i think originally it was just “to be fast”, and then someone in Node-land picked it up and people jumped on board

dominicm10:08:07

ah, perhaps purpose is wrong

dominicm10:08:12

but it's super useful for java too

dominicm10:08:23

I thought emscripten might jump in

glenjamin10:08:41

https://github.com/yogthos/lein-sass <- emscripten’d libsass running on nashorn wrapped in lein

otfrom12:08:39

so, catch Throwable or catch Exception?

agile_geek12:08:01

Depends on circumstances but always favour the specific - catch Exception.

agile_geek12:08:36

Generally an Error (the other throwable) is not something your app can sensibly handle anyway

korny12:08:13

I catch Throwable if I want to log and re-throw, otherwise Exception

agile_geek12:08:57

@korny: log and re-throw...oh we are going into anti-pattern territory there 😉 http://rolf-engelhard.de/2013/04/logging-anti-patterns-part-ii/

malcolmsparks12:08:19

Exception usually for me.

korny12:08:27

Oh yeah 🙂 We’re all about anti-patterns here!

korny13:08:16

However, when your code is a bit of callback called from somewhere inside someone else’s code, and you want that code to clean up resources appropriately, but don’t trust that code to log what really went wrong and where… then you sometimes have to log log log

agile_geek13:08:43

I thought we'd put these debates to bed in 2002? Generally speaking (and there are 'exceptions' to the rule...pardon the pun!). 1. Either throw onwards or deal with exception (not do something then re-throw) 2. Always catch the most specific exception that makes sense (i.e. it's ok to catch a more generic exception if all exceptions inheriting from that one are handled the same) 3. Log at point of handling 4. Don't swallow an exception and throw a new one (you lose the original stack trace)

otfrom13:08:52

agile_geek: you do know I've always been a rubbish Java coder

otfrom13:08:57

too much syntax

agile_geek13:08:05

Having spent months reviewing Java and dealing with massive unhelpful logs in an 'enterprise' Java app this stuff is a sore point with me!

otfrom13:08:31

I'm thinking ArithmeticError is the one I'd want to be able to handle (this is in an IoC bit where we are passing in funcs doing calcs on data)

agile_geek13:08:09

Oh I forgot one: 5. Kill anyone who does this

catch (Exception e) {
		LOGGER.error(e.getMessage());
}
I love seeing the text of an exception with absolutely no contextual information about where in the code it occurred!

otfrom13:08:59

that is evil, but what about divide by 0?

glenjamin13:08:06

if you’re rethrowing a new one, don’t forget about cause

otfrom13:08:14

I know the answer is to check it, but it isn't always going to get checked

agile_geek13:08:02

@otfrom: if your strategy for dealing with the Error is only applicable for ArithmeticError then catch that specifically.

agile_geek13:08:33

If it's more generic use the most specific Error/Exception you that makes sense.

agile_geek13:08:02

but I'd still go with try checking it first!

otfrom13:08:26

agile_geek: this is some code that will be wrapping code like that and I'd like to be able to catch things we miss in test and code reviews

otfrom13:08:49

(and at least log them w/the stack trace) so we can add the test/checks/etc

thomas13:08:42

just let the user deal with the errors… 😇

agile_geek13:08:18

@otfrom: as I said in that case. Deal with the most specific thing you can sensibly deal with.

korny13:08:26

@agile_geek: the other thing I’ve learned (the hard way) in clojure - if at all possible, don’t use exceptions. Better to return a value that indicates failure, than to throw an exception. YMMV of course

korny13:08:10

But in a world of laziness and macros and core.async, an explicit error return value is easy to deal with and reason about, whereas an exception can lead to madness.

otfrom13:08:44

korny: we know that way lies the Error Monad

otfrom13:08:13

(which makes me want to use clojure.spec)

mccraigmccraig13:08:07

is the error monad considered harmful ? not used it, but it seemed like a reasonable approach to dealing with exceptions

agile_geek13:08:15

I think clojure.spec is definitely one way to go.

otfrom13:08:39

mccraigmccraig: I actually think it is a really good idea, but I think it should be combined w/something like core.spec

korny13:08:56

Of course, in the absence of error monads, a well defined error return value is perfectly fine in my book, as long as you have good tests/contracts/schemas to make it explicit.

agile_geek13:08:54

My complete lack of understanding of Monads, despite trying to grok them at least 10 times, let's me down in this conversation. However, I get the feeling that as Clojure lacks static typing and has heterogenous collections we tend to end up passing context around in maps more? Hence @korny's error return value?

korny13:08:50

An error monad (as I understand it) basically means you define a type that says “this type can be T or an error” where T was the original return value.

korny13:08:15

So if your function would return a String it now returns (either a String or an error)

korny13:08:36

and then your compiler will fail if the calling code doesn’t check for errors.

otfrom13:08:31

and then pester the channel (I'd be happy to go around that one again)

otfrom13:08:03

and honest pointing you at the paper is not saying RTFM. There were a lot of easy things I wasn't getting around why until I read that

korny13:08:19

In the absence of strong types, I can write something like:

(defn process [foo]
(try
  (str “result:” (/ foo 0))
  (catch Exception e
    (log “oopsie” e)
    ::error)))))))

otfrom13:08:38

the important thing with monads in Haskell is that the compiler will force you to have a branch that deals with the error

minimal13:08:41

the "type T or error" is just a sum type. Which is useful in clojure but not checked at compile time un fortunately.

korny13:08:46

but then the caller needs to know that this function returns either a String or ::error - no compiler to help

otfrom13:08:54

core.spec will so something similar for clojure (b/c your generative tests will fail)

agile_geek13:08:55

@otfrom: I never thought it was RTFM 😄 All help appreciated.

otfrom13:08:36

(and thinking about it I think Java's typed Exceptions are trying to do something monad like)

agile_geek13:08:17

Presumably core.specs conform would indicate if expected return value was not of correct spec as well as generative tests?

otfrom13:08:29

agile_geek: I'd use core.spec to say I could either get a number or an error back and then have the tests tell me that I wasn't handling the error

otfrom13:08:47

thus my comparison to checked Exceptions

agile_geek13:08:59

@otfrom: ok, I understand now

otfrom13:08:15

that was the light bulb moment for me (or at least the 1st one)

agile_geek13:08:39

Yeah, I guess checked exceptions form the 'contract' part that spec gives you but not sure they're at all 'monadic'?

agile_geek13:08:48

I need to actually use spec..I've just read about it and watched @stuarthalloway's youtube video on spec.

glenjamin13:08:03

Maybe and Error are nice and all, but when you combine them with bind don’t you lose stack traces?

glenjamin13:08:10

or at least, the equivalent of stack traces

otfrom13:08:48

glenjamin: idk as I'm more of a reader about monads than a user of them so far

otfrom13:08:06

(this is part of my general Big Thoughts about typing)

glenjamin13:08:21

whenever i’ve combined a bunch of things together using their monadic nature, i’ve had a vague unease about that

glenjamin13:08:37

in the same way a NPE surfaces far away from where the null first appeared

glenjamin13:08:47

Hickey in language of the system and simple made easy covers some similar ground

glenjamin13:08:53

interfaces and protocols are king

otfrom14:08:55

and this on sum and product types: http://blog.jenkster.com/2016/06/functional-mumbo-jumbo-adts.html from Kris Jenkins sorted out a lot of the rest of my thinking on types (though I read that first)

otfrom14:08:14

though, Person type :shudder:

glenjamin14:08:44

The stuff from spec about how type positions without names are rubbish struck a chord with me too

agile_geek14:08:59

It seems to me (in my incredibly simplistic viewpoint) that 'typing' seems to get into trouble when we get specific compound types? This is definitely the root of a lot of issues in Java and C#

glenjamin14:08:11

oh, that’s annoying - Gary Bernhardt did a great talk at strangeloop 2015 (sort of) about types vs tests. But it’s not online

minimal14:08:35

@agile_geek: I think that’s an issue with langs that have sub-typing like scala

mccraigmccraig14:08:46

@glenjamin: if your error-side type is, say, an ex-info then you get to keep stacktraces

minimal14:08:46

(and java c#)

agile_geek14:08:59

Types in those lang's don't compose well.

agile_geek14:08:33

Anyway I better stop reading this interesting thread on my laptop and get back to the incredibly uninteresting code reviews on client laptop!

otfrom14:08:32

agile_geek: I think it is just a problem of trying to create good sets/categories/ontologies. They just don't map that well (or at least clearly) on to the real world

otfrom14:08:25

glenjamin: thx for that I'll have a read

practicalli-john14:08:47

If anyone is in London tonight, I'll be giving a talk on Clojure development with Spacemacs / Emacs & Cider - its a last minute thing, but should be able to show off a range of stuff. If anyone wants to share anything, come along

gjnoonan14:08:25

@jr0cket: is it going to be recorded ?

otfrom14:08:45

adulteratedjedi: those ones often aren't

gjnoonan14:08:35

Yeah! In that case I'll be there in spirit 🙂 good luck

practicalli-john14:08:07

Nope, but I am creating an online workshop - which should have plenty of animated gifs (once I get the hang of them). The workshop may take a few weeks to finish...

agile_geek14:08:12

@jr0cket: oh bad luck mate...I'm going to be there 👎

practicalli-john14:08:21

I'll be covering stuff like:

practicalli-john14:08:24

- Adding the Clojure layer - Running the REPL & evaluating code - Running tests & test reports - Structural editing (smartparens/paredit fun) - Emacs common commands - Emacs cool stuff (multiple cursors, kill-ring / visual undo, - Clojure docs, auto-completion, snippets - Clojure refactoring with clj-refactor

practicalli-john14:08:43

If anyone wants to do debugging, happy to see what you can do...

dominicm14:08:49

@jr0cket: #C050AN6QW might be interested

practicalli-john14:08:57

I dont debug, except with println

gjnoonan14:08:21

is there any other method of debugging troll

dominicm14:08:56

The cider-nrepl debugging nrepl op commands are somewhat confusing "open a channel to send commands"

dominicm14:08:20

@agile_geek: I know you're researching these things currently, so I ask because you're probably in posession of this knowledge already. Is onyx's workflow and catalogue system unique to Onyx? Or do other distributed systems use it?

dominicm14:08:59

@jr0cket: Did emacs get parinfer yet?

otfrom14:08:39

dominicm: I wonder if I'd prefer aggressive-indent to parinfer

dominicm14:08:31

I've never used aggressive-indent. So I can't say. I have used parinfer. I really liked it

practicalli-john14:08:37

I'm happy with smartparens and other jiggery pokery in Spacemacs (usually just pressing the tab key). But parinfer looks nice

otfrom14:08:41

dominicm: I'm the other way around

dominicm14:08:52

Yeah, I know 😛

dominicm14:08:07

I'm a vim user. So I had parinfer within a week of it being announced.

dominicm14:08:38

https://github.com/snoe/nvim-parinfer.js a clojurescript plugin, which hooks the parinfer.js library (the one implementation to rule them all)

dominicm14:08:06

It came out not long after I started learning Clojure, so it was perfect.

thomas14:08:49

I use parinfer on Atom and really like it.

glenjamin14:08:02

Anyone been following the GDS news today?

agile_geek14:08:02

@dominicm: re: onyx the catalogue & workflow are unique to it afaik. I've used Storm for stream processing and onyx is far easier and has better separation of concerns.

dominicm14:08:42

@agile_geek: Awesome, thanks. I think I'm going to use something similar for writing a data specification library for clojure.

dominicm14:08:13

There's a lot of subtle cleverness in Onyx.

agile_geek15:08:41

Watch some of @michaeldrogalis talks on justification and philosophy I think he makes some gr8 points

agile_geek15:08:41

@glenjamin: ooooh. GDS power grab...that looks bad. Especially for @philandstuff

glenjamin15:08:24

the new guy is from the DWP > At DWP Kevin played a pivotal role in successfully introducing a range of digital services and products and growing the DWP digital academy.

glenjamin15:08:39

I worked at the DWP for a bit, twas a mess

dominicm15:08:59

@agile_geek: thanks for the tip

agile_geek15:08:10

@glenjamin: I know ppl working at DWP and they say DWP is doing a power grab on HMRC digital...poaching resources. But I think ppl at HMRC have wised up that although DWP says they're doing things differently they are not as forward thinking as HMRC Digital are.

glenjamin15:08:29

DWP has delivered one Digital Service

glenjamin15:08:50

and the team that did that are siloed off from the main efforts

agile_geek15:08:05

yeah that was were HMRC were 18 months ago but they've moved on a lot

agile_geek15:08:23

still a bit 'project' thinking though

agile_geek15:08:23

GDS is a shining beacon but sounds like it may get watered down cos senior civil servants are jealous of it's success

glenjamin15:08:05

I think the branding could do with a re-work. From a departmental point-of-view GDS is a set of advice, guidelines and principles

korny15:08:02

DWP have some very mixed bits - some good, some bad. I probably shouldn’t make any comments though. But it’s not all bad.

rickmoynihan15:08:16

korny: regarding exceptions vs error values... One interesting thing you could do is return an exception as an error value instead of throwing it... That way you do capture a stacktrace

korny15:08:24

true - though I don’t know that the stack trace has any value to a caller, beyond diagnostics after failure. I’d prefer to log the stack trace, assuming you have something slurping up and indexing the logs.

glenjamin15:08:04

Where I worked in Leeds there were plenty of good people trying to do good work, but getting into public beta or beyond was being made increasingly difficult

glenjamin15:08:31

So the best people kept getting frustrated and leaving

rickmoynihan15:08:08

there's no value to a caller for the stacktrace... but it does let you capture context... obvs you could use a log for that too

agile_geek16:08:40

@glenjamin: so most astonishing thing about that statement is you worked in Leeds...and survived!

agile_geek16:08:25

Got to be a little careful as I might be working there some of time in next few months ;-)

glenjamin16:08:01

There’s quite a lot of decent jobs and meetups in Leeds

agile_geek16:08:35

I know. Once @otfrom left the place picked up

otfrom16:08:08

agile_geek: I liked working in Leeds

otfrom16:08:30

it was better than Bradford (though I did miss the Kashmir)

dominicm16:08:27

Out of interest, what do you guys know about Nuneaton?

paulspencerwilliams16:08:45

It's quiet but okay. Are you moving there?

dominicm16:08:29

I got my mortage offer today 🎉

dominicm17:08:39

They're currently trying to rebrand as a commuter town. I'm moving closer to MK. I'm moving to an area infamously known as Tramp Hill.

dominicm17:08:55

Which has been flattened, people kicked out, and rebuilt

xlevus18:08:31

why would you flatten a hill

paulspencerwilliams18:08:27

Sorry, I'm confused. Nuneaton is miles from Mk.

dominicm18:08:05

@paulspencerwilliams: I currently travel ~2 hours to MK from Leicester. But my girlfriend is still in Uni in Leicester. So we needed a midway. The trains all change at Nuneaton.

dominicm18:08:26

~20/30 minutes to Leicester. 25 minutes to MK. 1 hour to London.

paulspencerwilliams19:08:30

Yes, I occasionally travel to London via Nuneaton. I live about 20 minute drive from there in a village called Overseal.

korny21:08:42

We're moving further from MK :-) Only to Leighton Buzzard though.