System Design Full Course Build Discount Coupon Engine | System Design
Build Discount Coupon Engine | System Design Transcript and Lesson Notes
حان جی تو کرے start so welcome back to the corridor our today's lecture we are going to see a new design problem which is the name of this problem designing a discount coupon application now what is this application see we understand it a little bit so generally what happens in many applications like
Quick Summary
حان جی تو کرے start so welcome back to the corridor our today's lecture we are going to see a new design problem which is the name of this problem designing a discount coupon application now what is this application see we understand it a little bit so generally what happens in many applications like
Key Takeaways
- Review the core idea: حان جی تو کرے start so welcome back to the corridor our today's lecture we are going to see a new design problem which is the name of this problem designing a
- Understand how System Design fits into Build Discount Coupon Engine | System Design.
- Understand how Low Level Design fits into Build Discount Coupon Engine | System Design.
- Understand how High level Design fits into Build Discount Coupon Engine | System Design.
- Understand how System Design for Beginner fits into Build Discount Coupon Engine | System Design.
Key Concepts
Full Transcript
حان جی تو کرے start so welcome back to the corridor our today's lecture we are going to see a new design problem which is the name of this problem designing a discount coupon application now what is this application see we understand it a little bit so generally what happens in many applications like you have seen inventory management like sezepto, blinket, amazon, swiggy waggara waggara inseppe ke yawda ki yawda coupon sotha jabab apna payment add to card and then you will go to payment flow so you get the chance to add coupon some of the coupon banks are available you get a discount like swiggy, you get 60% off some of the coupon some of the coupon banks are available so how do you manage this entire application we are going to take a general application which basically will work in a plugin play model we will create a coupon management which can integrate all the coupons it will be scalable we can apply multiple coupons and finally this whole software will work we have different strategies to add coupons to our coupon and to put discount on the coupons so I think this is a very interesting LLD problem and not only interesting but also in many interviews it is very difficult to ask you already know that in this lecture 80% of the kids have been shot who had to watch this course only because of hype the kids here who are present the kids who designed the system and they want to understand the LLD they want to learn it so for you all who are still ticked they have a lot of congratulations let me share one more thing this knowledge of LLD which we are giving you in this depth and especially the application we are making we are building the project this is not all random projects which I have put in this series this project is actually asked in the interviews which have been asked by me and we are asked by the developers and this is the coupon management system this is the only one I had a very good friend who had been asked in the interview so we have discussed about how to make a good design and that is why for you all I have brought a good design problem how to manage coupons, discount coupons in any application so I hope you will enjoy let's start on the front and front on the screen yes so see we will start the same way as we are building all the applications first of all we will discuss our functional requirements now you know I am not writing down the non-functional requirements because you know it is always the same it should be plug and play it should be scalable so you can assume so let's take a look at the functional requirements what is the project we have first of all we can add new coupons at run time so basically we have many coupons in this application for example, a banking coupon one of your let's say internal coupons category based coupons so we can add new coupons so we can add new coupons so let's take a look at this scale both card level and product level discount now you know what is the discount of the coupons or it is on some card when you want to pay your payment in some card it is in inventory application like zaptob, blinker, amazon or for delivery app swiggy or your zomato in all these when you want to pay then finally when you are paying your card then your total price is you have many coupons so remember you will get a card level whatever you have in your card or some products are also there for example if you talk about zaptob here then you will get a category for example, on electronics it is going on 5% off so it is on the product level it is on the coupons so we will integrate it and then we take a lot of coupons' types like seasonal offer loyalty discounts banking discounts etc and we can integrate it so now we have three minds that we have three coupons we can get them but now we will work on them apart from that the strategies of our discount are also different we can offer flat level discount percentage discount what is discount? what is discount strategy? we can understand it that from the start our total card value is made if we give flat discount then we will pay 20 rupees for final offer but if we give flat discount and give percentage discount then we will give 20% off or 30% off so this is different and it is different we have another percentage with a cap we write 60% off up to 120 rupees this will be in common in the market which I will put a cap we will give up to 60% off then we will give it to 120% off now we will give 20% off so we will give the discount strategy and we will keep it scalable so that we can get new discount strategies and we will focus on our application and the last thing we will focus on is the coupons they can and cannot be applied on top of other coupons what can be that you applied on one card on the third coupons first you applied 60% off the amount of the coupons if we are integrating it and you also applied your bank then you will have to apply some coupons to apply your bank and you can also apply your bank and you can also apply the bank but some coupons cannot be applied for example we say you can only apply bank and no one will apply so I have to note that we can change or we can not do that right both are in the situation we have to handle and in this application we will have to keep the safety of the third and we will agree that this application will go to a lot of millions of users so multiple users will be on one with one with one with one with one with one with one with one with one with one with one with one car then the a for and for تو again we will start again, we will see what is the happy flow and after that we will build his uml and then we will see our code so first discuss your happy flow and then we will grow like uml so see what happens in our happy flow that from the lead we will have user he will see a lot of products on any application now that application can be any such so we will not make this flow in our uml because this is again application to application dependent so that there will be a lot of products on it if it is looking at the zaptop application so that there will be a lot of items on the zaptop so that there will be a lot of food items this can depend on which items you want to show so we will give it a generic name we will give it a product so the user will see a lot of products on his screen the product will see so again you know what happens to us we have a card the user can add that card to that product and finally so far our flow was not that we had to understand that the user will add the product in the card once the product is added in the card then our uml is working because now we will build our discount coupons okay so we will keep a lot of coupons in this one after another you can supply a user coupon you can integrate something after one coupon with other coupons and you can independently use something you can't use any other coupon with it so we will apply all these coupons so we will use multiple coupons finally our total price will generate the user will have to pay and this final price will be all the coupons that can be applied so this is our small happy flow because this is a plug and play application again this is a plug and play application as our uh notification system application or now we read in the last class payment gator wave application these are all plug and play applications you can integrate it anywhere so their happy flow is very small because their happy flow depends more on their applications which we will integrate with this application so remember we will not make any user class you can use it in a human way which has a card which is added in the product card yes we will make a card class and we will make a product in the generic now depending upon your application if we have seen the clone of the Zomato which was named if you want to integrate it so the product here will be found in the bottle it will be your food item so the restaurant was made its menu was made you can replace it with the product and finally the whole of the coupons you can integrate it so this will also be a good exercise so I hope you have a happy flow it will be a good idea to do what we will do so let's jump and let's see how we will construct this URL so again the strategy we are going to use in this is going to use the bottom up which you have already know we have already used a lot of applications we will make the classes first which are small classes then we will do the work we will construct their managers or their factories or we will construct bigger classes we will control the controller management level classes we will create right so let's start with our basic class which is the name of the class let's say product now I told you the product class here is going to be very generic we can keep an application in our mind so that we can make the product so we will make the product or we will make two classes this does not direct link to this application because we have to manage discount coupons so if we have an LLD interview our interviewer he asks us to make a coupon management so we can tell him that we will take the product class and we will take a generic one because we don't know where this application will be integrated right so he will agree with you okay you can take a particular product in your mind or a particular application so let's say we take this design in a mind inventory management application now what is inventory management like your Zepto your Blink it you know this is inventory management they have a lot of inventories the product every product has its own category like electronic product some food item some daily use item some clothing item some clothing item right so we will keep it in mind and design this class so in this class we will keep a lot of basic things you can change this or the interviewer the reason for that the application which you want to keep in mind so what can we keep in basic first of all a product name okay let's keep a category of our product like we say we keep a Zepto in mind some inventory management so every product has a link it can be a food product clothing product or electronic product it can be a different one and the most important thing is that every product has its own price so we will take it let's double the price okay so these are the basic three things which we have kept in our product class so this is our product in which we have the name category and its price now if we have made the product once then let's focus on this our product item how will we add it in its card and in the card between the product and the card we should have something in it like we have made a restaurant management and a menu in a restaurant there are many items in it so from that we first make a card item okay because we will keep the card in the product card why do we have to understand first of all what will be the card item first of all it will be a product let's say okay so here we take a hazard relationship we will draw okay now we will draw a simple hazard in the entire diagram and then we will see what is the hazard relationship this is a simple aggregation composition or association so we will see after that now we have just kept a product in it and then what will be the quantity every product's quantity because you have to order an earphone asapto you have to order an earphone so you have to order three so you have to do 3 times plus 1 plus 1 so you will have to do three earphones on the card but how do you show the card the earphones are three so basically when we show the item in the card then we have to show one product we have to show multiple products with one group so we have a card item in the class so we have added a product in the card item and we will add it let's say quantity so we will interact with it okay let's draw it and quantity so this product is available in our quantity we will have two things in it one of your products will have a quantity in it also name, category and price so you will know this class is our product it is our model class right? we have made many models so this is our model class now we have a method let's take a look get price which we will buy and give this is our defined method right?
not declared now you will know what will be the basic price in it what will be written in the logic of the price which is the product and will multiply it from its quantity right? this is the product P, the price take the price and take the price and we have a quantity of quantity so if we have three products then we have made a card item now we will go to our card now we will draw our card this is our card ok? now we will draw a little a little now how is the relationship of the card again this is also a has relationship and this is one to many again this is aggregation, we will see now we will draw a QML diagram is drawing so you can discuss with us what is the relationship or we will discuss the first all the scenarios we will make the classes I have already shown you that we will draw and then we will draw ok? now we will jump now what will be in the card I have 1 to 2 many relationships you will understand that you will maintain a list of which card items we will draw items so we have made one of these you will see what can be in the card we will store the requirements we need to revisit the requirements here we have many card level and product level but the offers a seasonal offer loyalty discount banking discount loyalty discount which is the reason we believe we believe that we are discussing that this is some loyalty members which is prime if you buy a sweet or a pro what is you have to do delivery or you get an additional feature that you get a coupon that you show apply coupon free delivery if you get an integrated form then you get a user who gets a loyalty member so what we will do we will draw a bullion variable let's say loyalty member or you can name this is loyalty member generally if you get a user then you can name this is a user if you get a user then you can name this is a card and you can name this is a card but the items that we have ordered we will apply discount that we should have a total let's say final total final total is valid when we have a total final total and the user is a card and the user can name this is all the variables items and loyalty member and the total and the final total and the functionality is called ad product product product and the items is called the items in this list we will add items in this is the product and the items are added in this list is added in this list is added in this product and this quantity is added in this product and the card item is added in this list is added in this list is added in this is added in this list is the handling of the card is the card item is the item is the card items is the card items is the card item is the product is کہٹھ کٹھ کٹھ ایٹھم کو اپجھے کرے گی اور اس کو اس لیسٹ مدہ لے گی کیوں کہٹھ ایٹھم سے انٹرٹ کرنے کی زمداری کی اس کی ہے اور کہٹھ کو کہٹھ ایٹھم چھے یا یا کیوں ہم اس کو پورہ کا بورا اسکت بھی کر سکتے تھے بلکل کر سکتے تھے اگے ان میں نے کہٹھا دیزائیں بہت سبجیکٹی بود ہے میں نے کہٹھ ایٹھم اس لے رکھا کیوں کہ میں چاہتا ہوں ایک کہٹھ ایٹھم میں ہم اس کا پروٹٹ اور اس کی کوئنتی دونوں رکھا ہے اور کٹھ کو بس یہ پہداو کہ مجھے اگر کسی بھی ایٹھم کی ایک زیادہ نئے نا تو میں صرف اس کا get price call کر دوں گا اور مجھے اس کی value مل جائے گی تو اس لیسٹھ کو اس طرح رکھا ہے چکے تو فیلنلی ہم اس میں ایک اور مدترٹلے تھی ہمارا ایٹھ بروٹٹوں گیا جس میں کٹھ میں اس پروٹٹ کو ایٹھ کر سکتے ہیں اس کے علاوہ ہم جو فیلنل جو ہمارا اور یہ ہزاروپے کھاستور ہوگا نورمالی اوڑجنلٹوٹل میں اوڑجنلٹوٹل میں اوڑجنلٹوٹل اب یہ جو اپلای дисکاؤنٹے کیا کرے گا یہ ایک اماؤنٹ لے گا دبل میں اب یہ وہ پتا کنس اماؤنٹ لے گا جو سارے گوپنس کو لگانے کے بعد ہمارا دسکاؤنٹ بنا تو لیٹھ سے ہزاروپے ہماری توٹل کارٹ کی value تھی سارے گوپنس کو لگانے کے بعد ہمارا بچا ہمارا یعنی کی تھیم سورپے گا یہاں پاس ہوا اماؤن ٹیم سورپے یعنی کی تھیم سورپے گا توٹل کارٹ کیوں پر تو ایوزر کو توٹل کتنا پیکرنا ہوگا سات سورپے اور ایسات سورپے کام کہاستور کرلے گے اپنے فائنلٹوٹل میں تو ہم ایس طلاق کو کوئی دزائیں سوچھ رہے ہیں کیا مگہ کریں گے اسمیک ماتھڑوں کو اپلای دسکاؤنٹ وہ ایک پیرامیٹر لیٹھہ ہوگا اماؤنٹ یہ سب کوبنز کا کام ہے تو جب ہم کوبنگہ حرار کی بنارے ہوگے کوبن کلاسز کو بنارے ہوگے تو ہم تو پھر دیکھلیں گے ابھی ہمارے کارٹ میں ابھی ہماری بس یہ تین حرار کی ہم نے بنائیں ہے اب سمجھ گئے ہم نے کتیگری اور پریس ہے ہم نے کارٹ کا ایدم بنائیں جو اس کو کارٹ میں نچ کرتے ہیں اسمیک پروٹڑٹ ہے اور اس کی کوئیٹیڑی ہے اور ایک مدھرے گیٹ پریس چکے فائنلی ہمارے پس ایک کارٹ ہے جس کے پاس کوچھ میتھر ہے جس کے پاس پہلے بات تو ایک لیسٹ ہے اس کارٹ ایدم اس کی اس کے پاس کوچھ لٹ سے بولیان وریابہ لے ایک تو ہے اس لولیٹی میمبر وہ چک کرتے گی جو ایزرہ وہ لولیٹی میمبر ہے یا نہیں ہے اگے ہمان سکتے ہیں کہ یہاں بھی ہمارے پاس کو ایزر کلاس ہوگی جاں سے یہ value آتی ہوگی فیر ہمارے پاس ایک اوڑیجنال توٹل ہے جو ہم نے آپ کو بتایگ دیا اوڑیجنالストور کرے گا کہ توٹل کارٹ کی value کیا ہے اور final store کرے گا کہ افٹر discount کارٹ کی value کیا ہے جو ایک چلی ایزر کو پی کرنا ہے فیر ہم نے دو میتھر کریں ایک ہم نے رکھا add product جو کی ایک product لے گا اس کی کوینٹٹی لے گا اس کا اس کو اس ایٹمس کے لست میں add کر دے گا اور لست میں add کر دے گا لست کو کیا کرنا پڑے گا پہلے کارٹ ایٹم نام کا product بنانا اگ ویڈی ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں پڑھا ایٹمس کے لست میں
Lesson FAQs
What is Build Discount Coupon Engine | System Design about?
حان جی تو کرے start so welcome back to the corridor our today's lecture we are going to see a new design problem which is the name of this problem designing a discount coupon application now what is this application see we understand it a
What key concepts are covered in this lesson?
The lesson covers System Design, Low Level Design, High level Design, System Design for Beginner, System Design for advance level.
What should I learn before Build Discount Coupon Engine | System Design?
Review the previous lessons in System Design Full Course, then use the transcript and key concepts on this page to fill any gaps.
How can I practice after this lesson?
Practice by applying the main concepts: System Design, Low Level Design, High level Design, System Design for Beginner.
Does this lesson include a transcript?
Yes. The full transcript is visible on this page in indexable HTML sections.
Is this lesson free?
Yes. CourseHive lessons and courses are available to learn online for free.
