twisted bits said:
You're basically comparing the samurai to the military/standing army and the ninja to a Special Ops Operator, like a SEAL.
That's definitely how popular media have tended to portray them, I think. I'm in general agreement with everyone here that (a) the actual history is considerably different, and (b) the actual history is considerably more interesting.
I'm not actually well-versed in Japanese history, but have dim recollections that others will correct shortly.
The samurai of course were numerous standing armies (plural); attempts at unification weren't terribly successful. Each warlord has his own army (if he was lucky), and in many respects this was much more like organized crime turf wars than national defense! This guy had 1,000 samurai, that guy had a couple hundred, etc.
The samurai (bushi) used many 'tools,' among which was a generic term "ninjutsu." This basically was a category of strategies, like espionage. Some samurai specialized in stealth techniques, spying, and general recon work for the greater purposes of his warlord.
Over time, some individuals became extremely adept at this, and these techniques were recorded and held as privileged knowledge. Some probably free-lanced, others were in service to their warlord exclusively. Spec Ops? Sort of... but more like "Toshiro's got a knack for climbing walls; let's use him to open the gate."
The modern concept of "ninpo" has taken these techniques and made it a specialized art form. It's more organized, categorized, and formalized, but overall it's quite a modern system with no ancient *formal* predecessors.
On the complete other hand, as we've read above, modern comic book and movie writers, toy manufacturers, etc., have reinvented the Ninja from interesting historical perspective to the black-clad cat burglar assassin-types, and even had stories of samurai versus ninja wars, as if they were two invading species with a long-standing hatred.