• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Diff between a library and a Framework

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly is the differnce between a library and a framework?
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Library is a set of utility classes which most of the time could be used directly.

Framework is a set of classes which you would extend. Framework provide the implementaion of reprtitive tasks. For example Struts is a MVC framework and your application will extend those classes.

Others opinion may vary.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
Library is a set of utility classes which most of the time could be used directly.

Framework is a set of classes which you would extend. Framework provide the implementaion of reprtitive tasks. For example Struts is a MVC framework and your application will extend those classes.

Others opinion may vary.



Pradeep, I guess Sudha is talking about the frameworks like Collections framework... Not kind of Struts Frameworks...

In the case of Collections framework, the framework is very similar to the library... I guess he might want to get a clear explanation on it... In this case, I don't know how to explain it well, we know that we call it Collections framework and don't call it Collections library... I guess it's kinda of naming stuff...
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One (not the only) definition of frameworks is that they provide some basic functionality and invite you to plug in your application-specific customizations. You might register a listener for some framework-generated events or extend an abstract framework class and override some "developer hook" methods. Or both.

For example, the SAX parser for XML does all the hard work of parsing tags and attributes and such and invites you to provide a handler for certain interesting bits. That fits the framework definition. For my own use, I made an abstract handler that I extend and override a few methods for specific XML structures. We could call that single handler class a framework, too.

One thing you see in this style is a reversal of control. Without a framework your code has to do everything and controls the sequence and logic directly. In contrast, a framework takes on some of the control and just calls your code at appropriate times.

FYI:
My SAX Handler
 
Pay attention! Tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic