Fork me on GitHub
#ldnclj
<
2015-06-09
>
agile_geek07:06:26

Good Morning

agile_geek07:06:12

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

agile_geek07:06:51

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

xlevus07:06:36

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

agile_geek08:06:00

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

quentin08:06:48

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

quentin08:06:44

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 )

thomas08:06:12

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

thomas08:06:05

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

thomas08:06:23

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

benedek08:06:01

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)

benedek08:06:21

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

thomas08:06:34

RDD = Responsibility-driven design ?????

benedek08:06:41

repl driven development, sry

tmulvaney08:06:28

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

agile_geek09:06:11

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

xlevus09:06:55

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

mccraigmccraig09:06:25

@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_geek09:06:20

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_geek09:06:00

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

mccraigmccraig09:06:06

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

agile_geek09:06:45

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_geek09:06:24

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

mccraigmccraig09:06:55

@agile_geek: prismatic schema is another useful tool here

practicalli09:06:58

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

quentin10:06:23

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

thomas10:06:08

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

practicalli10:06:39

@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

practicalli10:06:45

@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 ?

quentin10:06:04

thanks jr0cket simple_smile

agile_geek10:06:47

@mccraigmccraig: yep. Used Schema a bit.

benedek10:06:23

@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)))

benedek10:06:36

my config for all kind of prettifing

benedek10:06:56

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

benedek10:06:21

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

benedek10:06:42

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

thomas10:06:56

@benedek: bit too mathy for me to be honest

benedek10:06:57

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

benedek10:06:20

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

thomas10:06:41

happens to the best of us 😉

benedek10:06:52

i think @bozhidar has a blog post about it btw

benedek10:06:27

@thomas: indeed 😉

agile_geek10:06:58

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

benedek10:06:06

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

martintrojer10:06:34

I really hope the future does not involve the JVM.

mccraigmccraig10:06:01

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

mccraigmccraig10:06:55

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)

thomas10:06:13

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

thomas10:06:40

getting the eco system is nice for instance

thomas10:06:27

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

martintrojer10:06:14

yeah, lots of work. still not very good.

martintrojer10:06:15

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.

tmulvaney11:06:56

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

martintrojer11:06:46

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

mccraigmccraig11:06:29

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

mccraigmccraig11:06:20

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

martintrojer11:06:00

core.typed can be what you are looking for

martintrojer11:06:47

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_geek11:06:30

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.

martintrojer11:06:44

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

mccraigmccraig11:06:53

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

martintrojer11:06:28

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

agile_geek11:06:57

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

mccraigmccraig12:06:03

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

mccraigmccraig12:06:12

@martintrojer: me too

agile_geek12:06:23

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

martintrojer12:06:07

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

martintrojer12:06:23

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.

tmulvaney12:06:57

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.

tmulvaney12:06:47

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