1

While I was in university, I remember one of my textbooks having specific jargon to distinguish these two different API paradigms but, for the life of me, I can't remember which book it was in and Google has been no help.

  • APIs like Win32, Xlib, and SDL, where you sit at the top of the call stack and have to write your own main loop and take responsibility for pulling system events off the queue using a construct like GetMessage, XNextEvent, or SDL_PollEvent.

    (A design which requires more skill, but grants maximal control for writing game engines or resource-constrained applications that need to run on the 80286 CPUs that Win32's Win16 ancestor was designed for.)

  • APIs like those of Qt, GTK, wxWidgets, Fltk, Swing, Tk, etc. where you perform some initialization, hook up event handlers, and the framework provides the event loop for you, either by spawning a background thread or by requiring you to transfer control to the framework explicitly. (eg. QApplication.exec(), gtk_main(), IMPLEMENT_APP(wxAppSubclass), Fl::run(), etc.)

Does anyone know which two terms I'm struggling to remember?

Bear in mind that it wasn't immediate mode vs. retained mode. It's possible to have a retained-mode application where you still have to pump the event loop yourself, or an immediate-mode application where you do your drawing in a callback dispatched from a platform-provided main loop.

ssokolow
  • 14,938
  • 7
  • 52
  • 57
  • "Google has been no help"-- What keywords and phrases have you search for? "API" is probably not the correct concept, since API in the web/cloud connected world implies something much different than the API for a local (i.e. desktop) application. Certainly Google feeds you the wrong concepts. Of course the two paradigms you describe will have different APIs, but that's not the key idea, so get away from "API" as your main keyword and try again. You are describing different execution architectures and frameworks. I'm not sure of the jargon you're looking for, but I hope this hint helps. – C Perkins Apr 19 '20 at 05:47
  • It might be too obvious but are you looking for low level vs. high level api's? – AimusSage Apr 19 '20 at 08:58

1 Answers1

0

The two cases you describe are talked about in Martin Fowler's blogpost about InversionOfControl. Although he probably not come up with these terms, he gives a nice summary:

Inversion of Control is a key part of what makes a framework different to a library. A library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.

A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points.

Are the words you are looking for Library and Framework?

Sijmen
  • 477
  • 6
  • 12
  • Unfortunately, I remember the words I'm looking for being adjectives. It's looking like I'll just have to sit down with a stack of every textbook I had in university. – ssokolow Apr 19 '20 at 17:56
  • You have made me very curious now :) Looking forward to when you find the answer. – Sijmen Apr 20 '20 at 09:33