How to deal with tasks you don't know?
Tags: programming, beginners
Published: 2023-08-17 18:31:32

Maybe up to this point you've always done tasks based on your prior experience or learnings like from a course or a lesson learned from school but this won't always be the case in the real world or even in your personal projects.

There's always some task or problem that we won't just be prepared to solve out of the box. So how do we deal with these kinds of situations?

As of writing, I'm also in a situation like this so this is also a kind of reminder to myself so hope it helps us both.

Here are the things I can think of and what has helped me in the past:

 

## 1. **Stop overthinking / calm down** 
It can be tempting to get pressured and worry about not knowing how to solve it but a deep breath is sometimes the most effective solution. Keeping calm under a stressful situation will be the key to doing the other steps.

## 2. Assess 
Assess or review your discussions, ticket, request, or problem statement. Identify what your main goal is. If you want to be sure, it should be a short one sentence that's clear and straight to the point.

## 3. Identify the key actions
Then identify and divide important actions that you think you can do in steps to reach that main goal. 

This is where you just need to stick to the basics/foundations. Even if you don't exactly know how to do it as long as you're aware of the high-level step you need to take no matter how vague it is. 

At this point and beyond, it doesn't hurt to ask your supervisor, product owner, or ticket creator for clarifications. 

## 4. Fill in the gaps
Do your homework. Identify then fill out the areas you're lacking like if you have no clue on how the process works, then either ask the product owner or just try apps that has feature you're about to implement.

Maybe there's already an existing module but you haven't understood it well enough because you didn't need to before, then spend some time reviewing it and testing it out before you do any changes.

Last of many other possible situations, maybe there's a certain package or service that you need to use with this. Then spend at least some time trying out the package separately in an isolated playground environment before using it if you can.


## 5. Focus on the MVP (minimum viable product) or POC (proof of concept)
There are usually a lot of things you need to account for in the development but if you honestly don't even know how to do it in the first place, don't bother accounting for additional complexity until you've already made something work. You can always do refactoring when you're confident of the process and the important/key actions in the code.

Weirdly enough doesn't the first letters of each item spell out S.A.I.F.F. or SAFE? 

![Mind Blown GIF](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3obcclu4ehm17ep63cwq.gif)

Link to Tenor Gif: [https://tenor.com/view/mind-blown-explosion-mind-gif-4572252](https://tenor.com/view/mind-blown-explosion-mind-gif-4572252)

## Example

Maybe an example would be helpful, what if you were assigned to write an API for a rewards service for users like badges based on their stats. 

This is your first time implementing such a feature so applying step 1, take a deep breath and think. Apply step 2, you ask yourself

**What is the main goal?**

If I would answer it, the main goal is to be able to _provide rewards to the users by linking a badge item to their account_. 

Applying step 3, I can think of the following steps to reach this main goal:

1. Get a list of the rewards either from DB (through query) or the config if hardcoded
2. Create an API that can retrieve a user's stats from DB using their id or username
3. Add conditions to that API to do checks whether their stats have reached or met the requirements in the rewards list
4. Create a new table that can store the rewards/badges awarded to users to maintain persistence (maybe user_badges or user_redeemed_rewards idk)
4.1 There should be at least 1 field or column that contains a URL to the badge image (maybe an Amazon S3 link)
5. Use the new table to check if the user has already been awarded the badge if there's no row yet of the user assigned that specific badge, create a new record else don't add a new row. 
**Make sure the badge data assigned to the user is retrieved from the table if it's stored in DB
6. Make sure that this API can be called on the front-end and accepts the proper parameters (id or username) and returns the appropriate response in our case if there's a new badge or badges just return the list of new badges so that the web application can render it immediately once checked. 

Applying step 4, I think maybe if you haven't done it before the gaps to fill-in is the stat checking (some maybe simple boolean checks but some maybe computed) so make sure what are the stat checks to do.

Applying step 5, just focus on creating an API that retrives the user's stats and assign a badge for example and once you see it rendered on your local web app. Then you can go back to the steps and implement it properly. 

By this point, you've successfully implemented a kind of reward / badge service for your application. 

So I guess that's it. I hope you enjoyed reading through this article and I also hope that it helps/helped in dealing with your challenging task.

This is purely optional but I would really appreciate a coffee or two through buy me a coffee [https://www.buymeacoffee.com/royce.chua](https://www.buymeacoffee.com/royce.chua). 


[![Buy me a coffee button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/owzqb9btja00l07hootq.png)](https://www.buymeacoffee.com/royce.chua)

Thank you very much. I'm very excited to write more content.