DEV Community

Amanu
Amanu

Posted on

Library vs Frameworks: My own two cents

About a week ago, I was reading a brilliant blog titled “Anyway, this is why I prefer Vue over React”.

He called Vue a library, to which I commented on otherwise. And it sparked an argument that lasted with “let’s agree to disagree”.

Here is what I think

Vue is a framework.

In my opinion, the main distinction between framework and library is who calls who. And callbacks doesn’t count.

Frameworks impose a structure the client must follow in order to make it work. They depend upon the structure you implement to manage the life-cycle of activities. Vue does just that. Let me explain why

When you define a Vue component, you define some methods and objects.

new Vue({
  data: () => {
    return: {}
  },
  computed: {},
  mounted: () => {
  }, 
  watch: {
  }
})

If this was java or any other real object-oriented system, you would have been extending some base class or implementing an interface. Annotating your methods or sometimes just following some naming rules(like Vue). Then the framework decides to call what and when.

When you use a library, you will not be implementing any structure or API, you’ll be calling the API on the library.

Latest comments (0)