Doubts about business model implementation

Hi,

I’ve been working with Vue and Vuex for about 3 years now but in a different working context.
In the current job we are planning to bring to a new and fresh life an old project built in Angularjs using Vuejs.

Here come my main questions:

  1. The old version has the data model layer written in plain javascript. Even though it will need a rewrite because it needs to be updated
    to a later javascript version, I find it a benefit that this layer is framework agnostic as it could have been reused as it is.
    Even though I know how Vue Vuex work with each other, for this specific use case I have some doubts.
    Is it really smart migrating the data model to Vuex or in general to a state management framework?
    What if (actually it’s more a when than an if) there will be a new migration perhaps in 10 years?
    We all know that this is something that will most probably happen at some point, so I’m wondering how smart is to bind the business model to a framework.
    Another thought that came to my mind is to create an extra model layer, where all data coming from the API is incapsulated in classed that represent the business model and then use Vuex to manage those objects. Is this a crazy idea? Any opinion is more than welcome.

  2. Is it a good move to start the new project using Vue 3 considering that official version is still not out there?

Thank you all in advance

You are correct, a future migration will have to happen. A new version of Vue, some other framework, who knows. 10 years is impossibly long for tech to remain unchanged. The question is does Vue/Vuex do everything that you need it to? Does it add benefit to the project? Using frameworks and libraries have a benefit of creating a base of developer/contractors that can ramp up quicker. Someone that is familiar with vuex will be able to have a head start if you need to bring in help. If everything is vanilla js then they have to learn your whole ecosystem from the ground up.

Using Vue 3 is a tough call. There are a number of factors to consider. How risk adverse is your company? What is your timeline? If your production release is not until the end of the year or next year then that starts to change the answer. Do you have other dependencies like vuetify, vuebootstrap, nuxt, etc. Beta 18 was just released. Is there another option to delay this project until 3 is ready?

@deweechi thanks a lot for your response.

you comment makes sense to me.
Still trying to figure out the entire workflow of the existing application.
If each app module is independent and manage its own data model which is always synced with the server, then I think the usage of Vuex can be considered optional choice.
In case data models are needed in multiple locations and reactivity is required, then I would consider Vuex as a must.

My crazy idea is to preserve the business model outside Vuex by creating javascript classes and incapsulating the data coming from the server into custom object, and only use Vuex as state management for those objects. In this way I could keep the business model framework agnostic and then use the reactivity provided by Vuex (here for example I’m not entirely sure reactivity will be lost).

Does this sound too crazy?

It is not crazy at all. Keeping the business model/rules outside of vuex makes sense. Leave vuex to do what it is meant for state management.

1 Like

Then I wonder why I don’t find such implementations in The Internet :slight_smile:
I guess I need a bit more investigation, but thanks for sharing your opinion!