This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-13
Channels
- # aleph (3)
- # aws (1)
- # beginners (97)
- # boot (41)
- # cider (7)
- # clara (105)
- # cljs-dev (4)
- # cljsrn (66)
- # clojure (185)
- # clojure-argentina (2)
- # clojure-colombia (15)
- # clojure-czech (1)
- # clojure-dusseldorf (8)
- # clojure-greece (2)
- # clojure-italy (5)
- # clojure-russia (33)
- # clojure-spec (14)
- # clojure-uk (9)
- # clojurescript (75)
- # cursive (6)
- # data-science (1)
- # datomic (12)
- # emacs (2)
- # fulcro (71)
- # funcool (1)
- # jobs (6)
- # jobs-discuss (62)
- # juxt (21)
- # lein-figwheel (1)
- # luminus (9)
- # lumo (41)
- # off-topic (39)
- # om (12)
- # onyx (1)
- # portkey (2)
- # protorepl (4)
- # re-frame (14)
- # reagent (50)
- # ring (3)
- # shadow-cljs (6)
- # spacemacs (38)
- # specter (8)
- # test-check (14)
- # testing (52)
- # unrepl (2)
BTW, regarding that PDF, Copey is known for all sorts of heretical counter-opinions too (I remember back in the early days of design patterns and a lot of the OOP conferences of the mid-90's, you'd often find him in the audience heckling speakers on a variety of topics đ )
This rebuts a lot of Copey's arguments https://henrikwarne.com/2014/09/04/a-response-to-why-most-unit-testing-is-waste/
Also note that most of the problems both DHH and Copey bring up are specific to OOP...
A fascinating piece -- much appreciated!! And, bottom line, I think we're in broad agreement: write simple code, use tests to ensure 1. it does the right thing and 2. it doesn't break when we refactor it.... yes?
So, really, the only contention is whether "test-first" actually drives design
Yup. Actually, I believe test first does drive design. I just don't think its the only way to write well designed code. And sometimes, its can be over designed for tests, hurting a bit.
There's no One True Way(tm)...
usually File is too specific a type to work with - eg. it doesnât transition to code that uses a URL or a resource inside a jar
which are common things to want
if you write the code in terms of InputStream or Reader, you can just pass it some source of data and not worry about those details
right, but you can .readline on things that arenât Files
itâs a method on BufferedReader, which you can make from pretty much anything you would get input from (string, url, file, resource inside jar, âŚ)
also, in clojure, itâs convenient to use line-seq
since you can then use our nice sequence abstractions
(def text-with-spaces-reader
(java.io.BufferedReader.
(java.io.StringReader.
" some csv text here ")))
but Iâd still need to change my function inside the core.clj file in order to get the test to work right?
peregrine.circle=> ( (java.io.StringReader. "foo\nbar\nbaz"))
#object[java.io.BufferedReader 0x1a1ca2cd "java.io.BufferedReader@1a1ca2cd"]
peregrine.circle=> (line-seq *1)
("foo" "bar" "baz")
http://clojure.java.io/reader is smart about creating BufferedReader
I am trying to use @john âs code to drop 2 since thatâs a much better solution than my current one and I keep getting a âunable to resolve rdr in this contextâ error
because the reader has the with-open in it so I would like to get it working there before I try to figure out testing
and for some reason when I break it out into a seperate function I stop having the symbol error and I get a problem with ânull pointer exceptionâ meaning something in my data is wrong
really hard to tell, without seeing the code. I'm able to do a line-seq
on a (io/reader file)
over here.