Commence Operation: C.A.C.A.O (Chocolate And Commerce At Once)
The office is lively as usual. The echoing yells of your teammates reverberate around the enclosed office. You sit at your desk, listening to the ramblings of your workmates. The topic this time reminds you of something you've experienced before yet again.
"How do you not know about St. Valentines Day!!??" "Should I be concerned about it?" "Yes!! You should!! It should be a public holiday." "I know of no such thing. You just want a day off. Besides, I can't do anything about it. Orders from above."
Alex seems to be yelling at Emory about something. Usually it's the other way around. What's got him so worked up? Riley appears to be fidgeting in the corner. They seem to want to say something about whatever is being discussed.
Just then, the room door opens. Rory and Maya walk in together. An unusual combination. Maya is holding several papers in her hand, and is likely about to consult us about some project or other. The two ignore the bickering Emory and Alex and approach you to ask about the situation. You explain what you understand so far on the topic of St. Valentines. They both seem to show a reaction of interest, revealed by the glint in their eyes. The two whisper for a bit before silently agreeing on something.
Rory walks over to Riley. You inquire Maya as to what St. Valentines Day really is.
"You don't know? It's a day to remember the valiant efforts of the Great Paladin St. Valentine. Apparently a common practice is to share chocolate with friends and loved ones. At least that's what I remember about it."
The whole concept sounds familiar, except for the whole Great Paladin St. Valentine character, and you don't really feel like inquiring further is necessary. Sharing chocolates though, that piques your interest a little bit.
Rory finishes discussing something with Riley, who's expression changes drastically. She now appears to be pleased somewhat, grinning from ear to ear. Rory cuts in between Emory and Alex, gesturing them to stop and listen.
"I have an idea" Rory proposes. "They didn't give us a holiday, so why don't we give ourselves a holiday?"
"What do you mean?" Emory questions.
"We can work in shifts. Like a half day thing. We've done this before, haven't we?" Rory looks at Alex. "Huh? Oh, yeah. I guess we have. As long as we reach our deadline."
With that said, Rory returns to Emory and suggests the idea of doing a half-day shift tomorrow, with the work distribution too. Rory then beckons Emory and whispers something to them, all secret-like. You can't quite catch what they are saying, but you can see Emory's face grow with interest every passing second.
"Hm. I suppose that's fine. I'm sure I can compromise with our superiors." Emory declares. Alex jumps for joy. The mood in the room changes. It is as if a thick blanket of smoke was wisped away through the window.
"As I have been informed, tomorrow is St. Valentine's Day. Our higher ups did not given us a day leave, but I will permit a half-day leave for everyone in shifts." Emory explains that you, Alex, and Rory will work until noon, and after that will be Riley and Emory, and Maya by extension. A half-day holiday, that doesn't happen very often.
"Are you really allowed to do that though?" Alex wonders. Emory simply shrugs. "We still have a deadline to do, but I do agree resting is also important."
"That said, we still need to talk about our next task first.." Rory reminds everyone and ushers you and Maya over to where everyone else is. Maya obliges and brings their stack of documents with them. You follow them and regroup with everyone else in the middle of the room. Guess it's back to work.
BootShop
"You're aware that we're helping the development of an e-commerce system, yes? It's still in its early stages, though."
You seem to recall a commerce project that had been handed over to your team. Bootshop, is it? A simple e-commerce application with the purpose of democratizing access of commerce through a digitized application. Maya explains the backlog and what is to be expected.
Apparently they need a system where when a customer checks out their carts, they are able to choose a payment method and a courier they prefer. Early development requirements aren't much, and only two payment methods and three couriers are available. The development team has tried several approaches, but haven't found the correct way to do it.
Emory asks about details on the system. Maya picks up a different document and starts flipping pages. "It says here there are two supported payment systems right now. Gold Transfer and ArgentaPay. The customer can choose these options on the checkout page. If you look at the application, it is a page that can be accessed via the cart icon. At the current state, the selection hasn't been added yet. We need to add it later."
"There is also a promo offer we are trying to implement for ArgentaPay. For example, the payment using Gold is treated as is. If the invoices say you need to pay 350G, you need to pay 350G. However, If they use ArgentaPay, they will get a 10% discount for every item they buy." Seems like a good deal, you figure.
"Another thing the customer needs to choose is the delivery method. We are implementing three couriers: AtivexGo, Slossea, and Thunder Cross Split Delivery. AtivexGo will deliver the products in between 10-20 seconds for each item in the cart. Slossea between 20-30 seconds for each item in the cart, and Thunder Cross Split Delivery will send all items in the cart in 30 seconds exactly, all at once. All the courier costs 10G, 5G, and 15G respectively."
Maya then explains about the required dashboard. There will have to be a dashboard to support the reporting of the
status of the items sent by the system. In general, the item has three statuses: ADDED
when the items are for the
first time added to the cart, PROCESSED
after the requests received by the merchants; after the customer checkout,
and DELIVERED
after the items are delivered to the customer. The cart also has status. ADDED
after the customer
chose some items they’d like to buy. If one of the items added has the change of the status, the status on the cart also
changes into PROCESSED
. If all the items in the cart are delivered, has the status changed to DELIVERED
, the cart
status will be changed into COMPLETED
. The page to display all cart transactions you have made can be accessed via the
dashboard on the navigation bar. This mechanism is also not implemented yet.
"Seems like a lot of frontend work to do..." Alex comments. "Don't worry, this is a prototype, so feel free to edit the frontend as you like. The frontend team will be working on the actual web application. You're not expected to create a fully working front-end."
Making Chocolates
"So, why am I doing this again?" Emory asked, inspecting the frilly apron they were given by Maya.
"Hehe, you say that, but you really don't mind, don't you?" Maya retorted.
"Well... I'm not against it."
The two were in Emory's apartment kitchen. Ingredients for simple chocolate chip cookies was prepared on the counter. Alongside Maya and Emory was Riley, who seemed very amped up. They had rolled up their sleeves, equipped their apron, and was ready for battle.
"Do you have any prior experience baking cookies? Or making chocolate?"
"I cook a lot but I've never really made desserts."
"Same here."
Maya had prepared a recipe to follow and began instructing everyone on what to do. Though the other two have no prior experience baking, they followed with no problem as they already had cooking experience. Maya preheated the oven, and they started on the actual cookie batter.
Emory mixed together softened butter, white sugar, eggs, and vanilla extract onto one bowl, creating a buttery mixture. Riley mixes flour, cocoa powder, baking soda, and a pinch of salt into it. Once the batter was well blended, it was time to mix in the chocolate chips and some walnuts.
Maya had readied up cookie sheets, and was carefully pouring teaspoonfuls of batter onto the tray. Once the tray was fully occupied, she
"At this rate we should be ready by lunchtime"
"Don't forget, we have work after this."
"Hahah, very true."
Once the cookies were done, they shared one to taste. The taste was just as expected, very chocolatey. They parceled it up in very cute wrapping paper to make it look presentable, and furnished the final product with a pink bow. The cookies were complete!
It was fulfilling, the process of making cookies. Cooking was something they had done often, but cooking together was a completely new experience. Emory smiles softly at no one in particular. They can only hope their effort would be appreciated by the receiver of this present, they thought as they clutched the bag of cookies close to their heart.
The Task
You will need to assess the requirements from the Boot Shop section. From the requirements you will need to decide what design pattern is needed to solve the problem. You will need Strategy and Observer pattern to solve the problem. Analyse the problem and decide which part needs which design pattern.
-
Write all the requirements in notes.md. Compare the current state of application with the requirements. Write down what you need to change.
-
Write your proposed solution in notes.md, explain why you propose that solution. Explain what part of the solution is using the design pattern and why.
-
Implement the proposed solution. Don't forget to change the credential of the database in
application.properties
Hint
- You may need to change the controller and the view (HTML). Read more about controllers and Thymeleaf.
- You may try to run the application first while reading the Boot Shop section to give you a clearer picture of what the requirements asks.
- You can change the model if needed by your design.
- You might try the application first to understand. Then you can design the changes needed.
- You can change the value of
spring.jpa.hibernate.ddl-auto
to update to retain the value of previous transaction from previous sessions - You may book your TA to discuss the requirements or something you are not sure about.
Created: 2022-04-19 23:20:26