'In the beginning Bharat [the developer] bought a digital camera and thought "wouldn't it be nice if I could put these photos somewhere." But when Gallery 1.x came into being, the developers had no idea what they were doing. They didn't know PHP very well, didn't understand the importance of separating code from content, didn't have a whole lot of database experience, you get the idea. So they started by just writing something that worked, and then slowly building upon it. The end result is Gallery 1.x which works quite nicely but internally is a bit of a mess.'
http://codex.gallery2.org/History