Now, this may be a silly question but sometimes the terms Framework and API are used interchangeably. The way I see it is that a Framework is a bigger more generic thing, containing many API's, that could be used for various programming tasks (for example, the .NET Framework.) An API is smaller and more specialized (for example, the Facebook API.) Anyone want to share their insights on the matter?
And take for instance that Microsoft call .NET a Framework whereas Sun calls theirs a Platform ... so could it be also a business/marketing decision as to how call a "collection of libraries."?
Design Patterns provide the following definitions:
toolkits: "often an application will incorporate classes from one or more libraries of predefined classes called toolkits. A toolkit is a set of related and reusable classes designed to provide useful, general-purpose functionality".
frameworks: "a framework is a set of cooperating classes that make up a reusable design for a specific class of software".
The key here is that while toolkits (APIs) can be useful in many domains, frameworks are geared to solve issues for specific classes of problems, that can be customized "by creating application specific subclasses of abstract classes of the framework".
Moreover, and maybe more importantly, "the framework dictates the architecture of your application": Inversion Of Control is one of the characteristics of frameworks (see Martin Fowler on this); instead of having your application call specific APIs to implement a specific behavior, it's the framework that calls your code.
I've always thought the framework was the whole thing, internal code, API's, etc.
While the API is just the bit you use when you want to make use of the framework.
In other words, the .NET framework consists of the .NET libraries, all the languages and so on. The API is just the way you call the functions.
A framework does introduce the notion of inversion of control
(i.e. the overall program's flow of control is not dictated by the caller, but by the framework)
When you are referring to language frameworks (such as Java Framework or .Net Framework), you actually including more than just libraries and their APIs (which would be more limited a Software Framework if those libraries provide an inversion of control).
A Language Framework includes the development and execution environments which will call your code (to compile it or to execute it).
That is why .Net Framework is a "Framework".
Java may refer to its Frameworks (JDK, JRE) as a "Java Platform" in order to emphasize its "platform independent" programming language feature.
From About the Java Technology
A platform is the hardware or software environment in which a program runs. (including Microsoft Windows, Linux, Solaris OS, and Mac OS).
Most platforms can be described as a combination of the operating system and underlying hardware.
The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.
The Java platform has two components:
The Java Virtual Machine
The Java Application Programming Interface (API)
As its name suggests (Application Programming Interface) the API is just the interface of the framework.
From my understanding, an API is basically a way of interfacing with an existing app (like Facebook), whereas a framework is basically a tool for building your own app from the ground up.
Software Framework: Is a re-usable design for a software system (or subsystem). A software framework may include programs, code libraries, a scripting language, other software to help develop and glue together the different components of a software project. Various parts of the framework maybe exposed through an API.
API (Application Programming Interface): Is a set of routines( AKA methods, functions), data structures, object classes, and/or protocols provided by libraries and/or operating system services in order to support the building of applications.
More details along with other
Link to this particular topic is
http://aprogrammersday.blogspot.com/2009/02/difference-between-framework-and-api.html
API (application programming interface): like his name means, is an interface for externe programs to interact with your inter program or library without having direct access. for example, the google map API and Facebook API give you the interface to interact with their program and library without having direct access.
In the other hand:
Framework : is a collection of libraries that can help you to build an application. you can imagine the framework as a "skeleton" where the application defines the "meat", so you can't take a human skeleton to build a hors body, so you have to choose the good framework before start programing. this is why we said : You call Library. Framework calls you.
I'd like to think that an API is a subset of a framework
In my experience, a framework often includes two things (at least) that an simple API doesn't:
Extensibility: you can compose or subclass framework components to extend or customize its functionality.
Tools for code-generation, administration, or diagnostic tasks related to application development.
A framework is basically a collection of classes that abstract away the development process and promote code reuse for example you might have database, session, and pagination classes that are independent of the application you are building. But an API is source code interface that allows two or more components of different systems to interact, for example adding the Google Maps API to your website, you and Google are two different systems, Google coded the underlying interface for incorporating its products to your website/application. All in all just go with a framework work when building your system, then develop an API when you offer extensions for other people like Facebook and Google.
I know this is an old thread and that it really doesn't matter, but I just can't help but to chime in with my own views. An API (e.g. device driver API, Windows API, etc.) provides the basic and essential functions for a platform such that a programmer can exercise his creativity and do something with the platform - yes, including using it to build a framework. A framework is higher level in function and abstraction, and provide a set of reusable and convenient functions/classes/conventions to facilitate the development of applications that share certain common attributes (e.g. iPad apps, web services, etc.)
A framework implements a very important option called IoC (Inversion of Control) which means in a nutshell that your code has, no more, things in hand.
While in an API your code calls other codes (libraries), when you use a specific framework, it's the framework who is in control of the application flows.
Related
Is it possible to call Isabelle from external programms (Java, Scheme/Guile)? I have not managed to find documentation about API
Similar questions come up every now and then, e.g. here and there. None of them talks about Java or Scheme though, so here's a slightly adapted answer for the "Java" part.
Calling Isabelle from Java
Isabelle itself has no "API" that can be called from external tools. The general philosophy is that applications should live inside Isabelle or the Archive of Formal Proofs. Most of the time, this means your applications needs to be implemented in Isabelle/ML.
However, if you want to use Isabelle as an external tool, you have to play some tricks. I have bundled up these tricks as a Scala library (libisabelle). An overview of how this works is given in a paper.
libisabelle itself is available as a stand-alone library including some basic documentation that should allow you to get started. See the repository for more details. In essence, it allows you to
manage Isabelle installations from within Scala (download, unpacking)
abstract over different Isabelle versions (currently supported: 2016 and 2016-1)
lifecycle management of an Isabelle session (building, starting, stopping)
treat Isabelle/ML functions as Scala functions
goodies like Isabelle term syntax in Scala (term"$n > 0 --> ($b & ${HOLogic.True})")
There is no built-in routine to set up a goal state and apply some proof steps, but the necessary infrastructure is all there.
libisabelle is implemented in Scala, but there is a Java API that you can use, too. I know of one user who successfully uses that one. You can have a look at an example in the repository.
What would be the difference between the Collections Framework and Collections API? I have heard that "API is a subset of a framework". Wouldn't it be the other way around since a framework provides a more specific function, while an interface is more broad and abstract? I've also heard that a framework can contain multiple APIs. Does that mean that also frameworks are custom made?
Firstly, what is the definition of API? According to Beal (n.d.), the API "is a set of routines, protocols, and tools for building software applications. The API specifies how software components should interact and APIs are used when programming graphical user interface (GUI) components."
Secondly, what is a framework? According to Rouse (205), "a framework is often a layered structure indicating what kind of programs can or should be built and how they would interrelate."
So, the framework dictates what kind of programs can or should be built. Meanwhile, an API specifies how software components should interact. From the definitions, it could be told that the framework is the skeleton of the program, while the API is the organ system of the program. Additionally, a framework consists of multiple APIs. For instance, the Microsoft .NET Framework, it provides several APIs such as the System.IO, System.Data, etc.
References
Beal, V. (n.d.). API - Application program interface. Webopedia. Retrieved 07-17-2015 from http://www.webopedia.com/TERM/A/API.html.
Rouse, M. (2015, February). Framework. WhatIs. Retrieved 07-17-2015 from http://whatis.techtarget.com/definition/framework.
I can code in Java, and I'm trying to understand the wiki article on frameworks and how they relate to java. I think java = the platform and the frameworks are things like Java EE, jsp, etc. (I've never used any of those)
I'm trying to see the connection here.... Also, does each framework get its own compiler? Do they all use the JVM?
From my understanding: Java is a programming language (that compiles through the JVM), it is "open source" and can be extended with different APIs. Java EE (Enterprise Edition) is an API of Java SE (Standard Edition), it adds more functionality to the Standard API of Java.
Frameworks are supposed to make programming in languages like Java easier, and decrease development time. For example a framework named "Play" is a pretty popular java framework that helps develop web pages. Frameworks are not seperate from the language, they use the language itself so they don't get their own compiler all it's doing is using the language.
Someone (or a company) just creates their own methods in java and make them available to use for anyone that wants to use it. Anyone can create a framework, you can probably think of a framework as a Lego set where each Lego piece is a method available to build your own program (or website, depending on what the framework was created for), eventually you can build your own program using those methods from the framework. (hope this is making sense, heh)
Strictly speaking Java is a programming language. Just a programming language. It needs an implementation if you are to compile and run programs.
The Java implementation(s) consist of bytecode compilers and related tools, and a runtime platform. The runtime platform consists of an implementation of the Java Virtual Machine (JVM), together with the runtime libraries that contain the standard classes.
There are in three primary Sun/Oracle Java "platform" types ... or Editions as they are called:
Java Standard Edition (SE) is the normal general purpose platform. Unless specified otherwise, this is what most people will be using.
Java Micro Edition (ME) is designed for embedded devices such as smart phones, set-top boxes and the like. It is a very cut-down version of Java, with some significant differences in some area.
Java Enterprise Edition (EE) is an extended platform designed to support enterprise computing. It adds support for web server development, component-based systems (EJB) and other things. (In fact J2EE is a bit more woolly than this, because there are web container distributions out there like Tomcat, Jetty and so on that provide a subset of the Java EE technologies ... on top of a standard Java SE platform.)
A framework is a different idea. Frameworks are typically systems of libraries that support a particular way of designing and implementing software applications. So for instance:
The core Spring Framework supports a style of programming where the system is "wired up" from a bunch of components at start up.
Spring MVC (and other frameworks) support web servers that are implement according to the Model-View-Controller design pattern.
A RESTful web server framework supports web servers that follow the RESTful model.
And so on.
These frameworks typically run on one or more kind of Java platform, depending on what they are doing.
Also, you could make a case that some of the technologies that are in Java EE platform are actually framework technologies. Servlets and EJBs are prime examples.
If you are familiar with jQuery in javascript, well jQuery is a javascript framework. Same goes for framework for java. It just makes programming easier
I started playing with the playframework recently and really enjoy the simplicity.
But one nagging question I've had is why it eschews the servlet specification all together? What was the main motivation behind such an architectural decision?
From the FAQ
We are fully aware that we made
choices that are pretty uncommon in
the Java world, and that Play does not
blindly follow all the so-called Java
‘good practices’. But all of the Play
team members are very experienced Java
developers and we are totally aware of
the choices we made and the rules we
broke.
Java itself is a very generic
programming language and not
originally designed for web
application development. It is a very
different thing to write a generic and
reusable Java library and to create a
web application. A web application
itself doesn’t need to be designed to
be reusable. You need less
abstraction, less configuration.
Reusability does exist for web
applications, but through web service
APIs rather than language-level
integration.
When the development time tends to
zero you can concentrate on your
application features and experiment
quickly, instead of trying to abstract
things for future developments.
Play! applications can be deployed as web application on other web server containers, but it is mainly designed as a full stack framework; Play is the platform. And, in my opinion, this is what makes it beautiful and fast.
Checkout Guillaume Bort's blog. (Founder of Play!Framework). He explains it all on his blog.
EDIT : The link has changed, thanks procrastinate_later
Has anyone had experience taking a full-fledged Java desktop application and replicating the functionality using Flex?
If you have, what are some of the biggest things to watch out for or pay attention to?
What are some recommendations you can make based on your experience?
There could be any number of issues to watch out for. Here's a few that just come to the top of my head:
Flash Player restrictions that do not exist in the JVM, such as the ability to reach "outside" of the Player's bounds rectangle (and myriad others).
ActionScript 3 has no equivalent of java.lang.reflect.Proxy, unfortunately. This means that (so far) there are no decent mock object frameworks, and limitations with respect to reflection in general.
I am not aware of any AOP capabilities on the order of what you will find in Java.
Whether or not the Java application is using libraries that have no equivalent in Flex and which you do not wish to write yourself.
Java applications can call out to native code with the JNI, whereas this is not yet possible with the Flash Player.
Even if by "Flex" you include the Adobe AIR platform, the environment tends to be much more restricted in general than the JVM. However, don't let that discourage you - you get a lot of benefits from using Flex, such as an ubiquitous runtime, a great language and component development framework, etc. If your Java desktop application is an RIA, then Flex is probably a good candidate for a port.
I'm not sure if replacing a full-fledged Java desktop application with Flex is the best alternative. From Adobe Flex page: Flex is a highly productive, free open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops, and operating systems.
Adobe AIR is probably a better replacement for desktop applications, if you're considering Adobe realms of products.