Once Upon a Dream
"What is this? Why are you showing me this?" The train of questions don't stop. Shiny things fly here and there as if they have their own consciousness. They are everywhere. And this place, you have never been here before. But, as soon as you want to launch another question, the intention itself is stopped. You already know the answer.
" These are memories. " The stream of questions ends following that statement. Yet to whom were the previous questions are addressed to? As if you knew you are always in the attention of something entirely different from you; an inhuman presence you can't ignore. The entity that always watches you from far away finally makes its move.
" You will know. Very soon. " They said, and then they walk away just like that.
But there is no need to wait any longer. That question and potentially every question after that has its answer already.
It's my coworker's past memory...
The Dream of the Dreamers
It was an ordinary summer afternoon. The heat left quite the impression, making work feel harder than it should have been. Not the ideal condition for a critical period, you would say. But it was what it was. For Alex, however, it was something he wanted to ignore. After all, it was a big day for Maya. Finally, the time came for her.
" You two look so awkward...What the heck with this mood." Both Maya and Alex just kept staring at each other without saying any words. Kevin scolded Alex and Maya. But, it was just the natural reaction you would expect. The two childhood friends were not used to meeting formally like this. But, after some seconds of silence and finally, both of them just laughed. After all, the day they both had waited and waited for so long was finally here.
Maya had always wanted to become a star. Someone adored by many people that she would like to call fans. Obviously, not a few thought that was a dumb idea by a young girl who didn't know anything about this world. But not Alex, at least. Maya was his only light back then. He always believed, and the day when he could see Maya smile like she always wanted finally was here. However, it was a bit different than what he expected. It was not a pop star or idol unit that Maya always dreamed of. She tried and tried but failed. Somehow, the path they both followed led to this.
" It is finally the first anniversary of Leticia Arianne, and to celebrate, we want to create a giveaway event where Cia's fans can redeem promo and giveaway codes automatically using a website. These codes also can be used to redeem premium membership in the Fu Tube " Leticia's manager initiated the meeting out of the blue. Alex laughed a bit. Alex imagined that she couldn't stand the awkward air between him and Leticia, or should you say, Maya, anymore.
Leticia Arianne, Maya's Vtuber persona, finally made it to the big stage. As someone who always supported her so-called dumb dream joined her as the agency's IT staff. Unfortunately, he rarely got the chance to support her directly. He was a programmer. Most of the time, he wouldn't get near Maya. After all, both he and Maya were busy with their own schedule. So this was a golden opportunity that he had waited for so long to directly support his precious childhood friend.
"May I confirm something? Are the items on the website based on the items provided in the marketplace we have developed before? " Kevin raised his hand. Alex's superior, as usual, took secondary notes apart from Alex's to prevent any misinformation.
"Correct. " Cia's manager nodded. " In the marketplace, Cia's viewers can buy some mech items such as cards, stickers, mousepad etc. With this website, we want to be able to generate codes so the viewer can use the code in that marketplace.
"So basically, with this new system, we want to automate the creation of promo and giveaway codes that were previously manually created and input to the marketplace? " Alex asked a question to Cia's manager, but to his surprise, Cia's manager gestured for Cia to answer that herself.
"Yes. In addition, we can generate random or customized words. However, the code only can be used once. The same code can't be redeemed twice. "
" I see. "
"Is there a fixed number of item and code types on the website? "
" We may add another type of code and item in the near future. We may add something like a voice pack's promo and giveaway codes to celebrate the subscriber's milestones. "
With that information, Alex started to design the system. There are several code types. Every type can be used in merch promos and giveaways but represents different items. There is also a need to be able to add more code types in the future. So it's better to design a system that can generate more code types without changing the existing codebase. Without paying attention to the chit chat after the meeting, Alex focused on creating the codebase. For Alex, he must not fail this job. If there was any task that he couldn't afford to make any single mistake, it must be this. After all, Maya's dream always has been his dream.
Task Description
Your task is to complete a code that match the requirements mentioned above. You need to choose a suitable factory design pattern to solve the problem.
Workflow
There are two main endpoints in this application. One for the agency to generate code and one for viewers to redeem the code.
Final Product Expectation
-
Code generator interface
-
Code generation output
-
Custom Code Generation
-
Redeem Code interface
-
Redeem Code Expected Result
Checklist
- Read the above sections to understand the requirements
- Complete any class with
TODO
comments. You may also need to add new classes to implement the design pattern and change the HTML to make the application functional. - Complete
Code Generation
feature - (Optional) Complete
Redeem
feature so the same code can't be redeemed twice. - Add any tests for any changes and new classes you make.
Hint
- To get the full score, you need to design a maintable code that does not need to change much if there is a need for new type of coupon code or item besides the existing one.
Lost Dreams
The job was successfully done, and Leticia's anniversary was also a big success. However, the fairy tale ended there.
Alex stood in the corner of Maya's bed. The formerly known Leticia was nowhere to be found. Maya's eyes were empty, and her cheerful demeanour had gone long ago. "Is it a sin to have a dream, Alex? " Alex obviously couldn't answer that. He could, but he didn't want to. He couldn't accept it. The hard work she had done since their childhood. The pain and the tears she shed. Is there no meaning to all of that?
You can't make everyone happy. That is something Maya has known since the first time she entered this industry. However, the harassment and her anti, her haters continually spammed her chats every time she streamed on her social media, and she couldn't take it. Her dream had become her nightmare and, little by little was driving her crazy. To prevent any more damage to her mental health, Alex suggested she retire.
The effect wasn't the best Alex hoped. Maya's condition wasn't getting better. She felt so much hatred and anger. To whom? To the antis who ruined her life? Or to her past self for having a dumb dream and didn't listen to anyone? Or, to the cruel fate commanding her life? Alex wasn't sure.
And just like yesterday and several days before, Alex wasn't able to help Maya. Alex felt he was never able to help his only childhood friend. In that kind of time, a certain entity approached him. They offered him and Maya a second chance in life. In another world, that is. Desperate and feeling like there was no other option, he accepted their proposal.
"Please erase her memory and let her choose her own life. " was the last thing Alex requested from the entity, and they responded with a little smile.
" Maya, let's go home. " Alex shows himself in front of Maya's desk. She responds with a warm smile.
" Let's go. "
Alex usually walks a bit faster than Maya. But, as he recalls something from his past, he decides to walk just behind his co-worker and shows a bit of relief.
"Are you happy right now, Maya?"
Created: 2022-05-11 00:55:06