I once read 3 pages of a self help book I received as a present.
It said, essentially, emotions happen for a reason. When you have a difficult emotion, go back to the root thought or observation that caused the emotion, and you’ll learn something important about yourself or your world.
Stopped reading because I wanted internalize that first. Never finished the book...
No, it is an anti-pattern. TDD will get an API, and it won't be the worst possible API. However TDD does not do anything to ensure the API is good.
People who think TDD creates a good API probably have good instincts and a problem where an acceptable API is easy to create. When you have a complex problem that will have hundreds of users (thus it demands not just an okay API but the best) you need to think about the API first. Otherwise you can design yourself into a corner where to fix the API you have to change all your tests.
Once you have the API design in place TDD is a great tool for refining it. You need real working code using an API to sake out all the details and TDD is a great way to figure what you missed. You need a direction in mind first.
TDD does not do anything to ensure the API is good.
Well, what is good? You suggest such an API has to solve a complex problem with hundreds of users. I should think that I've written a few modules with just such an API using TDD methods. So what are we really saying here with this definition?
Your elaboration goes back to the myth I would like to see dispelled as my experience, and that of many others, has demonstrated that it's a bit of a red herring.
When I start a module I don't know what the API should be or what invariant is important or anything. All that test driven development asks is that I first make an assertion about my problem and try to prove that it's true (or not as the case may be).
This leads me to good API designs because the tests invariably contain the assertions about my invariant, they document the API at a high level, and they demonstrate that my implementation is correct as to those assertions I made. If I am thoughtful in this process I know that some assertions contain a quantification over a universe of inputs so I use property based tests to drive my specification. Other times a handful of examples is good enough to demonstrate correctness and so I simply test the units with them. And the API is entirely under my control this whole time. The tests are guiding me to a good API that does exactly what I say it will do by way of executable specifications that cannot be wrong about my implementation (or else the test would fail).
There's nothing in the above that says I cannot take a top-down approach and design my module's interfaces first. Nothing.
Personally I prefer the bottom-up approach for many of the reasons I explained in my OP. I like to define things in small units that I can compose over with abstractions that let me achieve more interesting results. Testing keeps me honest as to the true requirements so that I don't go off into the woods.
Good is in the eye of the beholder. And I was intentionally implying hundreds of users. If - this is the majority of APIs - there are only a couple users it isn't worth the effort to make the API good. When there are hundreds or thousands of users it becomes worth the time to start at a whiteboard and design the API, a few hours up front now can save minutes in the future and those minutes add up.
What you are missing is that TDD gets you to AN answer, but it gives you no information that you got the best answer. TDD does make some bad design choices hard or obvious; but there are other times where that there was a better choice isn't obvious.
Bottom up and top down are very different design considerations. You can get bad APIs in either one. You can do TDD with either.
I'm a fan of TDD and use it. However I'm not blind to the limits.
If what you're saying is that TDD can guide you to a good design but it doesn't guarantee it then I think we're in agreement there.
When working on protocol specifications and proving the correctness of a certain invariant or property of the system I find TDD to be lacking and tend to turn to formal methods for results.
However at the module/interface level of an individual software library or component TDD is a very good tool that helps guide me towards a good design. As do other tools like a sound type system. When they work in concert the system almost writes itself -- I just have to come up with the queries, invariants, and assertions.
I really struggle to run Lightroom on my 8 GB Macbook Pro.
To be fair, Lightroom and Photoshop have an excuse: dealing with 20+ MP photos is memory intensive. Atom doesn't: dealing with 2 MB text files is not hard.
I remember this as well. I simply just avoided going to the bathroom until I got to the hotel, they usually have western toilets inside.
You haven't really experienced a squat toilet until you've had diahrrea though (pretty common for people travelling abroad for first time / not used to differences in bacteria culture / not taking food medication).
- Do we even have a way of measuring serotonin levels in a live human (as opposed to a dead lab rat[1])? Remember, we're trying to measure serotonin levels in the synapses between neurons in the brain (serotonin is a neurotransmitter, so its levels anywhere else in the body probably wouldn't matter), so you can't just draw someone's blood and test it. If the measurement involves drilling a hole through someone's skull, you can be sure it hasn't been done on lots of people (no ethics board would allow that experiment, even if you could find non-depressed people to volunteer for it). If it requires injecting people with radioactively tagged serotonin precursors and scanning their brains, it probably hasn't been done on a lot of asymptomatic people (risky and expensive).
- Assuming we can measure serotonin levels in humans, how do we determine whether someone's level is "low"? Does "low" mean "low compared to the average of non-depressed people"? Does it mean "low compared to the level the patient had before they became depressed" (if so, how would we know their baseline levels)? Levels of many chemicals (hormones, glucose, sodium, etc.) vary significantly between "normal" individuals.
[1] We can't talk to a rat to determine whether it's depressed. We can only observe certain aspects of its behavior, like appetite and activity levels, which we assume are proxies for depression, but could be due to unknown factors. We don't really know if rats have evolved to become depressed the way people do.
IIRC, the current consensus among the psychiatric community is that SSRIs do work but no one actually knows what mechanism could explain their effectiveness. The one thing that is known for sure is that it doesn't come down to simply high vs low levels of serotonin because while SSRI treatment immediately raise serotonin levels the therapeutic effect takes some time to "kick in".
I also recall reading that SSRIs have been found to be more helpful against anxiety than depression.
Aqua-farming shellfish is the closest thing to free protein we're going to get.
My folks are involved with farming mussels in New Zealand. The farms are in a river mouth, putting the nitrogen and phosphate runoff from farms to good use. The phytoplankton they eat is replenished 500m down-current from the mussels.
There's one major risk - the 'spat' - the baby mussels used to start a vertical mussel line - are harvested when they're washed up on a beach. Sometimes, there's no spat and no one knows why. The concern is that climate change will result in less, or no spat, and then no more mussel aquaculture.
My biggest concern is that along with the nitrogen and phosphate runoff come pesticides and other less savory compounds that then bio-accumulate in the farmed shellfish.
It depends on whether or not they bioaccumulate^W -- checking wikipedia apparently the word I want is biomagnification.
The basic idea is that as you move up the food chain the concentration of toxins gets higher. So a plant might have a relatively low level of toxin absorbed even if it was directly applied, but a shellfish that consumed algae that were exposed to the toxin downstream from the farm might have a considerably higher level.
I don't know a whole lot about the details in this specific case, but that's my concern.
I visited a farm in British Columbia about ten years ago that was raising bivalves (geoducks I think) and they'd worked out how to raise them all the way from fertilization through all the microscopic stages. In retrospect, they probably had to do that because clams aren't polite enough to attach to something, en masse, that you can collect on the beach.
Is because baby clams have a lot of predators, specially crabs and starfishes, so they mums either nurse it under the shell, or try to spread it for the widest area possible.
Honest question: How does that scale up? At first guess, I'd imagine there's insufficient area in (non-polluted) river mouths to create a large enough sustainable supply for world-wide demand.
Why does it need to scale up? I think scaling up is what caused problems with our planet, we need to start thinking locally.
For Connecticut, this is a local issue (too much Nitrogen in the sound) and this is a local solution that not only _reverses_ a problem, but produces real food and economy.
This economy doesn't have to be at scale, other places on this earth have different problems and require different solutions.
We need to work with nature, not against it. Let nature do the work. A healthy natural system is the true meaning of wealth in this world, it works without ANY human or oil expense. A fly-wheel system that generates money without effort.
Reference: http://www.ct.gov/deep/cwp/view.asp?a=2719&q=325572&deepNav_... | "Each summer, the bottom waters in the western half of Long Island Sound experience hypoxia, or very low levels of dissolved oxygen. Extensive monitoring and modeling of Long Island Sound have identified the excessive discharge of nitrogen from human activities as the primary pollutant causing hypoxia. "
>> Aqua-farming shellfish is the closest thing to free protein we're going to get.
I think biomanufacturing of protein via bacteria/algae could be the cheapest. For example there's even a company, prottero, making sugar via bacteria at 1/3 of the cost of sugar cane.
And theoretically with those of methods , you might be able to feed the world from an area the size of new jersey.
I once read 3 pages of a self help book I received as a present.
It said, essentially, emotions happen for a reason. When you have a difficult emotion, go back to the root thought or observation that caused the emotion, and you’ll learn something important about yourself or your world.
Stopped reading because I wanted internalize that first. Never finished the book...