Results 1 to 8 of 8
  1. #1
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    6

    Default Why is Collections called a 'framework' in Java?

    I am using Collections just as an example from the frameworks provided by the Java platform.

    According to this Quora answer,

    A framework is an application which has defined open or unimplemented functions/objects, which the framework user writes to complete and customize his application...
    I think I have read in some other places as well, that a framework is a complete application, and we override its methods to customize its functionality according to our needs.

    When I was first introduced to Android development, I had read something along the lines of

    Android provides a rich application development framework allows you to build innovative apps and games for mobile devices in a Java language environment.
    This had reinforced that definition of a framework (that it provides a complete basic application and we override its methods and add our own methods to customize it), because when we create an Android application in Eclipse, the basic working application is already there, and then we override lifecycle callback methods, and add our own methods and call the one from their API.

    The existence/providence of this application also implies that the framework is providing the structure/architecture for our application, like they say that frameworks do so.

    But Collections does not provide any application, right? It is just a bunch of classes and interfaces, just like any other package in the core Java API.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: Why is Collections called a 'framework' in Java?

    Since Java 1.8 the Collections are pooped-up with lambda expressions and Streams, so strictly speaking you can build your application around it; it's a bit far fetched, if you'd ask me, but the word 'framework' seems to be en vogue nowadays ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    6

    Default Re: Why is Collections called a 'framework' in Java?

    Since Java 1.8 the Collections are pooped-up with lambda expressions and Streams, so strictly speaking you can build your application around it
    I am yet to study Lambda expressions, but I'll do it. But Java frameworks like Collections (and Swing etc.) have been around before Java 1.8. When trying to find out what a framework really is and how it is different from a library, what I have come across is the same thing described in different ways:

    - What I quoted in the question.
    - We write our application's code inside a framework, whereas it is not the case in the case of a library. We rather call the library functions inside our application's code.
    - The caller-callee relationship. Our application code is the caller in the case of a library, but our application code is the callee in the case of a framework; the framework code calls it.
    - So it is the framework which provides the structure/architecture for our application. Our application code depends on the framework code for the flow of control.


    The Collections (or even Swing) does not seem to fit any of this. If anything, they look like libraries to me, or rather they look like a group of related built-in classes and interfaces (or add lambda expressions or anything to it) provided by the Java platform, just like any other package in the Java API.

    Am I mistaken somewhere?

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Why is Collections called a 'framework' in Java?

    Well the wiki definition is:
    "In computer programming, a software framework is an abstraction in which software providing
    generic functionality can be selectively changed by additional user-written code, thus providing application-specific
    software. A software framework is a universal, reusable software environment that provides particular functionality
    as part of a larger software platform to facilitate development of software applications, products and solutions.
    Software frameworks may include support programs, compilers, code libraries, tool sets, and application programming
    interfaces (APIs) that bring together all the different components to enable development of a project or solution."
    Imo, a framework is a structure, which serves as the foundation for building something, be it a house, or a software
    application. I have never considered Collections as a framework but more just a set of tools for storing and manipulating
    data (or objects). I think examples of software frameworks as Apache Struts or the OSGi framework on which Eclipse is based.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: Why is Collections called a 'framework' in Java?

    imho, the OP is right: calling the Collection library a 'framework' is far fetched (no matter the lambda expressions and Streams); it's just that 'framework' sounds dandy ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  6. #6
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    6

    Default Re: Why is Collections called a 'framework' in Java?

    I have never considered Collections as a framework but more just a set of tools for storing and manipulating data (or objects).
    imho, the OP is right: calling the Collection library a 'framework' is far fetched (no matter the lambda expressions and Streams); it's just that 'framework' sounds dandy ...
    Thank you. I will also just consider it just a library, and if I am ever questioned about this, I will just say that I don't believe Collections to be a framework.

    Would you call Swing a framework?

  7. #7
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Why is Collections called a 'framework' in Java?

    Quote Originally Posted by Zarah View Post
    Would you call Swing a framework?
    No. It is a set of GUI development classes that is part of Java and is built on top of AWT. This is not absolute, but here is how I would recognize a framework. If you need some additional pre-processing or a completely different tool to run or "compile" the code, then it is probably a framework. I consider JUnit a testing framework because it makes use of special annotations that drive the testing. Or you could write a modeling/simulation tool which takes commands and does specific things with them to facilitate modeling a system. That same framework could also allow for embedded Java.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  8. #8
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    6

    Default Re: Why is Collections called a 'framework' in Java?

    @Jim829 Thank you very much.

Similar Threads

  1. Collections java
    By peliasrojo in forum New To Java
    Replies: 3
    Last Post: 05-24-2014, 09:44 PM
  2. java collections framework
    By mamoonrizwan in forum New To Java
    Replies: 1
    Last Post: 11-27-2011, 05:19 PM
  3. java collections
    By hemanth123 in forum New To Java
    Replies: 1
    Last Post: 10-24-2011, 08:00 AM
  4. Java collections
    By learn2java in forum Advanced Java
    Replies: 6
    Last Post: 05-01-2011, 03:12 AM
  5. Collections framework
    By yuvi461 in forum New To Java
    Replies: 2
    Last Post: 01-08-2008, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •