what do you do with developers that always go straight to "The compiler is broken" when their code doesn't work?
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...
fire them eventually
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
tools users should endeavor to understand their tools
Might be a bit confrontational, but: remind them every other time they blamed the compiler and it was their own fault?
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 ;)
“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.”
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...
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.
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).
“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.
Or at least I’ve had fairly good luck with that in the past.
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.
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".
and/or consider simplifying the tool flow for everyone.
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.
make Intelectual humility
(https://hn.algolia.com/?dateRange=all&page=0&prefix=true&query=intellectual%20humility&sort=byPopularity&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
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)
)
"oi, jobs done!" dusts hands and walks off
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?
makes me want to go to another will byrd talk
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).
yeah it's a bug in z3, seems related to model extraction with strings
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)
)
nothing special, x!0
is just an identifier
and yes, that's the problem :) the model is incorrect!
it's pretty amazing tech for sure, we use it extensively
as long as it doesn't crap itself on small examples that is :simple_smile:
phew, looks fixed on master
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 🙂