menu content link in Backend VS menu content link in UI

Goal:
Have a common and same menu content link (for instance Home, about, consumer product, support) when you are using Angular, NativeScript and Android.

Background:
The menu contain seven different name. Each name is distinguish.
The backend is .net core with SQL server.

Problem:

Two approaches:

First solution:
Should the name from the menu should be located inside of backend? In order words, you retrieve the content of the menu from the backend and display in each UI (angular, android etc.)
Cons:
You use the concept DRY and less maintenance.

Second solution:
The second one is to have the content of the menu in each UI without request for the content of the menu at backend.

The main question is:
What experience have you been through in this situation.

Which of these two solution should I go and why?
Any pros and cons?

Thank you!

Trying to create a generic solution that loads an UI definition and renders it dynamically sounds like it should save work, but that’s usually not the case. At that point, you’re effectively creating your own UI framework. Simple platform-specific adaptions (e.g. changing the color of a link but only on Android) will get more difficult.

Sometimes, the effort of creating a generic solution is worth it. That might be the case if these links change very frequently, or are even generated dynamically on the fly. Then you might not want to publish a new version of your Android app, but would rather load a new UI definition from the server. And if you’re doing it for one frontend, you might also use the same technique for others.

But if these links change rarely, it will likely be much less effort to update them manually in all places. To keep the different frontends in sync, you might use a traceability matrix instead: a document or spreadsheet where you list all your features, and track where that feature has been shipped or is in progress:

   feature       web      nativescript    Android
------------ ----------- -------------- ------------
     ...         ...           ...           ...
support link  not needed   2020-09-22   (ticket 123)

So I can’t directly recommend what you should do. Instead, consider some guiding questions:

  • Will either solution make something impossible? E.g. loading links from the backend might slow down the app, or make platform-specific changes more difficult.

  • Will either solution enable unique capabilities? E.g. hardcoding might make offline support easier, loading links from the backend simplifies updates.

  • How much does each solution cost? There are immediate costs for the effort of implementing the solution, but there might also be long-term savings if it reduces future work.

  • How easy is this decision to change? If a design can’t be changed later, the design requires much more careful thought. Loading links dynamically makes it easier to change the links, but now you’re pretty locked in to keeping this backend service running, or you might break an old version of the app.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *