« first day (1026 days earlier)      last day (2973 days later) » 

1:01 PM
@nhgrif rubber duck, shirt, car stickers
 
Zak
@nhgrif IIRC, Shirt, Duck, Stickers.
 
My pack had a Tesla inside it
5
 
Just wanted to check... having a unit test that performs a real API request with HTTP, that's not best practice, right?
 
Correct.
You should be mocking.
 
That's what I thought.
 
1:07 PM
@SimonForsberg that is no longer a unit test but - at the very least - an integration test
 
Right.
Hmm... integration test... I was jut about to ask "what if the HTTP API changes?" but I guess that answers that question.
 
If the HTTP API changes your test should break :p
 
The distinction unit test / integration test is not very interesting / useful ime.
IO should be mocked though.
 
It's a distinction nonetheless, and it's kind of important.
 
Unit tests test units. Integration tests test the integration between components. That's a pretty important distinction.
 
1:10 PM
@DanPantry Not a unit test.
 
@nhgrif He said "integration test" in the same line, so I assumed he meant integration tests
 
@DanPantry the integration test, yes, or end-to-end tests, but the unit test should still work, as the response has been mocked.
 
0
Q: Get AD Users' Latest Last Logon Dates across Multiple DCs

JohnLBevanI was recently asked to help our Spanish BU to audit their AD for inactive accounts. Grabbing a script from online I gave them this: https://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-User-bbcdd771 However that doesn't scale well when there's multiple users; as this takes o...

 
My mistake, then :)
 
@DanPantry Both are means to find bugs. I've heard people get religious about such things.
 
1:11 PM
No they're not.
 
I find myself using integration tests more.
 
Both are means to prevent regressions.
 
But these integration tests.... should they be JUnit and runevery time you build your project, or should they be run less frequently as part of something else?
 
Your tests should be a pyramid. As you go down the pyramid, the number of tests for that category should increase.
End to end tests are at the top. Integration tests are in the middle. Unit tests at the bottom.
@SimonForsberg Integration tests are not guaranteed to be 'fast'.
So, in an ideal world - that's build server material
 
1:12 PM
One difference that can be important is if integration tests are much slower. Then it makes sense to put them in a category to be run separately, for example nightly.
 
@JohanLarsson I normally prefer integration tests, but in this case I feel like my tests shouldn't perform an actual request to a service to close a ticket..
 
Yep, mocking the network call makes sense almost always.
 
It boils down to this: tests should test one thing and one thing only.
 
For stuff like parsing unit tests is a sweet match.
 
And fail for one reason.
 
1:15 PM
For eventdriven application code I find ~integration tests~ more useful.
@nhgrif This is nice but not a goal above all.
 
It's not really a case of finding X or Y thing more useful, in the same way that I don't find an airplane cockpit less useful than an airplane seat
They serve different purposes and you don't need as many of one as the other
 
types > tests > fail fast > not failing fast > swallowing
 
If your tests fail for more than one reason you either have bad tests or bad code
*shrug*
 
Strange view imo.
 
It's not. If one test can fail for multiple things it means you are testing for multiple things in one test
 
1:17 PM
Easy to write things with nice coverage that does not work when put together, pretty common also probably.
 
@DanPantry Exactly. I didn't say two things. I said one thing.
Tests should test one thing. If they're testing one thing, they can fail for just one reason.
 
Either that means that your system under test does too many things at once (and that makes it hard to test and brittle) or your test is doing more than one thing (which means you'll likely miss edge cases, at the very least)
 
This is a funny chat.
 
Let's take some of your tests for example from one of your projects you posted here
    var command = new AsyncCommand(() => Task.FromResult(1));
    Assert.IsTrue(command.CanExecute());
    Assert.IsFalse(command.CancelCommand.CanExecute());
    Assert.IsInstanceOf<Condition>(command.Condition);
You're making 3 assertions here in a single test case
 
are you after one assert/test?
 
1:20 PM
At a unit test level, definitely
 
I'm not gonna stop you from doing it, ping me in five years and tell me if you still do it.
 
This should be split into two tests (I'm not sure the IsInstanceOf one is useful, but if it is, that should be another test too)
I, admittedly, am not as experienced in software as you might be.
But @nhgrif is probably on a par, and the vast number of resources online indicate that one assertion per test is ideal.
 
You don't see a problem with the massive bloat it creates?
@DanPantry Not a problem, your view is very common, I'm not saying it is wrong but I find myself moving away from it.
 
If you have a lot of tests for a single class you should probably break the class up.
 
I'm not saying one assert per test necessarily.
I mean, depending on what you mean by that.
 
1:22 PM
One assertion per test is probably not the thing to go for, but it's an easy way to say "This is only going to fail for one reason and one reason only"
 
But what are you gaining from it?
 
well, I immediately know what is wrong
 
You are running every test automatically on every commit to develop
 
Regression safety.
 
Fixing the test is much faster as the test points you to the problem exactly
 
1:23 PM
The test you have points you to one of 3 problems
 
If you have one test with 10,000 asserts, it can fail for 10,000 reasons and you have 100% failure rate. And all the build server tells you is which test failed.
 
Downside is much more code, test code must be maintained and it creates an inertia when refactoring.
 
It's not helpful for the build server to tell you that the one test with all of the asserts in it failed.
 
@JohanLarsson Test code must be maintained anyway
 
1:24 PM
If you have 10,000 tests, and one fails, it's easy to know immediately what failed.
 
And why it did.
 
Ultimately there is a balance to strike with what you find productive and what you don't
 
@JohanLarsson Your refactoring, generally, shouldn't be touching the public interface of the code most of the time.
And if you haven't touched the public interface, you don't need to change your tests.
 
1
Q: My First JavaScript Project [WebTorrent]

ndm13I have been working with HTML5 and CSS3 for a long time now, but have avoided JavaScript because of my belief that it's most frequently used unnecessarily while having a tendency to be poorly written. So I held off until I needed to learn it to use something really cool and useful. The project ...

 
If you don't find having one reason to fail per test productive, great, that's fine.. but remember that one of the tenets of good software is each class having one reason to change/fail. If you're having to have more than one assertion to test - or have "test bloat", you're either making brittle code or violating SRP
 
1:25 PM
@DanPantry That is why I advocate keeping it reasonably short, like in the code you linked. With three asserts we reuse the setup code.
 
Which highlights the advantage of tests... If you are satisfied that your tests cover all of your acceptance criteria, you can refactor out from under it with the comfort that your automated tests handle the acceptance criteria.
 
@nhgrif True for libraries, not as much for application code ime.
 
@JohanLarsson Define "application code"
 
@nhgrif It is helpful as it points out a bug. And the output points to the line with the assert.
 
Full disclosure, I am a very highly paid professional iOS application developer.
A unit test will never find a bug. It can only find a regression.
 
1:27 PM
Let's say you're making a WPF application or some kind of application with a user interface
 
I am talking about testing for end-user applications.
 
Sure you can't really unit test the glue between your system code and your interface code (that's integration)
But you can unit test everything else
@nhgrif I was replying to @JohanLarsson when he mentioned "application code"
 
I was talking to him, not you.
 
The point being that aside from glue code, you can treat your business logic etc as a library
@nhgrif lol
 
@DanPantry If you write a line of business application for handling payments. The code that produces the exe is application code in my definition. If you write a general purpose tool like an IoC-container I classify it as library code.
But I'm esl.
 
1:28 PM
@JohanLarsson I'm a JavaScript developer, while we don't have exes, we generally have two projects in applications. We have one 'library' project which uses many modules etc and is tested. Then you have another project that puts it into something runnable.
Example, I build a user interface using React in one project. This stuff doesn't actually touch any real itnerface, it's just functional code, so I can test that.
Then I have another project that actually renders those actions into the DOM, or a HTML string, or.....
But everything else is testable and for all intents and purposes could be a library that could be re-used
AFK lunch
 
In my current code base for my very really project for the iOS app store, there are exactly two things that are hard to write good tests for...

1. The very thin Objective-C wrapper over a C++ library (the C++ library has its own tests and is outside the scope of my concerns).
2. The very thin layer of user interface code (which is tested with functional UI tests).
There's a lot that goes in the middle that we test with unit tests.
 
@DanPantry What I said was that in my experience refactorings tend to affect the public API more often in application code than in library code.
 
@JohanLarsson If refactoring is likely to effect the public API, it's generally going to be because the public API has problems. And if you really took the time to fully test that public API in the first place, you're far more likely to notice the interface's problems while writing the tests.
Not a guarantee, but a very high likelihood.
 
We usually don't start to add high volumes of tests early in a project, we think of it as a prototyping phase where things tend to move around much.
Downside to that is that there is a risk that the tests are never written of course.
 
Which results in not enough tests ever being written
and the rest of the project being built on top of a core of code that's not tested or not tested well enough
 
1:35 PM
SRP is a nice for lessening the refactoring pain. Classes doing only one thing an composition tend to lead to less need for fixing setups.
Nice for other reasons also.
@nhgrif Everything I write has problems as my attitude is that things can always be cleaned up and improved.
Also there is entropy.
 
I'm not saying that I think I write perfect code, or even that perfect code can be written.
Although, the less a thing does, the closer to perfection it is probably.
 
yes agreed
 
But, writing tests and having to change those tests when you change the interface is better than not writing tests at all...
 
@QuentinPradet 6 hours left ^^
 
1:38 PM
It's still less time spend working on that code than had you never written tests at all (unless you are writing perfect code).
We write tests because we don't write perfect code.
(nor do other people who work on our projects with us... especially them in fact)
 
Perfect code still requires tests, so it remains correct.
Also tests are nice if parts need to be optimized.
 
Got my little rubber duck sitting on my desk at work :D
5
 
Also, it's worth mentioning that tests are an excellent way to document the intended usage of the code.
 
yep +1
Documentation that does not get outdated
 
Or if it does, it tells you (since it will no longer pass)
 
1:42 PM
Rust has a nice feature that allows for compiling code in comments
 
*squeak*
5
someone remind me how I sort for newest, unanswered questions in a tag
I seem to only be able to pick 2
newest unanswered questions,
unanswered questions in tag,
and newest questions in tag
also ?sort=unanswered booooooooo stackexchange
6
that's a filter, not sorting
 
Zak
I don't believe you can (at the very least, I'm not aware of anything that would allow you to do so).
 
@DanPantry I feel like I phrased something poorly sounding aggressive. Did not mean to belittle you. Still think the ping me in five years is a sensible way to think of it. I expect/hope that I will be doing many things differently in five years. A critical attitude always trying to improve is a good mindset. What does x buy us? What does it cost? Can we do it in a better way? For all things.
 
@Pimgd Try this:
SELECT
  Id AS [Post Link]
FROM Posts WHERE
  PostTypeId = 1
  AND AnswerCount = 0
ORDER BY CreationDate DESC;
 
1:53 PM
@JohanLarsson No offense taken, it was an honest admission from my part (and not triggered by anything you said). I am fully aware that I have strong opinions that I may come to regret in time for someone so inexperienced (relatively) in programming :)
 
@EthanBierlein AND is != "closed"....?
 
Monking, BTW
 
With great power comes great responsibility — Dog eat cat world 23 hours ago
 
Just had to add AND ClosedDate IS NULL
 
@Pimgd what about is:q [tag] answers:0 closed:no
2
 
1:57 PM
@DanPantry Strong opinions is nice, the alternative is sad. But it requires watching out for the religious trap perhaps.
 
@Vogel612 ding ding ding ding
it's a winneeeer
 
it doesn't include the actual definition for unanswered though..
 
It doesn't but it does get closer to what I want
 
that would include questions with answers, where the answers have no votes
 
which is, you know, seeing the posts properly
so I can click and answer the ones I find interesting
 
2:01 PM
Agreed, making a new project is like heaven compared to migrating this mess of an app from eclipse to android studio without making any logical directory structure changes. Old problem of having too many independent devs working on the same project without code review.. — Ryan Stush 53 secs ago
The use of bitwise operators is generally forbidden/frowned upon in the common JavaScript coding standards. So if you're using a linter (jshint, eslint etc.) chances are you won't get this through code review. Solution works though. — jhrr 36 secs ago
 
@Pimgd Okay, here's the final query: data.stackexchange.com/codereview/revision/441013/561520
You should be able to search unanswered questions by tag.
With them being ordered from newest to oldest.
 
@EthanBierlein Invalid column name 'performance'.
 
You have to put single quotes around it.
 
userfriendlyness--;
 
I also just realized that it isn't working either, so just stick with the other solution.
 
2:06 PM
You get stars for trying =)
just like in preschool =/
(some of my commentary may be unintentionally belittling)
 
That's okay :)
I have a feeling it may be something screwy on SE's end.
The query should provide the correct results according to the conditions, but for some reason it doesn't. :|
 
like... legacy code?
chat needs a creepy font
 
Greetings, Programs.
 
0
Q: Single Flag Only Enum (RestrictedEnum<T>)

FatalSleepThis class simply allows you to use an enum while only allowing you to set a single flag. If multiple flags are set they will be rejected--unless the total of the combined flags is the same value of an existing flag. Such as Flag1 | Flag2 == Flag3 would be an example thereof. C# 6.0: public cla...

 
@Donald.McLean Greetings, User.
 
2:17 PM
Is there any way to change the font of individual chat messages?
 
