ldnclj

Find us on #clojure-uk
agile_geek 2015-06-09T07:22:26.000585Z

Good Morning

agile_geek 2015-06-09T07:23:12.000586Z

@tmulvaney: Welcome Thomas. Good hacking with you last night at the Dojo.

quentin 2015-06-09T07:27:20.000587Z

morning

agile_geek 2015-06-09T07:30:51.000588Z

@xlevus I’ve only actually written macros twice in practice. Here is one use - https://gist.github.com/chrishowejones/4e8c60e3bcf1573de543

xlevus 2015-06-09T07:31:36.000590Z

I made one that generated some Compojure routes... but it's taken me a week to work it out

2015-06-09T07:46:46.000591Z

Morning

thomas 2015-06-09T07:47:08.000592Z

morning

benedek 2015-06-09T07:47:13.000593Z

morning!

agile_geek 2015-06-09T08:12:00.000594Z

Open question: TDD, REPL driven development or hybrid? If hybrid, when to use each?

quentin 2015-06-09T08:14:48.000595Z

Haven’t made big projects in clojure yet so I have only been doing REPL driven development

quentin 2015-06-09T08:15:44.000596Z

I guess I would add some tests on top for bigger projects, but not as much as with OOP languages ( like I do with python )

thomas 2015-06-09T08:31:12.000597Z

I tend to do REPL development first and then add tests later

thomas 2015-06-09T08:32:05.000598Z

and when I did C and Java I would write write the tests and the code at the same time

thomas 2015-06-09T08:32:23.000599Z

as sometimes I wasn't even sure what the function was supposed to do

benedek 2015-06-09T08:34:01.000600Z

RDD and integration tests really work for me with clojure. no unit tests (or not many) and no TDD (well RDD is kinda TDD on steroids really)

benedek 2015-06-09T08:34:21.000601Z

but i guess this is a very contextual question too. so depending on the project a lot

thomas 2015-06-09T08:40:34.000602Z

RDD = Responsibility-driven design ?????

benedek 2015-06-09T08:41:41.000603Z

repl driven development, sry

thomas 2015-06-09T08:51:51.000604Z

:simple_smile:

2015-06-09T08:58:28.000605Z

Cheers @agile_geek, I see you've pushed some schema stuffto the social-kata! Was a fun night!

agile_geek 2015-06-09T09:01:11.000606Z

@tmulvaney always enjoy dojos although I can guarantee 'brain fade' when working on a problem.

xlevus 2015-06-09T09:32:55.000607Z

@agile_geek: TDD, as I still have no idea how to do REPL-DD effectively.

mccraigmccraig 2015-06-09T09:39:25.000608Z

@agile_geek @xlevus : i've got 13 in this 25kloc codebase... no idea whether that is too few or too many. here's my recent fave which cleaned up some truly horrid clojurescript code : https://gist.github.com/mccraigmccraig/f9dc2ced5f9fb696b772

agile_geek 2015-06-09T09:41:20.000609Z

I tend to use integration or functional tests (preferably test first) to quantify the problem, then use REPL driven development with some of the REPL ‘experiments’ preserved after the fact as unit tests. However, I still use TDD for stuff where I just can’t visualise the functions I require up front. I sometimes delete unit tests if I feel tests at the higher level already cover the code enough.

agile_geek 2015-06-09T09:42:00.000610Z

However, I’ve only ever written ‘toy’ projects so hard for me to tell what I would do in a larger code base.

mccraigmccraig 2015-06-09T09:43:06.000611Z

@agile_geek: i tend to do something closer to TDD on libs and closer to RDD on things with a user interface

agile_geek 2015-06-09T09:45:45.000612Z

Even recent toy projects have caught me out with the dynamic typing allowing a whole category of bugs I wouldn’t get in a statically typed system. Having said that I’m not fanatical about static typing and like the speed of development in dynamic typing. I’m just trying to feel my way to a balance of speed vs safety and I’m loath to dismiss TDD from my armoury of techniques just yet.

agile_geek 2015-06-09T09:47:24.000613Z

Before anyone points it out I must look at core.typed sometime.

mccraigmccraig 2015-06-09T09:47:55.000614Z

@agile_geek: prismatic schema is another useful tool here

practicalli-john 2015-06-09T09:56:58.000615Z

Social Network kata code from last nights uSwitch Clojure dojo https://github.com/jr0cket/social-network-kata - I've added some docs and tried to capture some of our thinking process as comments too... #pullrequestswelcome

quentin 2015-06-09T10:00:36.000617Z

cool :simple_smile:

quentin 2015-06-09T10:01:23.000618Z

jr0cket: when you showed your code yesterday you had some special characters displayed, why/how are you doing this ? 😄

thomas 2015-06-09T10:03:08.000619Z

@agile_geek: we tried to add core.typed recently to some existing code and found it quite painful, not straight forward unfortunately

practicalli-john 2015-06-09T10:08:39.000620Z

@quentin: the "special" characters are substituted by Emacs. I use https://github.com/overtone/emacs-live as my base configuration and it swaps (fn ..) with a lambda symbol, #( .. ) with a stylised f and #{ ... } with a set character

practicalli-john 2015-06-09T10:10:45.000622Z

@agile_geek: since you mentioned it last night, I've seen a few more examples of defrecord (in the "Mastering Clojure Data Analysis" book). Do you think that defrecord can add enough "type safety" in many cases ?

quentin 2015-06-09T10:11:04.000623Z

thanks jr0cket :simple_smile:

agile_geek 2015-06-09T10:15:47.000624Z

@mccraigmccraig: yep. Used Schema a bit.

benedek 2015-06-09T10:19:23.000625Z

@quentin: @jr0cket i really liked that stuff, went crazy on it a bit:

emacs-lisp

;; pretty symbols
(global-prettify-symbols-mode 1)

