The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
Interesting you should say that. I was trying to explain to someone that the change in earth's atmosphere that is (likely) to be in progress, when viewed from space, is rather trivial. The disruption to the new steady-state, just a brief instant in that cosmos.
For us mortals, with our short lives and dependance upon a somewhat narrow range of conditions to derive most of what we need to survive, it could become pretty lousy.
Like the current nasty cold wave in US: it's not the earth that's any cooler but a redirection of the jet stream letting in Arctic air. Why is the atmosphere doing this? Partly, it will happen now and then, anyway. The question is will this, and similar changes, become the norm (at least during our lifetimes).
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"As far as we know, our computer has never had an undetected error." - Weisert
"If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
And unrelated, I finished by F# "From Imperative to Functional Programming" e-book last week -- it'll be out on SyncFusion's Succinctly series site (free to all) once the editing gets done (last time it took a few months!)
I started reading your Unit Testing Book yesterday, we have a lot of unit tests here, there is a lot to be desired and we are rethinking how they are implemented. Hoping to gain some insight.
I've only gotten through Chapter 2, but the thing that strikes me most... is we lost track of 'how to code' and so the unit tests are lousy as a result. For instance... our methods got very complex and lost sight of the "do 1 thing and 1 thing only". Unit testing seems to force you into a certain mindset when you start out the coding.
I have a question though, if most methods are refactored to do 1 thing only, then the high level methods are more "correct" by virtue of calling tested units and being simple. BUT... is there still a value to testing those methods which call into the simple units, or is that left to the QA department's functional testing? The underlying question here is, will that affect my code coverage metric adversly?
BUT... is there still a value to testing those methods which call into the simple units, or is that left to the QA department's functional testing? The underlying question here is, will that affect my code coverage metric adversly?
And that is the $20,000 question. Here's my 2c:
OK, let's say you are ultra-super disciplined and your lowest level methods don't have any conditional logic, no looping, nothing but "here are the inputs, here's the output." So that's the Holy Grail of unit testing not necessarily doable or meaningful.
The second level is that we allow some basic conditional logic and some basic looping. OK, now the unit tests are a little more meaningful and still "controllable" in that we can usually provide all the test cases to test each branch and iteration / recursion, as long as the functions are small enough.
What then? Well, can you organize your higher order functions somehow? For example, those that simply perform a workflow. It's easy enough to write a unit test that the workflow does what it's expected to do. What about more complex conditions? Those are unit testable too -- again the idea is to keep the functions small so that there aren't too many branches that need to be called. And furthermore, and most importantly, branches should not contain any statements other than a call to function to do something on that branch. No nesting, no inner looping, nothing but if-call-else-call. Rinse-and-repeat as you go up the food chain, keeping functions with conditionals and looping small, realizing that you don't need to test the lower level calls, only the higher level results.
At some point, the cost of unit tests becomes too high, which is a good time to switch over to the "if it broke, write a unit test first to recreate the problem" mode. That way, it's really cost effective -- you're fixing only known bugs and adding to your test suite.
Unit testing seems to force you into a certain mindset when you start out the coding.
I had a car swerve in on me and attempt to hit me and I was cited (as a cyclist) I now have my go pro on universally. Unfortunately, most police don't like bicyclist either. Now that I am go pro'd and lawyered up I can finally cycle without fear.
I'm pretty sure the camera won't do anything to reduce the risk of someone in a car or truck running you over. After the fact it might help your estate sue the moron for everything he owns, but you'd still be pushing daisies.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt