Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Tiny Frameworks

by BrowserUk (Pope)
on Sep 30, 2007 at 14:58 UTC ( #641770=note: print w/ replies, xml ) Need Help??


in reply to Tiny Frameworks

As one of those who has expressed skeptisim about "frameworks" here, I'll have a go a producing a definition. Or rather, a comparison between a 'framework' and a 'library'.

  • A framework provides the common infrastructure supporting a definied architecture for a class of applications.

    (IMO) the key element of a framework is that it provides the structure of an application and leaves the application programmer to fill in the details of the specific application.

    As the label suggests, this is analogous to the framework, infrastructure of (say) an office building within which you can conduct any type of business. You would normally require a different type of framework for a domestic building or a warehouse operation etc.

  • A library (or abstract class) provides a service to any application that needs that service.

    A library encapsulates the detail of some specific service or algorithm and allows the application programmer to ignore the details. It can be called from any kind of application.

    This is analogous to (say) the telephone system. The system stays essentially the same (whilst varying in scale), regardless of the purpose of the building (application).

In a nutshell, frameworks call you; you call libraries.

Whilst what you describe provides the infrastructure for the creation of classes, the classes produced using it would usually be more akin to libraries. That is, classes built using your infrastructure would themselves be components within larger applications, and there would often be several such derived classes within any moderately sized application.

So whilst it is possible to see how you arrived at the term 'mini-framework', my gut feel about what constitutes a framework is that they provide the outer shell and overall structure for an application along with the stubs for essential plumbing. Viewed this way, your module doesn't really live up to the tag. As useful as it is, I would consider it the wrong label.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Tiny Frameworks
Re^2: Tiny Frameworks
by Anonymous Monk on Sep 30, 2007 at 15:55 UTC

    A very good point, framework calls you, and you call library.

    Framework is a set of rules and conventions, you supply the details to the framework, and you expect the framework to call your detailed implementation according to the rules at the right time for the right thing.

    Bravo! Now I know why we didn't drown in the sea of frameworks as I said: most people are wise.

Re^2: Tiny Frameworks
by Ovid (Cardinal) on Sep 30, 2007 at 16:52 UTC

    While I knew my post would be controversial, the distinction I'm not seeing from people is the dividing line between "library" and "framework" (in the same way, perhaps, that many cannot define "pornography" or "enterprise code"). Perhaps I'm being a bit slow, but the only significant difference I see between our definitions of "framework" is that yours is more verbose. There's a certain irony there :)

    In my case, the "class of applications" this code provide a defined architecture for is "all OO applications." I'm not limiting myself to Web apps, ORMs, or something similar. So using less code to support a greater range of applications than most frameworks support somehow makes it not a framework? Believe me, I did my reading on this and I'm convinced that the word "framework" is misleading the hell out of people. It's a buzzword I want to smash under my foot.

    So I provided what I refer to as a "tiny" framework. Imagine at some point that someone comes along and provides better method validation. Someone else comes along and adds integrated exception handling. Someone else comes along and adds a persistence mechanism. Someone else comes along and calls it a framework. At that point, some people jump on the bandwagon and some people sneer.

    If the mere act of calling something a framework makes it a framework, then my code qualifies. If it doesn't make something a framework, then when in the above sequence of events did it become one and why? There's nothing magical about frameworks. There is no minimum size/complexity/buzzword requirement for them. However, it seems to me that in the back of people's minds they seem to think that a framework must somehow be big and restrict the scope of things that can be worked on -- of course, mine doesn't do anything for non-OO code, so maybe it qualifies? :)

    Oh, and thanks for actually providing your own definition, unlike the Anonymous Monk above. I appreciate that :)

    Cheers,
    Ovid

    New address of my CGI Course.

      Is pointillism a frame? Pointillism is a technique to use when making paintings. A frame gives you a structure to put your painting inside of. It is not a coincidence that the word "framework" contains the word "frame". BrowserUK's definition was not just "more verbose". It was also certainly less vague. It made great points about the type of structure a framework is.

      Ugh1

      I'll either somewhat disagree with or somewhat augment what BrowserUK said by saying that his definition sounds like what I would call an "application framework" and there certainly could be a "library framework". But a "library framework" would need to define the "outer shell" and over-all structure of the library and provide ways for people to put different guts inside of that. And the term "framework" as applied to software is most often used to mean "application framework" (IMHO, of course).

      I'm unsure whether using "framework" for non-application frameworks is desirable / useful terminology. Certainly, people shouldn't be afraid of developing software in a structured manner, though.

      - tye        

      1 Update: Ooh, that could be taken quite harshly; like I was saying Ovid is worse than an idiot. That certainly wasn't my intent and I apologize. I certainly don't belive Ovid is an idiot. I think Ovid should re-read BrowserUK's description. And I made note of the fact that one anonymous reply re-stressing part of the distinction that I think Ovid may not have fully appreciated.

        In making the distinction between application framework and library framework, I can see the best counter-argument to what I've put forward. However, I still don't particularly see when something "flips the framework bit" from library to application. Had I merely posted something like HTML::TokeParser::Simple and claimed this was an "HTML parsing framework", people would have rightfully laughed at me. That would definitely be something I would call into.

        With what I posted, it's clearly a "frame" which constrains code. It seems to me, though, (correct me if I'm wrong) that the key thing you two suggest for what makes a framework is that there is a particular target application type the framework is designed to support. As a result, since my code is designed to usefully constrain Perl 5's somewhat simplistic OO model in predetermined manner, are you saying that someone unlimited scope of the code is what makes it not a framework? I would think that flexible constraints are what is desirable in a framework. After all, how many times do people complain that their framework of choice limits them too much?

        Mine (again, being a toy example), satisfies BrowserUK's definition "that it provides the structure of an application and leaves the application programmer to fill in the details of the specific application." I'm just stepping back and a bit and widening the class (no pun intended) of applications for this this structure is provided. As I asked elsewhere, if someone else adds integrated exception handling, someone else adds multi-method dispatch, someone else adds persistence, at what point can we call it a "framework"?

        (I see where this is going, though. Most people seem to think that if I don't have a specific target application type in mind, I'm not allowed to use the word "framework".)

        Update: And no worries. I didn't take the "idiot" comment as a personal attack :)

        Cheers,
        Ovid

        New address of my CGI Course.

      "controversial" means argurable, in this case, you don't have a point at all. By the way, BrowserUK didn't provide his definition, as that's everyone's definition, oh not yours obviously.
