DEV Community

Discussion on: What's the difference between a library and a framework?

Collapse
 
thomasthespacefox profile image
Thomas Leathers

Agreed. A framework requires code to be structured around it. A good example would be my pygame virtual window manager framework, strazoloid, which i touched on in my post on my gopherspace client.

In example, strazoloid's window class function-based callbacks are time-sensitive, as all rendering and event processing for the windows, desktop class, and window manager, happens in one thread. This means the programmer needs to run lengthy operations in separate threads, and limits the program's structure.

as far as libraries, pygame itself is more a library than a framework, as its API can be used in just about any structure of program in python.

as per writing/using a library vs a framework, it really depends on the task. using a framework just for drawing circles is kinda excessive, but makes sense for regulating a whole window manager running in a pygame/sdl window.