Construction Foam (CF) is a quick and effective construction material for defending against mobs. Players are able to break the foam before it hardens in no time. However, broken foam cannot be harvested.
After it's placed, it will eventually turn into a solid CF Wall, which is explosion resistant and paintable. With an explosion resistance of 60, it will resist TNT, ITNT, and Creepers, but Reinforced Stone is a better choice for protecting against things like nuclear reactor explosions and lasers.
Wall blocks harden at varying rates. Foam hardens at 0.6% per 25 seconds, per light level. Foam placed in total darkness will never solidify. Right-clicking on foam with a block of sand will cause the foam to harden instantly, but the block of sand will be consumed in the process.
Players, mobs, and animals can walk through foam until it fully hardens (although the risk of suffocation or getting stuck in a new wall is high).
As of 1.70, CF can cover & harden around a placed cable, creating a block that functions as a cable but looks like a CF wall. When a "CF-cable" block is destroyed, it drops the cable it was created with.
You can spray CF with the CF Sprayer too. Place Construction Foam in a Compressor to create CF Pellets. Load the CF Pellets into the CF Sprayer and you're good to go. The sprayer's capacity can be increased with the use of a CFPack.
Currently a single pellet will place a glob of 13 blocks of foam. Using scaffolding will allow you to arrange those 13 blocks into desired shapes, the most common being a straight line. See the CF Sprayer page for more details.
Note: The recipe is shapeless (i.e. any item can go in any square on the crafting grid), and this will consume the Water Cell.