views:

101

answers:

2

I'm writing a small application framework which other programmers will use. So I'm looking to do some reading on framework design issues. I'm not completely new to framework design, but it's always a bit of a challenge.

Although I'm looking for general design principles, this particular framework is for Javascript applications, so it will need to handle things like window management, event passing, server calls, etc.. I'm already using one of the popular JS libraries, so this will be a (hopefully thin) layer on top of that.

The kinds of issues I'm running into:

  • should there be one overall controller object for the application, or is it better to think of it as just a bunch of independent objects talking to each other?
  • if there is a main controller or event loop, should it be part of the framework, or part of the individual application?
  • in general, should the individual application be in control, calling the framework when it needs to, or should the framework be in control, calling the application when it needs to?
  • when an object needs to be used in many places, who should own it, and what should its scope be?
  • when should objects communicate by publishing and subscribing to events, and when should they communicate directly?

Does anyone have any books or links they would recommend?

+3  A: 

I think this question has been asked several times but for convince, one of the best books in my opinion on the subject is Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries

Even though it's a '.Net' book, the ideas captured in the book translate well into almost any other language.

Scott Lance
A: 
brianegge