Sonata form, also known as sonata-allegro form, is an organizational structure based on contrasting musical ideas. It consists of three main sections - exposition, development, and recapitulation - and sometimes includes an optional coda at the end. In the exposition, the main melodic ideas, or themes, are introduced.