off-topic

https://github.com/clojurians/community-development/blob/master/Code-of-Conduct.md Clojurians Slack Community Code of Conduct. Searchable message archives are at https://clojurians-log.clojureverse.org/
raspasov 2021-05-08T04:52:18.089100Z

Hypothesis: If all we all collectively agreed to rename “unit tests” to “code example”, that would significantly increase the chance of them being written in the first place.

raspasov 2021-05-08T04:53:04.089900Z

(I say this is as someone who never found much enthusiasm for “unit testing”)

❤️ 3
gklijs 2021-05-08T04:59:51.090100Z

Nice Hypothesis. I hardly write any test with Clojure. Also because I don't use it for work or for a library. I really like with Rust you can add code examples in the documentation, right above the code. I guess with macros with Clojure something similar could be done. Like defne define a function, with an example of using the function.

raspasov 2021-05-08T05:04:35.092500Z

Same. I’ve written generative tests for things that really needed to be correct and the cost of messing up is high. Those can help, like a lot. But unit tests… I barely can see the value.

raspasov 2021-05-08T05:06:09.093700Z

I like the idea of specifying them next to the original function. There’s an overhead of switching to a separate namespace to write the “examples”.

Christoffer Ekeroth 2021-05-10T07:39:47.130900Z

Python does this: https://docs.python.org/3/library/doctest.html However, for tests that require non-trivial setup it can easily become awkward. EUnit (from Erlang) has a feature where you can write unit tests at the bottom of a module. It’s pretty nice for co-locating the tests and the code, and helps emphasise the “unit” part of unit testing. This also lets you test “private” functions which can be both a blessing and a curse. The risk, of course, is that a module’s “internal” API is much more volatile

Chris Lowe 2021-05-19T16:26:06.026800Z

https://www.youtube.com/watch?v=orFYFwiG1dM

👍 1
raspasov 2021-05-08T05:10:27.094Z

@gklijs Do you use Rust professionally?

gklijs 2021-05-08T05:12:49.094200Z

Not really, I do have a library other people use in production. Recently I made a poc, but mostly because of politics I don't see that going to production soon.

👌 1
lassemaatta 2021-05-08T05:35:40.095500Z

I think you can use the :test metadata for this, e.g. with https://clojuredocs.org/clojure.test/with-test

🎯 3
mauricio.szabo 2021-05-08T16:06:56.097800Z

I think a problem with the name "unit tests" is the concept of an "unit". Is it just a function? Will it use internal data? And so on... I do write LOTS of tests, but very few would be considered "unit tests".

craftybones 2021-05-09T15:18:56.128800Z

A “unit” in a language that has immutable constructs and for the most part relies on pure functions is not the same as a “unit” in a language that does PLOP.

craftybones 2021-05-09T15:19:28.129Z

Having said that, there are times when you would possibly write tests that focus on smaller parts, not just the whole thing since it might be a little easier to focus and setup

borkdude 2021-05-08T16:10:15.098500Z

Same here. I write lots and lots of test, for clj-kondo and babashka, but most of them test the entire chain, including the parsing of command line args, all the way to printing the output.

👌 1
localshred 2021-05-10T16:46:01.132700Z

same here

sova-soars-the-sora 2021-05-08T19:51:19.099900Z

Hi, how does Git versioning work? In specific: What is saved with each commit? Just a high quality diff compared with the previous instance? Or is it a canonical copy is saved with meta data describing previous instances as diffs from the canonical-current-instance?

sova-soars-the-sora 2021-05-08T19:53:05.101600Z

To me it would appear that the latter, a current-canonical-version that applies a series of commits in reverse order (id est: undoes them) for getting to a previous commit is the most efficient solution for space and furthering work. Basically have the present moment as the main copy and everything else is a diff or series of diffs against that.

phronmophobic 2021-05-08T19:53:31.102300Z

Each commit has the full project at that point in time. Space is saved using structural sharing.

sova-soars-the-sora 2021-05-08T19:54:06.102900Z

So it appears seamless to the user as a full-project-at-each-moment but in reality the under-the-hood stores the stuff efficiently?

phronmophobic 2021-05-08T19:54:29.103400Z

not just appears

phronmophobic 2021-05-08T19:54:50.104Z

I highly recommend https://git-scm.com/book/en/v2

🔖 1
sova-soars-the-sora 2021-05-08T19:55:01.104400Z

Oh hey that's a lovely link, thank you I will check it out!

sova-soars-the-sora 2021-05-08T19:55:35.105600Z

Yeah I recently interviewed for a job where one of the future projects for the thing was version control for user-generated documents... So I'm curious how one would implement it nicely.

phronmophobic 2021-05-08T19:55:56.106Z

There's a lot similarities with clojure's persistent data structures, where adding an element to a vector doesn't use twice the memory due to structural sharing

sova-soars-the-sora 2021-05-08T19:56:17.106400Z

Right. I see what you mean. Yes I was admiring that about Clojure just yesterday.

sova-soars-the-sora 2021-05-08T19:56:58.106800Z

I rather enjoy that those efficiency dilemmas are abstracted away from the general program

sova-soars-the-sora 2021-05-08T19:57:23.107400Z

I can make a water park without being a plumber 😅

2021-05-08T19:58:39.109100Z

This might be a dumb question but what are peoples' workflow for using two computers to work on code? I have a desktop and just got a laptop and I want to be switching back and forth throughout the day. Just use dropbox or something?

sova-soars-the-sora 2021-05-08T19:58:47.109200Z

So you reckon some form of structural sharing is key to efficiently storing git commits / git versions? Rebuilding from previous commits might be costly.

sova-soars-the-sora 2021-05-08T20:01:04.111900Z

@jjttjj two physically distinct OS instances? (not just dual monitor?) I use github for code and you can fetch latest on the next machine each time. But uh, it depends on what you're working on. Code or image editing? Video editing would recommend getting an external HDD or SDD and putting huge files on it to swap quickly, or even swap-and-share a project directory on an external drive.

pithyless 2021-05-09T14:32:29.124900Z

@sova it's not exactly meant for this use-case, but maybe you can take a look at https://mob.sh/ It's some bash tooling to enable making temporary git branches and WIP commits and push/pulling them between different computers. Primarily meant for quick handoffs between several people that are coding together, but I don't see why you couldn't use it to push/pull when switching computers :)

pithyless 2021-05-09T14:34:13.125200Z

I'd be worried about using dropbox as my source-of-truth for git repos after seeing John Hughe's talk about quickchecking Dropbox (and also thinking back to all the Jepsen post-mortem posts). Distributed systems are hard when they want to auto-merge conflicts :)

👍 1
pithyless 2021-05-09T14:36:27.125500Z

^ to be fair, someone has pointed out to me in the past (can't recall who), that Dropbox had fixed those bugs found by Hughes when they released a new sync engine sometime ago.

borkdude 2021-05-09T14:57:48.127500Z

I’ve been using Dropbox for years and years, all my oss repos are in there so I can work on them from anywhere although Github generally has all my code as well at the end of the day

👍 1
borkdude 2021-05-09T14:58:39.128600Z

My only gripe with Dropbox is that they still don’t have a thing like gitignore

sova-soars-the-sora 2021-05-09T15:53:26.129400Z

Probably by design. Simplicity for most users

phronmophobic 2021-05-08T20:01:24.112400Z

Storing full snapshots at each point in time is also important for integrity. From a design perspective it makes it harder for a bug to lose or munge data that's committed.

phronmophobic 2021-05-08T20:01:53.112800Z

You may find the git internals chapter interesting, https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain

sova-soars-the-sora 2021-05-08T20:02:04.113200Z

Hmm, that's a good point. Maybe storing a commit id and also storing some error correcting codes would help ensure things are A-OK.

phronmophobic 2021-05-08T20:02:11.113300Z

Specifically the 10.2 and 10.4

sova-soars-the-sora 2021-05-08T20:02:26.113700Z

Wow man thanks a lot, really appreciate the pin-pointedness

sova-soars-the-sora 2021-05-08T20:02:45.114Z

xD they even call the chapter Plumbing and Porcelain

2021-05-08T20:02:56.114300Z

Just code editing. Yeah I've taken a stab at just using github too but I've been burned by forgetting to commit or not yet having a coherent commit ready before switching computers

phronmophobic 2021-05-08T20:03:23.114500Z

Finding good, real world projects that cover design isn't always easy, but the git book is a great example

bartuka 2021-05-08T22:07:15.118900Z

random thought about programming languages. I found this article comparing Energy efficiency between programming languages (https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sleFinal.pdf?utm_source=thenewstack&utm_medium=website&utm_campaign=platform) and this got me thinking.. do we have any studies about expenses with cloud providers as your system grows by programming language? Something like to provide X workload using Python / Java / Go ... etc you will need an ECS cluster of size X1, X2, X3, and so on. (or EC2.. whatever) that will cost Y per month.

bartuka 2021-05-08T22:11:29.119100Z

because of this GRPC benchmark https://github.com/LesnyRumcajs/grpc_bench/wiki/2021-04-13-bench-results I was thinking about that. It is easier to find python developers where I live and arguably easier for them to prototype something... but would be interesting to see how this choice also impact the budget of the company with servers to deploy these systems

2021-05-08T22:29:03.119400Z

Wonder how pricey to run up a vm in the cloud and use as your dev environment... then wherever you are you can work...

2021-05-08T22:31:23.119600Z

I work like this, switching between desktop on Linux and Windows laptop, git works fine for me. But I tend to check in frequently.

lread 2021-05-08T22:36:00.119800Z

iirc correctly I think @borkdude might use dropbox?