« first day (1229 days earlier)      last day (3737 days later) » 

3:00 PM
The result
What client code sees
 
@jalf That's your interpretation of my disagreement. I don't agree with you => I don't acknowledge that you are right.
 
Verify the contract
 
How do you verify those post-conditions? You must assert that some variables have the values or range of values you expect.
That's state verification
Could be on the returned object
That's still state verification
 
You don't check private shit, you check what you get on the interface boundary
 
3:01 PM
So this one time, I was helping someone within the comments of their question, and when the comments grew too large, I had an option to "Bring this conversation into chat" or something along those lines. Is there a way I can do that again?
 
@AndyProwl Did you see what I wrote above, about compiler bugs? Let's suppose that yes, you are omniscient and never makes that particular error in your code, and that no one else will ever make it in the future while maintaining the code. You are still testing different code, which means that the compiler might exhibit different behavior!
 
And I so don't care about anything Fowler of all people says
 
@Lopsided You can make a room and invite people directly.
 
You verify that your function has the desired side effects (state-based) vs verifying that your function implements the right algorithm (behavior-based). The first gives you less brittle test, the second gives you higher test coverage.
 
who the fuck is Fowler
 
3:02 PM
The guy behind ~~design patterns~~
 
He's more the guy behind refactoring
 
@AndyProwl It doesn't.
 
He likes to invent terminology
 
@R.MartinhoFernandes It does. Sorry, have to leave for a while. BRB
 
yeeey for design patterns, these things are awesome, mainly with the: "Let's try and see if there's a pattern I can fit my problem into." approach
 
3:03 PM
@R.MartinhoFernandes Okay I'll give that a shot. Thanks
 
cargoculting.pdf
 
int f(int x) {
    if(x == 0) return inc(0);
    else return bug();
}

test_f1 {
    test_that_inc(0)_is_called(f(0));
}
test_f2 {
    test_that_the_result_is_1(f(0));
}
// Obviously test_f1 has more test coverage
@Andy
 
@R.MartinhoFernandes Okay so I made the room, but now how to I invite people?
 
Is this Meta Support now read FAQ or something
 
@Lopsided Hmm. Post a link to the room in the comment section?
Like how you would invite someone in real life: talk to them :P
 
3:06 PM
:)
 
@R.MartinhoFernandes test_that_inc(0)_is_called(f(0)); hu?
 
It's... a macro.
Indulge me.
 
lol k
 
Oh buttcoin never change
 
is there really a "semantically stronger" alternative to macros? something that would replace (frowned-upon) macros entirely?
 
3:13 PM
A what
 
@CatPlusPlus hihi
 
@ScarletAmaranth I read that as 'seismically stronger':)
 
Biggest problem with C++ macros is how crappy the preprocessor language is
 
@ScarletAmaranth The very fact that something is "semantically strong" almost inevitably means there will be some circumstance under which it won't be able to act as a (direct) substitute for a macro.
 
AST macros are better in that they're less likely to produce syntactically-invalid code, but if you had to manipulate C++ AST of all things, you'd go crazy
 
3:15 PM
@JerryCoffin right, so Herb's dream to abolish macros as modules arrive (one day) shall ne'er come true...
 
@CatPlusPlus OK, we'll put 'preprocessor macros/language' at 'Hurricane force 12' on the C++ disaster scale. I want 'implicit conversions' at 11.
2
 
@MartinJames hahaha (be star'd)
 
I don't know what removing macros or not have to do with modules
 
@CatPlusPlus I think you should write such a paper
for lulz
 
3:16 PM
It's already written, it's called Design Patterns
 
What the fuck does "semantically stronger" even mean
PP would be a much better tool if it weren't so gimped and arcane
 
@CatPlusPlus Don't know - prob. why I misread it:)
 
yeahhh I used that for the lack of brain capacity better word
 
@ScarletAmaranth The C++ way (at least what I'd think of as the C++ way) is to provide something better for long enough that people barely notice when it disappears. Given that essentially all existing code depends on the preprocessor, it'll certainly be a long time before that can possible happen.
 
3:18 PM
@ScarletAmaranth As an example, here github.com/rmartinho/nux-vomica/blob/master/test.boo#L50 is something I wrote once to emulate Haskell's do-notation in boo.
It's basically an AST transformation. (Code that uses it is at the bottom, last few lines)
 
#ELSEMAYBE
 
@R.MartinhoFernandes this looks interesting, thanks
 
Also Lisp reader macros
 
Aren't Lisp macros unhygienic?
 
Dunno
 
3:21 PM
@CatPlusPlus Modules have little to do with macros. They do eliminate one of the other major needs for the preprocessor (including headers).
 
@JerryCoffin Yes I know that
I was referring to "Herb's dream to abolish macros as modules arrive"
 
@JerryCoffin Header files go in at force 10.
 
Replace PP with T4
 
@R.MartinhoFernandes Are you counting Scheme under Lisp or not? CL macros aren't hygienic though you can sort of imitate hygienic macros with their package scheme (and a lot of care). Scheme macros are hygienic.
@CatPlusPlus Right. My point was that it's more "Herb's dream to abolish the PP as modules arrive." I think it's reasonable in a way: at that point it at least becomes reasonable for a lot of new code to be written that doesn't depend on the PP.
At the same time, it's going to take a long time to truly abolish the PP itself, given the amount of existing code that depends on it.
 
3:28 PM
@LightnessRacesinOrbit ...the point (note the pun) of which is?
 
Expand PP instead of removing it
 
Argh
 
@CatPlusPlus Use the PP to expand itself?
 
Removing headers is one thing, but macros are p useful tool to have
Just make macros respect scopes and also expand the stupid language to something more powerful
 
@JerryCoffin none in particular
 
3:33 PM
@CatPlusPlus I have to admit, there was a time I dreamed of C macros being (even close to) as nice as the macros provided by almost any assembler designed after 1960 or so.
 
@JerryCoffin hahahhaha
 
@ScarletAmaranth You'd settle for keeping up with assemblers from the '50s? So would I, but I always figured when I was dreaming, I might as well have big dreams!
 
@LightnessRacesinOrbit Your profundity is growing.
 
That is a very nice pixel oneboxed there
 
3:45 PM
what
 
@R.MartinhoFernandes Sorry, had to go and will have to go again soon, so just a quick reply. Bob Martin has an episode on Clean Code specifically about the pros and cons of state verification vs behavior verification, and the article by Fowler I linked also mentions that. It is a well-known fact that behavior verification leads to higher test coverage (pro) and higher coupling of test and implementation (con).
Anyway thank you all for the conversation.
 
@AndyProwl If it is a well-known fact, can you link me to some well-known exposition of this fact?
 
@R.MartinhoFernandes I just provided two references
 
Because for me test coverage depends on what I test, not how.
 
(although the episode of Clean Code is not for free)
 
3:48 PM
@AndyProwl Sorry, Fowler's article doesn't mention coverage AFAICS.
 
@CatPlusPlus Yes, he linked it earlier, and now one-boxed it. Apparently Tralfamadorians can stutter.
 
I see test coverage as a tool that indicates whether my tests should cover more cases or not. Consequently, more test cases lead to more coverage.
 
:'( Erlang is being mean to me. (and yes, that does mean I am failing)
@R.MartinhoFernandes getting caught up in improving coverage can lead to wasted effort. You want good tests, not good coverage. Yes they often go hand in hand. And no, I have not read in what context you said that.
 
@R.MartinhoFernandes OK, seems it doesn't you're right, I somehow remembered that being mentioned there, apparently it's not the case. Please bear with the stupid example, but basically if you have a Multiplier class with a multiply(int x, int y) function, you can either test a few combinations of x and y or you can test the internal algorithm, checking that Multiplier delegates to Summer for doing partial sums of y and that it calls it x times.
 
I can see that this testing thing is going to run and run.
 
3:53 PM
If you check state (return value), then you do not cover all the possible inputs/outpus
If you verify behavior (internal function calls), then you guarantee the algorithm will work for all possible inputs/outputs. But now you have the test coupled with the implementation
It's a trade-off
Sorry, my boss is calling me I really have to go
 
Invasive testing sucks
 
@R.MartinhoFernandes but good coverage (in %of your code) does not necessarily mean that you have a good amount of tests.
 
@AndyProwl You might as well just implement the algorithm though. Write the test, have the code generated for you.
It sounds like a ton of duplicated effort.
 
:S anybody else here understand erlang?
 
And also changing implementation makes your tests invalid
Good job
 
3:55 PM
God. Why is Java so silly.
 
Or specify pre/post conditions and run a static analyser.
 
@thecoshman Just ask the question
 
I keep wanting to do C++-like templates and construction of objects using the generic type parameter and I keep hitting this wall that it is only possible using reflection actually.
 
C++-like templates can be found in: C++
 
3:56 PM
And good luck regression-testing that when you have to optimise it.
 
That's p much exhaustive list
 
@CatPlusPlus No kidding.
 
@AndyProwl o_0 you don't test the internal functions. You test that a given input gives the correct output. What functions are used, and what they do internally is not a concern.
 
int f(int i) {return 100/i;} void test_f() { assert(f(5) == 20); } //yay 100% coverage :P
 
Unfortunately, I am stuck with Java.
 
3:57 PM
@thecoshman Would you please go back and read if you want to chime in? I'm sure Andy won't be happy to have to repeat his views again ;)
 
so yeah ok, Erlang. loopy = spawn(myMod, aLoopingFunc, []) <-- that makes a new 'thread' running that loop that I should be able to send messages to using loop ! ~messafy stuf~
 
@wilx That's not really a bad thing
@thecoshman Don't spawn unsupervised processes
 
@R.MartinhoFernandes well, am I getting the gist right of what he is saying? If so, I think he's crazy. Either way, I didn't mean to get drawn in, can I still run away form it?
 
@ArneMertz Bad metrics are bad :P I was purposefully being vague about how test coverage indicates that.
 
But yeah, what's the problem?
 
3:59 PM
@CatPlusPlus Really? It is much harder to do anything if you have to go through so many hoops to pass two parameters to the generically constructed class.
 
@CatPlusPlus erm... I didn't? or do you mean that I should use spawn_link?
@CatPlusPlus I get an no match of right hand side value exception :(
 
@thecoshman I mean you should have a supervisor
 
@MartinJames We haven't covered it enough yet.
 
@thecoshman Oh, right, variables start with capital letters
 
@R.MartinhoFernandes I'm not sure I read the whole thread, but this looks to me like an argument between black-box and white-box testing. Fact is, both have been put to good use for a long time. If you really had to pick only one, white-box seems to be the clear (pun noted but not intended) choice, but by strong preference you want both.
 
4:00 PM
@AndyProwl And for what is worth, no.
 
@wilx What hoops, what parameters
 
@R.MartinhoFernandes dat pun
 
@CatPlusPlus ok, better example would be Foo =...
 
Post actual code
 
@AndyProwl Here, test me this one for all inputs: multiply(int x, int y) { if (y==42) return 1; else return good_multiply(x, y); }
 
4:01 PM
@CatPlusPlus ... I am fairly sure I know what you mean... and fairly sure what I am playing with right now I can just not worry... I can build in 'proper' things when playing with more than just 'write my own loopy thing'
S = spawn(chatty, loop, []).
 
@JerryCoffin Why is white-box the clear choice?
 
Ahaha seriously, you can't test for all possible inputs, you can fuzz but that's not the same
 
@CatPlusPlus Static analysis is pretty much the only way. (And, cough)
 
@R.MartinhoFernandes Because, as Andy's been saying, it allows you access to things black-box simply can't. Although it's rarely looked at that way, you could make a fair argument that white-box is a superset of black-box.
 
4:03 PM
@wilx I have no idea what this is supposed to solve
 
@R.MartinhoFernandes imo ~reasonable~ testing probably would not catch your dirty code. That said, I like to think a code review would pick up on it at some stage :P
 
@JerryCoffin I'd think that black box testing is the clear choice - because you usually want to test that what it does is done right, not how it's done
 
How do you do regression testing with white-box testing?
Brittle tests can't into regression.
 
@JerryCoffin I'd say that blackbox not being to access these things is a Right Thing To Do
 
:'( I don't want to talk about testing
 
4:04 PM
@thecoshman And that line throws?
 
@thecoshman I allowed him to use an excessively simple example for the sake of discussion, and I expect him to give me the same courtesy.
 
@CatPlusPlus The bit between lines 27 and 40 is supposed to be a construction of an object with 1 or more parameters of the generic FileType.
 
@CatPlusPlus :( yeah
 
@wilx XY
@thecoshman Post the whole module
 
@CatPlusPlus k, sec.
 
4:05 PM
@CatPlusPlus The whole point of this was that the code outside the 27-40 lines range is common and vital to be correct.
 
@ArneMertz Then you'd be wrong. Black box says you can't look at the internals. White-box says you can (but doesn't require it to any specific degree). In reality, however, nearly all real testing is grey box, so to speak. The difference is of degree, not kind.
 
@wilx Why do you have to construct the object within that though, if you do setObj anyway
 
You (essentially) always look at internals that aren't visible to the end user, but choose some point at which you've broken the system down into a small enough piece that you do some external-only testing and just trust that internally it does what's obvious and logical. The only real question is at what point you consider those pieces atomic (so to speak).
 
Xeo
bloody hell, walking / standing for 3h is afucking bad idea
 
4:09 PM
@CatPlusPlus Because it keeps the synchronization and bookkeeping at one place.
 
Xeo
and I even missed my physio
 
openFileType(new Whatever(...))
 
@Xeo oh yeah... that. Still a bit tender then I take it :(
 
@CatPlusPlus Because it make the rest of the code shorter.
 
It's seriously this, except with shoehorned generic
No it doesn't
 
4:10 PM
@CatPlusPlus Maybe, I do not know, I am not really doing Java for that long.
I know this is a case of C++ in Java, which does not work.
 
o_0 maybe I don't think Java is that bad because my main comparison is C++
 
Also throws Exception is shitty code
 
Xeo
@thecoshman the first hour was okay, after that it turned bad
 
@JerryCoffin well maybe we mean the same - you just have to define at what level you do the boxing. Blackbox-Testing at class level (meaning Unit-Tests that don't have access to private members of the class) can be seen as whitebox-testing from the application level point of view.
 
Also all those comments are useless
 
4:12 PM
@CatPlusPlus It is either that or oodles of exceptions coming from the reflection API.
@CatPlusPlus Heh, I partially, agree.
 
@thecoshman You're doing something wrong somewhere else
 
o_0 yeah... I restart the erlang VM and now it works..
 
@ArneMertz Not only "can be seen as", but "is". At least IME, you need to look inside a class at least part of the time. It's especially common when retro-fitting unit tests to existing code. It's also true that to the extent possible it's better to avoid that in new code--but given interfaces to things like other libraries and operating systems that weren't designed with testability in mind, there are times that your only real choice is to look inside a class, not just at its normal interface.
 
@CatPlusPlus Actually, no, it cannot be done that way. The problem is that creating the object instance actually opens a file. The file must be opened only once. Hence the code instantiating the object is under a lock associated with the file path.
 
So, you're reinventing OS read locks
 
4:18 PM
@CatPlusPlus Sort of but I am not concerned by multiple processes accessing the file but multiple threads of the server process accessing the file.
 
why must the file be opened only once?
 
oooooh!!! I've been one hell of a nipple donkey.
4
 
I don't see the harm in multiple readers
 
@CatPlusPlus I can't ~just~ reassign rebind 'S' can I.
 
@DeadMG There are possible writers as well.
 
4:20 PM
@thecoshman You can forget variables in the shell but generally no, you can't
 
@CatPlusPlus f(S). to the rescue!
 
I like you guys
 
@thecoshman did you get cppreference to use coliru? Thats awesome!
 
@Crowz Careful about that. Liking people who don't like anybody, including themselves, (you know who I mean) can lead to trouble...
 
4:26 PM
> Powered by Coliru online compiler
 
Why are you pinging coshman
 
he developed.... coliru... right?
 
coliru.stacked-crooked.com
whistles
 
user1804599
4:27 PM
thecrookedman
 
well fuck me sideways.
 
user1804599
StackedCosh
 
@Drise Have you voted for logo?
 
I saw somethign about submissions yesterday, but that was yesterday.
linky?
 
Starboard.
 
4:28 PM
my village is burning down :(
 
Try jumping
 
@DeadMG Turn disasters off.
 
but then the game is too easy
 
I see that a "Mr. Smartass" has voted.
Took long enough.
 
4:31 PM
Everything "lounge" looks wrong.
 
Vote for space logo
 
user1804599
I like Jet.
 
the real problem is stone
you need a lot of stone to build shit and there's no reliable recurring supplies
 
Which game are we playing?
 
I might have to mass more trading posts to attract more trading boats to trade for more stone
Banished
 
4:34 PM
Ohhh yeaaa
That came out this week right?
 
yep
 
oooo I gotta go play now.
 
try buying it direct from dev instead of on Steam
at least here you can save a couple quid on the exchange rates
 
but... Steam...
 
wtb infinite variadic packs
@DeadMG Steam's exchange rates are 1:1 for all currency pairs, right?
 
4:35 PM
What is the native currency of Banished?
USD?
 
Tears
 
lol
 
@R.MartinhoFernandes No.
 
@DeadMG is it worth the wait?
 
@DeadMG Oh, so it's just for USD<->EUR then?
 
4:36 PM
but they're clearly like, "If the exchange rate produces a strange number like £5.60, increase to the next £5 increment".
 
Oh yay, usd
 
holy fuck
I just got fucking owned by a tornado
 
@CatPlusPlus Yeah, USD 19.99 -> EUR 18.99 :<
 
user1804599
When will the logo votes be over?
 
4:38 PM
@thecoshman Yes, that's the statist (classic) viewpoint. Then there's the mockist viewpoint.
 
lost like 200 people
and a bunch of my expensive stone structures
 
Can I post link to question here?
 
@rightfold Friday?
 
@Daniel Be warned, they don't like doing actual c++.
 
@R.MartinhoFernandes Duplication/coupling is the con, yes.
 
4:39 PM
No. no not about that
 
user1804599
@R.MartinhoFernandes ok :3
 
@R.MartinhoFernandes Yes.
 
so much for that expansion I was doing
 
user1804599
@thecoshman I do.
 
@AndyProwl Short of using a static analyser, you can only guarantee it executes the algorithm as specified for the inputs you tried. It can do all shorts of shenanigans for other inputs.
 
4:40 PM
Someone have marked my question that might have been answered on another question, but I feel injusticed...
 
@R.MartinhoFernandes That's the state-based approach
You cannot test all possible inputs
 
wow you guys are still at it :D?
 
Which is why you may want to try (when appropriate/possible) behavior-based verification
 
47 mins ago, by Andy Prowl
If you verify behavior (internal function calls), then you guarantee the algorithm will work for all possible inputs/outputs. But now you have the test coupled with the implementation
 
You cannot test all possible inputs
 
4:41 PM
What does this mean then?
 
period
 
"guarantee the algorithm will work for all possible inputs/outputs"
@AndyProwl It's not. See my example.
 
user1804599
@CatPlusPlus it depends on the algorithm.
 
40 mins ago, by R. Martinho Fernandes
@AndyProwl Here, test me this one for all inputs: multiply(int x, int y) { if (y==42) return 1; else return good_multiply(x, y); }
 
@R.MartinhoFernandes That means that you verify the steps of the algorithm instead of having one big black box.
 
4:42 PM
@Daniel Probably go to meta then. Not here. Not unless you want the wrath of the loungers upon you.
 
@ScarletAmaranth Apparently :)
 
@AndyProwl And, unless you're using a static analyser, you only verify that for the test cases you tested.
 
argh and now another of my villages is burning down
 
user1804599
You only implement the cases you have tested. :v
 
@Daniel what are you 10, shees
@AndyProwl riadna picovina ale toto ^^
 
4:42 PM
You've been warned
 
verify_that_calls_the_right_sequence_of_adds(multiply(10, 20)) will pass for my code above.
 
@Drise thanks
 
@R.MartinhoFernandes You avoid combinatorial explosions
@ScarletAmaranth Ja s tym suhlasim :)
 
@AndyProwl That's totally not the same as "guarantee the algorithm will work for all possible inputs/outputs".
 
@ScarletAmaranth I just think that my question's answer is far from what they have tagged
 
4:44 PM
@Daniel oh no, great injustice! call Batman
 
yeah
haha
 
@R.MartinhoFernandes OK, for many more possible combinations of input/outputs than by doing state-based verification
 
@R.MartinhoFernandes Honestly, I think Cinnibar is the most Wiki/professional looking logo.
And I finished voting.
 
There are two ways of guaranteeing the algorithm will work for all possible inputs/outputs: 1) testing all possible inputs/outputs; 2) performing super smart static analysis.
 
@R.MartinhoFernandes How about -1 and 20? 0 and 40? 2 and 2? Do you test them all?
I'd rather test that my algorithm performs the right steps.
 
4:45 PM
@AndyProwl Does your behaviour testing guarantee they work?
 
Things like that you can fuzz
 
@R.MartinhoFernandes Reasonably so, yes
 
Where's @mooingduck these days?
 
You don't need to poke around implementation details for that
 
@AndyProwl Because I can keep adding ifs to my counterexample.
 
4:46 PM
Because you are sure your algorithm does implement multiplication
 
@AndyProwl ... when called with those particular inputs.
 
and another village burns down :(
 
aaaalright robot and andy, pants down and resolve this once and for all
 
@R.MartinhoFernandes With any input. It tests that you perform y times the summing of x. It does not depend on the values of x and y
 
4:47 PM
@AndyProwl Really? Then write me a test for your multiply function.
 
I'll then implement a buggy multiply and see if your test catches the bugs in it.
 
@R.MartinhoFernandes Even testing all possible inputs doesn't work, unless you're extremely expansive about the possible inputs. The classic example is an encryption algorithm that works fine, except that when it's under sustained heavy load, it sends your data (encrypted with a special key) to the bad guy who added a back door.
 
It'll just test some different code because it's easier
:v
 
@R.MartinhoFernandes I understand you can put effort in making the test not work, but naturally the test will tend to verify that you have implemented the correct algorithm.
 
4:49 PM
@AndyProwl ... for the inputs you tested.
 
As you wish
 
Testing cannot give you insight into the parts you didn't test.
You can make educated guesses that it might work in other cases as well, but that's not the same as "guaranteeing" nor "verifying" them.
 
In general behavior verification gives you greater confidence that the algorithm is implemented correctly by spying into it instead of treating it as a black box. it does couple your test to your algorithm, but it allows you to test units in isolation
 
No, not doing strong coupling allows you to test units in isolation
 
Suppose X calls bar() on Y, and you want to test what happens when bar() returns 42. Are you really going to bring Y to the state that is required for it to return 42, possibly involving interactions with Z, W, T, and who knows what, rather than mocking it and let it return 42?
 
4:54 PM
SO MUCH COUPLING
Mocking is not exclusive to behaviour testing.
 
Can we ditch those stupid Fowler terms
 
8 mins ago, by ScarletAmaranth
aaaalright robot and andy, pants down and resolve this once and for all
 
@CatPlusPlus What stupid Fowler terms?
 
I think this would resolve the argument once and for all
 
State/behaviour testing
 
4:56 PM
It's not Fowler terms
It's a well-known dychotomy
 
Whitebox/blackbox testing tia
 
I wonder who this "tia" person is?
 
@R.MartinhoFernandes So now you're arguing that since invasive testing can only prove the presence of bugs, not their absence (just like any other testing), that it's useless. What's next? Are you going to claim that since its failure to solve the halting problem proves it's useless?
 
@TonyTheLion thanks in advance
 
@JerryCoffin Am I arguing that?
 
4:59 PM
@Borgleader troll detection fail
 

« first day (1229 days earlier)      last day (3737 days later) »