OK, given the audience, maybe those last two are a bit of a stretch, but you've probably never heard of them, and if you have, you've rarely thought of them.
Take one (1) happy bacterium floating in a pond, or your sink, or a drop of water on your shower curtain, or the saliva in your mouth. It's free swimming. It may have a handy little flagellum that is uses for tooling around, avoiding bad environments, seeking food, doing its little buggy thing. It is currently in what is called its planktonic stage. As a planktonic bug, it can accomplish the dream of all life everywhere, to become what every little bacterium the world over wants to become : Plural. Preferably measured in powers of ten.
Like I said, it can do this perfectly well planktonically. It can swim around and eat and divide and evade and eat and divide and evade.... until eventually it fails at one of those things, and some instance of itself dies. But usually, it doesn't just keep swimming happily around. For some reason, given the chance, this bug will abandon its free swimming existence, shed its flagellum, and find some nice little surface to adhere to. Why?
Because it would be nice to do away with one of those three things that bugs have to do: Evade. I know, at first glance that make no sense at all. If you can't move you can't evade, and the the thing you are evading will do whatever it is that it would do that made it worth evading, right? Bear with me. Planktonic bacteria spend a lot of time evading. They move away from toxic environments like pH or osmolarity changes. They move away from hunting phagocytes like amoeba and neutrophils. They often have trouble finding a nice, stable and safe environment to settle down in. They solve this problem by creating a nice stable and safe environment to settle down in. They make biofilms.
That lone planktonic bacterium makes a class of seemingly useless compounds, the quorum sensing molecules (QS). For the most part, these are n-acyl homoserine lactones (AHSL), small nonpeptide molecules. Simple guys, a 5-member ring on one end, a short chain of carbons with a carbonyl or two hanging off it. Simple bugs, simple signals.
QS are part of an autoinducer loop; the bacterium talking to itself. Normally, this doesn't do anything, because the molecules simply diffuse away before they can reach a level high enough to trigger any kind of response. Selection dictates that these things have a purpose, though. A bacterial population can experience hundreds of generations in a week, and that's a hell of a driving force for selection. Therefore, they are usually quite streamlined. They make nothing they don't need....so why these?
Let's go back to our lone bug. Call him Phil. Phil eats stuff and makes stuff. One of the things he makes is AHSL. But it doesn't do much good. AHSL has to get up to a certain concentration before it can do anything, and the rate at which Phil makes AHSL is not anywhere near the rate at which AHSL diffuses away from him. Eventually, Phil will set down and attach himself to some kind of surface. At some point after that, Phil strives for the dream and makes the ultimate thing any bacterium can make, Phil Jr.
Phil Jr also eats stuff and makes stuff (like AHSL), and he cranks them out next to Dad. Mom. Whatever. Doesn't really matter, it's a fucking bacterium. Bacteria. Whatever.
Anyway, Phil and Phil Jr both make AHSL. For you math whizzes out there, that's doubling the rate at which AHSL is made. Unfortunately, this just means they diffuse away even faster, reducing the increase. But the increase is there. Phil Jr strives for the dream, just as Phil does the same, for a second time. Meet Phil III & IV. Eat, divide, repeat. Meet Phil V-CCLVI. Hey...that QS level has gone up a bit. Phil has become PHIL. PHIL is talking to himself, and for the first time, diffusion isn't silencing him. So he silences diffusion.
OK, enough with the anthropomorphic prokaryotes. We now have the makings of a biofilm. QS molecules like AHSL have reached a respectable concentration, and signaling has begun. New genes are turned on, and new behaviors kick in. Flagella go away. New types of pilli form. Each cell begins to crank out proteins, thick, gooey carbohydrates, and DNA, which come together to form a sticky coat around each bacterium. Due to their proximity, these thick, gooey coats merge, and grow. Other proteins are made. Beta-lactamases to protect against incursions of fungus, catalase to fend off superoxides in the environment, proteases to chew up anything near the biofilm to make more room to grow. New properties arise. After a time, the bacteria have made a viscous liquid surrounding them, a glob of slime in your drain, the black goo in your trap, or the yellowish slick on your teeth. It's not really a solid and it's not really a liquid. Think snot or the watery phlegm that you cough up when you have the flu. It's actually very similar stuff.
After a while, you have millions of bacteria, all living in and as a single biofilm. At first, the film is a fairly homogenous hydrogel, a water trapping 3-dimensional mesh. This mesh impedes normal diffusion, greatly reducing the rate at which molecules can move in or out of the biofilm. Inside, QS concentration accumulates, and the rising rate causes further changes (the mechanisms of which are not fully understood). The biofilm now no longer has to evade. It can control the pH inside itself by regulating H+ export. It can regulate ion and osmotic gradients by sequestering and pumping ions around. It avoid being eaten by roving phagocytes by sheer size; biofilms can be large. They can grow from a few bacteria that barely affect the turbidity of a test tube full of media to a visible, tangible thing you can actually pick up with your fingers after only a night of growth.
It's easy to see why these are thought of as the precursors to multicellular life, they are multicellular life. It's practically an organism. As the biofilm develops, it even develops organs of a sort; fruiting bodies. Small pockets will form inside the biofilm, pockets devoid of the carbohydrate/protein/DNA scaffolding that makes the structure of the biofilm. In these pockets, planktonic bacteria start to grow, and the pocket starts to move to the periphery of the biofilm. After a time, the fruiting body buds off and spills the planktonic bacteria out into the environment, to seed new biofilms and exploit new territories.
It's an elegant and useful system. The problem is, it shouldn't exist. According to all we know about evolution, it should be a highly unstable system due to a phenomenon well known in the geek world: The tragedy of the commons.
Making this stuff takes work. It is work to make the biofilm scaffold, to pump ions and make protective proteins. The bacteria do this because working together this way is of benefit to them all. It's not really altruism, but mutualism. Prokaryotic quid pro quo. It's worth the effort because everyone is pitching in. Some of you may see where this is going.
You can break down mutations into 4 broad categories: Gain of function, change of function, loss of function, and invisible. In prokaryotes, the most common of these, by far, is loss of function. Think about computer code. If I were to randomly change a few characters in your code, it is possible that it could be an improvement. But it's not very likely. Most likely the program will break. Same with bacteria. Change something at random, and you break it. Most of the time. I hope you see where this is going.
Take one bug in that biofilm and hit it with a stray bit of radiation. That stray bit of energy happens to strike the DNA strand in the alg promoter region just as it is being replicated for mitosis. The radiation lends its charge to a guanine residue in the strand, rendering one of its three hydrogen bonding participants temporarily uncharged. As a result, instead of the cytosine that should settle in opposite it, a thymine settles in instead. The charge on the guanine dissipates, and the error becomes obvious. Repair structures move in and assemble to fix the damage, but by now, mitosis is complete. What is correct, the T or the G? Coin toss....the G loses. alg no longer works. Not that that is a bad thing.
alg, among other things, happens to control the production of some of the carbohydrate scaffold in biofilms. This bug just lost the ability to help make the scaffold. But like I said, that's not a bad thing. Its neighbors still make the scaffold. It still gets food, protection, and stability from the biofilm, but its load in maintaining the biofilm is less. So it has an advantage. It can grow slightly faster than its neighbors, and it does. And its progeny also don't make the scaffold. In the context of a biofilm, this bug has an advantage and it uses it.
After a short period of time, selection runs its course and the biofilm+ bacteria are outcompeted. The scaffold dissolves, AHSL diffuses away. The biofilm capable bugs lose their signal and stop making all the things that made them a biofilm. Phil is back, and he goes on his merry way.
But biofilms DO exist. They are stable, that is the inescapable observation. There are even multispecies biofilms; the crap on your teeth is a perfect example. So why doesn't one bug get mutated and wipe out the biofilm with its own selfishness? It's not clear.
There are explanations for parts of this, but none are satisfactory, and I've gone on long enough. I'll get you started by saying this:
There are two primary ways by which cooperation can arise in a population. One is mutualism, each individual derives a benefit from the others behavior. That's how biofilms get started. But when one bug stops helping, it's all qid and no quo. Mutualism is gone.
The second way is kin selection, and from 1964 (Hamilton) to the early 1990s (Kelly, Queller, Wilson, and Taylor to name a few), it was thought that this is what accounted for the stability of biofilms. But that last set of authors voided Hamilton's theoretical work with their own theoretical work and showed that if you invoke limited dispersal to get kin selection (as Hamilton did), then you get your ass handed to you by kin competition after a short period of time. Back to square one, just by a different mechanism.
But that highlights the problem right there: It's all theoretical. Theoretically, biofilms shouldn't exist. Theoretically they will form in a certain way that dooms them to dissolving in a certain way after a period of time. That wouldn't be a problem; we could deal with biofilms that exist for a while and then disperse. But that's not what we see. We see biofilms grow and stay for very long periods of time. They are very hard to get rid of. Don't believe me? Go clean out the trap under your sink. Wait a week and look again. That black shit that smells like death died and rotted for a while? Biofilm.
Go brush your teeth.