8,634 karma · joined Jun 23, 2011 (15y ago) · 7,679 submissions
comment 3y ago · link · parent
comment 3y ago · link · parent
Any time I thought I could shortcut my way to a demo by relaxing on perfect code/maintainable code it has always ended up taking just as much time and often longer.
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
What's addicting about it? Admittedly it kept me entertained the first day or two that I used it, but from that point forward it never wavered from the content that entertained me that first day and soon it became really boring to see the same type of thing over and over, leaving no remaining appeal.
Because everyone talks about how great the recommendation engine is, and me wanting to find great content, I went back to it after a while to see if they fixed the problem. But no, still the same content that bored me away from the app the first time.
comment 3y ago · link · parent
That's the source of fear I mentioned earlier, being sold this idea that the only way to get a job is to go to college and if you don't 100% focus on college you won't make it. But there is nothing in the data to suggest that idea actually panned out. All signs point to young adults having a much harder time moving up because they didn't work in their youth to gain the experience necessary to navigate the waters of the economy.
comment 3y ago · link · parent
Even in this small town (~2,000 people) in which I live I have almost no reason for a car. Everything I need is in comfortable walking distance... Other than family and friends who live in other places that I like to visit from time to time.
When I was young there was enough economic hardship around that people had to disperse to make a living, leaving those social ties I established all over the place. With the strong economy we've been living for a number of years one has been comfortably able to stay put; living a great life anywhere they want. Now everyone in your life is able to remain close. If I could walk to their homes, that would certainly remove the last reason I keep a car. The younger people have that option.
I wonder if that's what has changed?
comment 3y ago · link · parent
Is it because of this intense fear of getting a job that was starting to emerge when I was young and seems to have really taken off since?
comment 3y ago · link · parent
comment 3y ago · link · parent
Only around the property of income, seeking a state of stagnation. If your boss is now whipping you to keep you in line where he previously wasn't, that would be beyond their purview. There are supposed to be other organizations to control for those concerns.
comment 3y ago · link · parent
Software is expensive. But do tests increase the cost?
In my experience adding tests to a legacy project not designed for testing is never worth the cost, but a new project designed with testing in mind can be developed significantly quicker having tests providing valuable data about the work in progress.
comment 3y ago · link · parent
If you have some reason to choose C today, I'm not sure Rust is a contender to stand in as a replacement. They are vastly different languages. That doesn't mean there is rejection that C's memory model is unsafe, just that there isn't a "better C" recognized to choose from.
comment 3y ago · link · parent
As long as it hasn't intensified, I guess. If you start getting a lot more recruiter spam then you'll know that the jobs are few and far between. The easier it is for employers to hire the picker they'll be, which makes things much, much harder for recruiters to find a good fit and more pressure to be the person responsible for filling the position to keep their own job.
comment 3y ago · link · parent
Quite likely given the exact example we speak of. Not likely for all cases.
> You will likely not propagate those to the end user, but log and return a single error for many of those cases
Agreed. But your code still has to get there and, unless you've given up on testing, test that each of those potentially hundreds of error states leads to the single error response with the appropriate log that you expect.
If you don't put any thought into testing upfront, this is where you can quickly end up with a mess that does really take too long to add testing to. And let's face it, those without much testing experience don't know much about what could be done to not create such a testing nightmare. I see it time and time again.
No need for religion. Do whatever you want and if you understand the tradeoffs are no doubt you are better off for it. But a lot of developers without much experience don't understand the tradeoffs.
> You write the tests to make sure your app conforms to documented behaviour.
Yes, exactly. And the document that documents said behaviour is.... Your tests. Not a bad practice to have additional documentation on top, but the tests will ultimately be your source of truth. They serve as the documentation that the code is tested against.
> Tests, and especially the way most practices propose tests should be written, could not be farther from documentation.
Go on. Are you creating your own unusual definition up on the spot here for the word documentation or is there something more profound in here?
> So you have fabricated this idea that I am ignoring something and is now attempting to make me defend this fabrication of yours.
I have observed this idea that you are ignoring what I've written. It's right there. I write something, you immediately reject it without any curiosity and then go off on some unrelated tangent that has nothing to do with what was said to justify your rejection. It is quite curious.
It could be that you simply don't understand, but normally when people don't understand they want to learn. Education is usually considered a desirable quality. Which left me wondering if this behaviour is some kind of defence mechanism to see that you don't gain any insights into other ways of working to protect what you feel is best?
comment 3y ago · link · parent
TDD is most useful when you don't know what you are getting into. It allows you to quickly run small experiments against your hypotheses to see if the fuzzy thoughts running around your head are useful or need to be thrown out. The data gained from those experiments is what drives your development decisions.
If you already have everything already figured out, what more data do you need?
comment 3y ago · link · parent
They may have negative value, but it is not a foregone conclusion. Tests are merely documentation and that documentation very well could provide positive value for someone who reads it. There is no doubt insights to be gained in reading about what someone was once thinking about a particular problem. If well thought out, you might even begin implementation based on that work, saving time having to document it all over again.
comment 3y ago · link · parent
Most likely hundreds. Each individual external service will easily have tens of conditions (a multitude of invalid input states, a multitude of malformed response payload states, a multitude of expected upstream error conditions, network interruption, port exhaustion, expired/invalid certificates, failed authentication/authorization, timeouts, etc., etc.) and when multiplied across them it won't be long before you have hundreds.
> Tests are not written to document behaviour, but to validate that your program does what it's supposed to do
A common misconception, but no. Tests would serve no purpose if you had no reason to document expected behaviour. Correct that tests also allow the machine to validate that what the documentation says is true, solving for the problems of the past where documentation and implementation would regularly fall out of sync. That is, indeed, the value proposition over writing the same information in Word instead.
Your documentation doesn't end there, of course, just as the documentation provided by a static type system is not the be all and end all of your documentation. But documentation it most certainly is.
> Existing testing practices all but enforce writing useless tests
The invented practices you have presented throughout the discussion no doubt lead to writing useless tests. It is, however, not clear why you hang on this invention of yours – outright ignoring what you are being given. Is it some kind of defence mechanism to protect the methods you have developed for yourself?
comment 3y ago · link · parent
Even in the simple example given, there are probably hundreds of different failure cases to account for. The "correct data being returned" will never be a single attribute unless your application does effectively nothing.
> wat?
The successful case is usually the most understood behaviour, most visible, and easiest to recreate. If you are going to skimp out on documenting some aspects of your code because you hate future developers, the most understood aspect is where you are best to skimp.
> So again you want me to write a meaningless test that will be duplicated anyway during the actual proper test.
No. Why would you write the same documentation over and over again? This makes no sense.
> This is a weird statement that is definitely not backed up by reality.
It is certainly backed up every time I have worked with developers who put no effort into making their code testable, making it way harder than it should be to test certain cases afterwards. And in my experience they usually just throw their hands up in the air and say "testing takes too long" after they've made it unnecessarily hard to test.
Is it that you always work alone? If so, I can see why you think documentation isn't that useful. If you have a decent memory, it probably isn't. But most people have to work in teams or are in positions where they will one day be replaced and aren't writing documentation for just for themselves.
After all, that's what TDD – and, really, testing in general – is all about: Documentation.
> The problem is, everyone advocates writing multiple useless tests
Nobody advocates writing useless tests. Future readers should be able to learn something useful from every documentation item you write. That your function will return "retry after" when an upstream service is temporarily unavailable is very useful information for users and future developers to know. This is worth documenting.
You will undoubtedly need to write multiple tests. Nobody wants to read documentation that is one big ball of mud. A sane developer will break different cases into different tests to help future readers clearly understand that there are different environmental cases, like the range of failure states, to consider.
comment 3y ago · link · parent
comment 3y ago · link · parent
Whatever you want. Just pick some small attribute that you expect to observe.
I'd personally start with failure modes as they are the most important and interesting code you will write. Hell, you can likely not even bother testing the so-called "happy path" because, really, who cares what happens during success? Failure is where you want users and future readers to have the most documentation to ensure that when things go wrong the metaphorical bridge doesn't come crashing down into the river but rather remains in a repairable state.
If it's a REST endpoint that aggregates data from multiple external services, you probably want to see a "retry after" response sent to the client if any of those external services are temporarily unavailable. So write a test that asserts that, then write code that does it. This is also a nice first case as you can detect an unavailable external service quite early in your pipeline, requiring very little of the implementation to see the test pass.
No need for religion. If documenting your code later works for you, go for it. Nobody cares. Tests won't be driving your development, so it won't be TDD, but it'll be something and that may be enough. However, in reality most people simply don't have the wherewithal to plan for things like being able to test unavailable remote services if they don't have a test case in front of them forcing them to and won't bother when it is too hard to add later, so there is something to be said about the TDD approach as a general rule, deviating only after you fully understand the tradeoffs.