Duality in Noncommutative Algebra and Geometry