Fork me on GitHub
#off-topic
<
2021-02-25
>
Stuart13:02:15

what do you do with developers that always go straight to "The compiler is broken" when their code doesn't work?

vemv16:02:38

make Intelectual humility (https://hn.algolia.com/?dateRange=all&amp;page=0&amp;prefix=true&amp;query=intellectual%20humility&amp;sort=byPopularity&amp;type=story) a reified team-wide policy without pointing out at the individual I think that it's a style that everyone can pick up, and for those who don't bother, it should be easy to see that they're deviating from team expectations

Stuart13:02:57

From someone I work with I've had (in C# land), that string equality is broken (he was comparing "foo" with "foo "), try catch and exceptions were apparently broken (they weren't, he just was misunderstanding how exceptions work) and now today - booleans are defaulting to true on initialization, (they aren't, his bool is static so it's being set elsewhere). But he wont listen, it's always the compiler or Microsoft has broke something...

ghadi13:02:27

fire them eventually

👌 21
Stuart13:02:41

I mean, you think that your thought process would be "if microsoft released a version of .net where string equality was broken, everyone would be jumping up and down and running around in chaos", they aren't, so it's probably my code... but that thought process doesnt seem to ever fire

yes 6
ghadi13:02:50

tools users should endeavor to understand their tools

👍 6
Matheus Serpellone Nash13:02:27

Might be a bit confrontational, but: remind them every other time they blamed the compiler and it was their own fault?

borkdude13:02:47

And it's a plus when this tool is a compiler you can actually understand because it's quite small :) (I'm hinting at Compiler.java et al). I'm ignoring the JVM for a moment ;)

manutter5113:02:47

“Experience has taught me that whenever I think the compiler is broken, it’s almost always true that I’m looking in the wrong place for the problem.”

😆 9
Stuart13:02:47

even yesterday, they needed me to talk them through some code that wasn't working, they were calling a method .Width() that sets a width of an object. But passing a string "25px", Width() just wants a number. I told him to just pass 25. It started working but he says that can't possibly be the reason. SOmething weird must have been going on with caching code or something... I dunno...

picard-facepalm 12
😆 6
andy.fingerhut13:02:49

99.9% of the time the bug is in the newest code added. The compiler and libraries one is using, especially if they are popular and widely used, are old code. What you are working on is new code.

andy.fingerhut13:02:51

Every good developer must eventually gain the humility of accepting that they likely caused the problem (or someone on their team, if working on a team).

👍 15
manutter5113:02:14

“Whenever __ I’ve learned that __” is a good way to frame things so that you can tell someone they’re doing it wrong without being confrontational about it.

👍 12
manutter5113:02:16

Or at least I’ve had fairly good luck with that in the past.

andy.fingerhut13:02:05

In some cases, dev tools do introduce N levels of caches, which if you do not know where they all are and know how to clear them and start empty, confusing things happen. If someone has become gun-shy from learning there is yet one more level of caches that no one taught them about in their tools, I can imagine that one can become often suspicious that such a thing is happening yet again.

andy.fingerhut13:02:07

For that, I would suggest simplifying the dev environment, or at least have a good team dev tool page explaining how to clear them all out and start fresh (and perhaps intermediate levels of "clear out steps 1 through 4, so I know I only need to repeat 5 through 6 when I make this category of code changes".

andy.fingerhut13:02:23

and/or consider simplifying the tool flow for everyone.

andy.fingerhut13:02:13

Even the Clojure CLI tools introduce a new cache that if you don't know about it, leads to very confusing behavior if you rm -fr ~/.m2 and run again without also deleting relevant .cpcache directories, or use appropriate command line options to ignore the contents of the .cpcache directory.

🤯 3
bronsa20:02:25

ugh z3

[~]> z3 -in
(declare-fun f (String) Int)
(declare-fun y () String)
(declare-fun x () String)
(assert (= 3 (+ (f x) (f y))))
(check-sat)
sat
(get-model)
(model
  (define-fun y () String
    "")
  (define-fun x () String
    "")
  (define-fun f ((x!0 String)) Int
    3)
)

hiredman20:02:14

"oi, jobs done!" dusts hands and walks off

andy.fingerhut20:02:17

What does the (x!0 String) part mean? Unless that means something really special, it looks like both calls to f return 3, so the sum would be 6?

bronsa21:02:31

nothing special, x!0 is just an identifier

bronsa21:02:39

and yes, that's the problem :) the model is incorrect!

dpsutton20:02:35

makes me want to go to another will byrd talk

😎 3
andy.fingerhut20:02:30

I've used Z3 a bit on a project to solve equations on bit-string / bit-vectors, and was amazed at what it is able to do, and usually how quickly (although it isn't difficult to find examples where you aren't gonna live to see the answer).

bronsa21:02:06

yeah it's a bug in z3, seems related to model extraction with strings

bronsa21:02:32

not even involving the arithmetic solver

(declare-fun f (String) Bool)
(declare-const x String)
(declare-const y String)
(assert (not (= (f x) (f y))))
(check-sat)
sat
(get-model)
(model
  (define-fun y () String
    "")
  (define-fun x () String
    "")
  (define-fun f ((x!0 String)) Bool
    true)
)

bronsa21:02:21

it's pretty amazing tech for sure, we use it extensively

bronsa21:02:33

as long as it doesn't crap itself on small examples that is simple_smile

bronsa21:02:12

phew, looks fixed on master

andy.fingerhut21:02:35

I mean, 2+2=4 is pretty basic, and probably works. But x+y=3? You may be asking a bit much of it there 🙂