(add-hook 'clojure-mode-hook
          (lambda ()
            (push '(">=" .      ?≥) prettify-symbols-alist)
            (push '("<=" .      ?≤) prettify-symbols-alist)
            (push '("partial" . ?π) prettify-symbols-alist)
            (push '("defn" .    ?⇒) prettify-symbols-alist)
            (push '("defn-" .   ?⇛) prettify-symbols-alist)
            (push '("atom" .    ?α) prettify-symbols-alist)
            (push '("nil" .     ?Ø) prettify-symbols-alist)
            (push '("->" .      ?→) prettify-symbols-alist)
            (push '("->>" .     ?⇉) prettify-symbols-alist)
            (push '("reduce"    ?Σ) prettify-symbols-alist)
            (push '("map"       ?↦) prettify-symbols-alist)
            (push '("false"     ?ғ) prettify-symbols-alist)
            (push '("true"      ?τ) prettify-symbols-alist)
            (push '("or"        ?∨) prettify-symbols-alist)
            (push '("and"       ?∧) prettify-symbols-alist)
            (push '("not"       ?¬) prettify-symbols-alist)))

benedek 2015-06-09T10:19:36.000626Z

my config for all kind of prettifing

quentin 2015-06-09T10:19:55.000627Z

oh my

benedek 2015-06-09T10:19:56.000628Z

but i switched that off because it messes with how emacs counts characters in buffers

benedek 2015-06-09T10:20:21.000629Z

and it also puzzles anyone looking at your screen (which is both good and bad i guess 😉 )

benedek 2015-06-09T10:20:42.000630Z

so if you go crazy on this stuff that is effectively breakes stuff in clj-refactor for example

thomas 2015-06-09T10:20:56.000631Z

@benedek: bit too mathy for me to be honest

benedek 2015-06-09T10:20:57.000632Z

as column counts will differ in the buffer and in the file...

benedek 2015-06-09T10:21:20.000633Z

i said i went crazy 😉 and not using prettifying at all nowadays...

thomas 2015-06-09T10:21:41.000634Z

happens to the best of us 😉

benedek 2015-06-09T10:21:52.000635Z

i think @bozhidar has a blog post about it btw

benedek 2015-06-09T10:22:27.000636Z

@thomas: indeed 😉

agile_geek 2015-06-09T10:22:58.000638Z

@jr0cket: not sure record helps with ‘type safety’ but it does establish a contract. Used with Schema it looks like a way forward.

benedek 2015-06-09T10:24:06.000640Z

it really makes your code look concise tho… (loved the arrows instead of defn, defn-)

mccraigmccraig 2015-06-09T10:32:20.000641Z

looking to the future : https://github.com/LuxLang/lux

martintrojer 2015-06-09T10:34:34.000643Z

I really hope the future does not involve the JVM.

mccraigmccraig 2015-06-09T10:38:01.000646Z

or maybe only involves it as one of several supported backends...

mccraigmccraig 2015-06-09T10:38:55.000647Z

i was looking at this https://github.com/cljsinfo/api-refs/tree/catalog earlier which makes it clear just how much of a massive effort ClojureScript is (in the number of functions re-implemented for ClojureScript)

thomas 2015-06-09T10:43:13.000649Z

@martintrojer: I have a bit of a love/hate relationship with the JVM...

thomas 2015-06-09T10:43:40.000650Z

getting the eco system is nice for instance

thomas 2015-06-09T10:44:27.000651Z

and all the work that has gone into the JIT etc.

martintrojer 2015-06-09T10:45:14.000652Z

yeah, lots of work. still not very good.

martintrojer 2015-06-09T10:49:15.000653Z

Re; JVM — Brian Goetz conj talk was a tiny bit inspirational. Value types would be a nice step forward, just a decade or 2 too late.

2015-06-09T11:10:56.000654Z

@mccraigmccraig: https://github.com/pixie-lang/pixie is quite cool and has its own vm/jit

martintrojer 2015-06-09T11:13:46.000656Z

Sure, Baldridge is a cool guy. Will be interesting to follow pixie

mccraigmccraig 2015-06-09T11:19:29.000657Z

tmulvaney: oh, i hadn't seen that... though the thing i was liking about lux is the static type system. clojure gets many things right, but i keep on wanting (sane) static validation

mccraigmccraig 2015-06-09T11:21:20.000658Z

(where haskell is at the 'sane' end of the spectrum and scala umm not)

martintrojer 2015-06-09T11:53:00.000659Z

core.typed can be what you are looking for

martintrojer 2015-06-09T11:53:47.000660Z

writing a blog about core.typed atm. well, when I say writing I mean doing some research. well, when I say research I mean toying around in the REPL.

agile_geek 2015-06-09T11:55:30.000661Z

All these languages are very interesting but I often get business people wondering why as an industry we can’t settle on a small subset rather than keep reinventing ourselves every 5 mins. I know we have to keep moving to make best use of advances in technology and approach but they have a point.

martintrojer 2015-06-09T11:56:44.000662Z

agile_geek: agreed. especially when all we are doing is hill climbing. New languages are OK, but they should explore (radically) different ideas.

mccraigmccraig 2015-06-09T11:56:53.000663Z

@martintrojer: yeah, i'll try core.typed on the next greenfield project i do ... it looks difficult to retro-fit

martintrojer 2015-06-09T11:57:28.000665Z

mccraigmccraig: retrofitting is on my list to tackle in the post

agile_geek 2015-06-09T11:59:57.000666Z

@martintrojer I'd be interested in that post as core.typed is something I'd like to look at.

mccraigmccraig 2015-06-09T12:00:03.000667Z

@agile_geek: but which subset ? and why would software make itself static when business processes are always being reinvented ?

mccraigmccraig 2015-06-09T12:00:12.000668Z

@martintrojer: me too

agile_geek 2015-06-09T12:02:23.000669Z

@mccraigmccraig if I knew the answer to that I'd be rich and famous!

martintrojer 2015-06-09T12:07:07.000670Z

RE pixie; can be the answer to the problem of writing shell scripts in a clojure-like language.

martintrojer 2015-06-09T12:08:23.000671Z

if he gets the FFI story right (which he might have already) hooking into existing webserver libraries etc could be interesting for writing small REST apis etc.

2015-06-09T12:09:57.000672Z

well he's using libuv for dealing with IO which is what node uses. I've written a very poor webserver built on top of pixies tcp streams which was quite fun.

2015-06-09T12:10:47.000673Z

I think writing pixie FFI bindings for joyents http-parser could be an interesting project