Samurai was a term for the military nobility in pre-industrial Japan.Most samurai were bound by a strict code of honor, the Bushido and were expected to set an example for those below them. A notable part of the Bushido code is seppuku which allowed a disgraced samurai to regain their honor by passing into death, where samurai are still beholden to the rules of the Bushido code. However, the bushido code was written in peace-time and it may not truly reflect the samurai's abilities as a warrior.
Today, many people uphold the belief that the samurai fought nobly; for instance, many would consider it unlikely that a samurai would strike an opponent from behind, or fight in a manner normally attributed to the Ninja. However, from studies of Kobudo and Samurai Budo it is widely considered that the samurai were as practical on the battlefield as any European knight.
In practice, there were the disloyal and treacherous (e.g., Akechi Mitsuhide), cowardly, brave, or overly loyal (e.g., Kusunoki Masashige) samurai. Samurai were usually loyal to their immediate superiors, who in turn allied themselves with higher lords. These alliances with higher lords often shifted; for example, the feudal lords allied under Toyotomi Hideyoshi enjoyed the loyalty of their men, but the feudal lords themselves might shift their backing to Tokugawa. This did not mean that the lower-ranked samurai were disloyal though as their allegiance was to their immediate superior.
The name for the samurai sword is the Katana. It refers to a specific type of curved, single-edged sword traditionally used by the Japanese samurai. The weapon was typically paired with the wakizashi, a similarly made but shorter sword both worn by the members of the buke (bushi) warrior class, it could also be worn with the tanto, an even smaller similarly shaped blade. The two weapons together were called the daisho, and represented the social power and personal honor of the samurai (buke retainers to the daimyo). The long blade was used for open combat, while the shorter blade was considered a side arm, and also more suited for stabbing, close combat (such as indoors), and seppuku, a form of ritual suicide. (In fact, seppuku was a right reserved for samurai in order to preserve their honor by taking their own life should the need arise.)