Re^2: Tiny Frameworks
by goibhniu (Hermit) on Oct 17, 2007 at 04:45 UTC

    Boy, I'm coming late to this party. Sorry about that. The following is asked in the interest of understanding your (and by extrapolation Tye's) points. It may seem that I'm supporting Ovid's point, but really the most accurate statement of my position is "confused".

    If in the examples in the OP, the data about the Creature package were extracted to, say, XML, could you then call this a "framework for declarative creation of classes"? It seems to me that this constitutes the details to be filled in by the application programmer. I haven't used Hibernate, but wouldn't that be just one level down from what Hibernate does (declarative objects, plus how they relate, whereas this would be just declarative objects)? Does it matter whether those details are provided by the application programmer as XML (like in my hypothetical) or as structured code (like the original example)?

    I guess part of Ovid's point was to explore the grey areas in the use of the term and now I feel caught up in that gery area. Again, I ask for the sake of clarification. I don't have skin in the game either way.

    Goibhniu stops previewing, takes a deep breath and pushes create . . .


    I humbly seek wisdom.

      Hmm. From my perspective this is all about terminology. Let's try an analogy:

      When they built The Swiss Re Tower, some company was charged with the manufacture of the 5500 triangular and diamond-shaped glass panels that form the outer cladding. As these panels vary in size for each of the 40 floors, there was no doubt some mechanism for inputing the required sizes for each of the aluminium extrusions that make up the panels to the (probably digitally controlled) cutting machines.

      In terms of the manufacture of the panels, that mechanism may have been seen as some kind of a "framework". But in terms of the construction of the building, the term "framework" was probably reserved for the steel 'diagrid' that forms the overall shape and load-bearing structure for the building.

      There are already many terms for tools that are used to construct classes: Library; toolkit; Meta class; Specification language; Class Factory; etc. All of which make more or less sense depending upon the philosophy behind them; the interface they present; the way they operate; and the way they are intended to be used. Do a CPAN search: Class::* and read the first few lines of each module (say the first couple of hundred) for examples of all these and more.

      There seems little purpose in taking a term 'framework', that already has a fairly intuative interpretation, and qualifying it with 'tiny', in order to bend it to fit a conceptual space that is already heavily overloaded with terminology.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Thanks. That was more helpful to me than the "frameworks call you; you call libraries" distinction.

        Cool building, BTW.


        I humbly seek wisdom.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://641770]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-07-23 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (140 votes), past polls