Skip to main content

The ever changing client requirements and a need for a plug and play system.

Recently I was the backend dev for a client-side project, which was quite challenging based on the use case it has. Now I cannot go and ramble it over here, due to obvious reasons.
But what I can tell you is how I fixed a particular problem that I faced while working on the project.

See every new project will come with a new set of challenges, in my case it was the case of third-party integrations. Now integrating a third party application is not a challenge, but in my case, it turns out to be challenging one because of the way it needs to be integrated.
The issue with my case was that I have multiple third-party integrations I want to use based on the user's choice. This choice is stored in the database when a user gets registered in the application. So for example, if User A wants to use ONE and User B for the same use case wants to use TWO. Now we have a single dashboard for both User A and User B, and the same set of functionalities even if one use ONE or the other TWO. So how do we cope up with that?

So to solve this issue of different integration for different users, and a possibility of other third-party integration in the future. So we seek the help of the good old idea of dependency injection, to manage the integrations on a separate area altogether while managing the business logic separately.


Please note that the real integrations are not named "ONE" and "TWO" (yes I follow good coding principles and give meaningful names).

Here, as you can see the corresponding integrations will call the respective files and call their respective business logic behind them.

Now one other question remains. How do we call the corresponding integration?



Above is a screenshot of the "fetchProject" method. The "_fetchService" method calls the "User" collection and fetch the corresponding integration of a particular User and return it within the variable called "service".
And then the corresponding method of "fetchProject" will be called which is in alignment with the user's integration service.

So for example, if User A is the one requesting the "fetchProject" method, then his integration of ONE will be called since the "service" variable now will be "ONE".
Now later if another set of integrations are also introduced all I need to do is write the set of business logic for that particular integration and all is done.

How cool is that ?!

Hope you gained something from this small snippet of mine, happy coding!!!

Comments

Popular posts from this blog

AI. Will it replace us or...?

AI!! The buzzword is too hot in the market nowadays. Do you have a technical product or an idea? If it doesn't have AI in it, then chances are it's not going to be sold like hot cakes. That is how things have changed lately. It is no wonder why me and my colleagues at Gelato want to see what AI can do in a niche department like customer support and service. And that is exactly what we did. For a company like Gelato, which is in the market for production-on-demand, there are a lot of customer questions you need to answer. It can be related to products, queries about shipping and pricing, and so on and so forth. Thus, our customer support team is always happy to help with these recurring questions. Let's take one example. A customer asked us, "Do you ship to Norway?" Now that is an easy question to answer if you have the knowledge written somewhere where you could refer to it and say, "Yes! As a matter of fact, we do." Following the same thread, the next q...

A smoooooth operation....

 Backward compatibility...   A word that I used to hear when I started my career. You design your APIs with backward compatibility in mind, don't break anything when you are upgrading, think about this, think about that etc. Well, those teachings from my previous mentors didn't go in vain, as I made a fundamental change in how we report problems @  Gelato .    You see recently @  Gelato , the CS (Customer Support) team moved from A ticketing management system to B ticketing management system, which is a monumental task for all the people involved in the CS team. Even though the fundamental concept remains the same the places, the attributes the concepts, and the naming of different attributes all change if you have this transition. And thus it was a big change for the whole company.    After the decision was taken, the first step was to create a well-written transition document, which the good folks at the CS team tackled. Special thanks to  ...

My first ever podcast...

 I travel almost one and a half hours a day. It was such a waste of time for me, going through the same roads, travelling the same distance all day. There was no time left for me after my office hours for anything new. Then I got the idea of podcasts. I started listening to name a few and fell in love with the idea of it. I started searching for the best podcasts on the internet and found out one gem, which was released back in April 2018. "The Caliphate", by Rukmini Kallimachi. Rukmini Callimachi is a Romanian born American journalist who is working for The New York Times. Back in 2014, she started her reporting on Islamic extremism and then focused on Al Queda and Islamic State of Iraq and Syria (ISIS). after years of research and study and battling through tough times of reporting, she published a podcast series named "The Caliphate" back in April 2018 with proofs of her findings and the way she got them. "The Caliphate" was a series focused mainly on a...