<div class="content">Is there any way to change the font of individual chat messages?</div>
css rule on content, maybe?
also, we're doomed
Uncaught ReferenceError: StackExchange is not defined
 
@EthanBierlein you need to join in the Tags table via PostTags
 
according to my console, the world isn't real
3
 
@Phrancis Ah, that's right.
It's been ages since I've used the SEDE.
I'm starting to remember why I stopped using it now.
 
2:29 PM
0
Q: Creating a matrix

user3667111So I have code to create a matrix, in this case it's limited to 3x3 public void insert(DatagramPacket s) { // 00,01,02 // 10,11,12 // 20,21,22 //System.out.println(x + " " + y ); if (y == 3) { y = 0; } if (counter <= 2) { //3 ...

 
monking!
 
ducky ducky ducky ducky
the only thing I don't like about it is that the hole for air is at the bottom, so the natural squeezing position doesn't squeeze because you're blocking the hole with your hand
</duck-review>
2
 
Hey, I received my swag today.
 
@EthanBierlein here is how you have to do it if you want to use the Posts.Tags column (which in the background is really plain text, but that is hidden because of the magic SEDE rendering of tags) : data.stackexchange.com/codereview/query/441034
 
@Phrancis Thanks. :)
 
2:35 PM
@Donald.McLean If you use userscripts you could hack around with it, but vanilla it doesn't.
 
@Mat'sMug monking!
 
@Pimgd Squeeze sideways.
 
@Mast I have big hands it feels unnatural
 
I've got my swagduck as well :D
It's at eye-height on my desk, so from time to time it's a bit creepy
 
2:37 PM
edit, delete, DELETE!
 
I hate that whoever made this webapp put the delete button right next to Details
 
oh it says details?
 
@Phrancis Is there a... confirmation message?
 
@skiwi "Your hard work has been successfully confirmed to have been deleted".
 
And if you click delete, you only get one chance with confirmation, if you are not paying attention and click OK it DELETES THE APPLICATION FROM PRODUCTION
 
2:39 PM
@Phrancis Blame the one who made that application when it happens :) Right?
 
Correct
 
also if you squeeze your duck too much you get a very rubbery smell around the office
 
@skiwi Still, I wanted a mug :(
 
@Morwenn that's why you got a sticker
 
I kinda wanted a mousepad actually :P Oh well, can't get all you want ;)
 
2:42 PM
@Pimgd My dishwasher doesn't agree.
I wanted a car.
 
yes I asked and the response was
The stickers are printed on vinyl and laminated so they should hold up pretty well. That being said, I would not recommend putting them in the dishwasher. The stickers are also removable/repositionable, so my guess is they have the potential to come off during a car wash/dishwash. — JNat ♦ Jan 21 at 17:56
so I guesssss you could take off the sticker, wash it, then put the sticker back on...?
 
Or, handwash the mug
 
Also, for the clever types in the room, do not put stickers on your mug, put them on your cup instead
CR stickers don't work that well on your forehead
5
(I think)
now all we need to do is come up with an evil plot for more swag
 
reach 100k
 
@Pimgd
 
2:46 PM
@Vogel612 reach 100k?
wait, they did this on SO, didn't they
 
repz
 
oh snap
that'd be pretty darn soon
about 4 months?
 
Gold beginner :D
 
but on PPCG
they're also getting close to 100k
 
We got ourselves a contest!
Canada vs Germany
Code Review vs Code Golf
 
2:52 PM
Go Canada Code Review!
 
... I just realized this was a bad idea =D
 
Vive le Québec libre !
3
 
lol
 
what with the tendency to, you know, incite serial voting
 
Zak
Very very cool infographic: qz.com/296941/…
 
2:54 PM
@Pimgd don't forget serial downvoting on the other site ;)
 
that's why it's a bad idea
 
Nah, we're the good guys. We don't downvote out of spite.
@Zak Wow, nice indeed.
 
@Mast strange that the "good guys" are always the one who wins the war
 
@chillworld that's because if they don't, the universe gets a game over and has to start over from an earlier savepoint.
(completely oblivious to any political remarks)
 
2:56 PM
@Pimgd mhh that's also a nice possibility
 
@Phrancis Far less than before :p
 
@Phrancis 229.47 rep per month, I should write more posts...
 
^^yes
 
638.16 rep per month
doing fiiiiine
 
I'm back to
 
2:58 PM
In all fairness, the first months I got next to nothing. Had only one question here for a long time.
 
Yeah, averages need to be evaluated with a grain of salt, for sure
 

« first day (1026 days earlier)      last day (2973 days later) »