~Actually, it was written in 1787. It was implemented in March, 1789, after having been acceded to by the thirteen independent nations who confederated under it.
In practice, it was an abject failure. The government envisioned by the draftsmen and their constituents existed for all of 12 years. The political games played between John Adams and Thomas Jefferson almost tore it apart in 1803. The sovereign independence of the participating nations who joined the confederation only on the promise that they would not permanently and irretrievably surrender their independence was breached and forgotten within 50 years. When eleven states exercised their absolute right to opt out and reclaim their independence in 1860, they were invaded and crushed by the imperialist armies of their former 'brothers'.
Now, how did the perversions of the Constitution that started with John Marshall's unethical and constitutionally incorrect (and legally and intellectually fraudulent) opinion in Marbury v Madison through Abe Lincoln's bogus claims at Gettysburg (after all, he was involved in an invasion designed to make a government of the people, by the people and for the people perish from the earth) work out? Look around. What you see is what it wrought. But look quick. With things like the Patriot Act being passed to such popular acclaim, it might not last much longer.
By the way, the Declaration of Independence had no legal effect whatsoever. The Committee of Five themselves acknowledged that it had no legal effect and contained no new or unique political or philosophical ideas. It was a propaganda instrument intended to justify the equally ineffective Lee Resolution by which the Second Continental Congress actually "declared" independence on July 2, 1776 (Rhode Island had jumped the gun and done it alone on May 4, 1776 and New York didn't jump on the bandwagon until July 9.) It was never put to vote because only 1/3 of the population was in favor of it and such a loser was not going to go to the polls in a fair referendum.
Independence was granted by the British and recognized by the world in 1783 with the Treaty of Paris (although the Netherlands recognized colonial independence a few months before the treaty was signed - the only nation to have done so). The treaty created the 13 independent nations that then confederated, without surrendering their independence or autonomy, other than in those few limited areas specified in Article I, under the Constitution. The sad thing is, most people since 1865 believe that the "United States" refers to a single nation, whereas the framers knew and intended that they were referring to the several independent nation-states united. Such is the fallacy of school book history as written by the victors.