Creating Problems into Pseudocode

Jason Padilla
CodeX
Published in
4 min readJul 31, 2022

The hardest thing about coding is not the work itself; it is knowing how to solve a problem. And in this article, I will share my thought process of destructing a problem from a high-level standpoint to pseudo-code. Reminder: This is my way of thinking, not the absolute way, so feel free to comment below on what you liked about it or what could be changed. Let’s Begin!

Problem

Too much Problems, not enough Subproblems

A friend of yours is developing a website similar to Fiverr to display companies and their services. They want to build a rating system (in the backend) that allows each user to rate a particular company and see the average rating for a specific company; however, they seem stuck on navigating this problem.

First Step: Destructing

The first thing you want to do when working on a problem is to break it down. If given a jigsaw puzzle, looking at the whole picture and trying to solve it may become overwhelming. Breaking down the image into different parts makes it more manageable as you know what needs to be accomplished. For the problem above, let’s break it down into separate pieces. “The user wants to rate a particular company”; if the user rates a particular company for the first time, they’ll send a new rating about that company. Now, what if the user wants to change their origin; rating; let’s say they initially rated the company Brain’s Workshop 3 out of 5 stars but now wants to change it to 4 out of 5 stars. The user wants to update their previous rating about that particular company. But now, suppose the user wants to delete their rating about Brian’s Workshop as they feel it is no longer valid. Everything previously mentioned is a case that can come up when working on the problem: Develop a rating system that allows users to rate a particular company. By breaking it down into more minor issues, you can now create sub-problems that, when finished, complete the bigger picture.

Second Step: Pseudocode

Now that we have broken down the problem into sub-problems let’s begin pseudo-coding. For those that may be unfamiliar with pseudocode, it’s a way for programmers to describe, explain and design algorithms or systems without writing actual code. With that out the way, let’s restate our sub-problems again:

  1. Users should be able to rate a given company
  2. Users should be able to change a rating they previously made
  3. Users should be able to delete their rating
  4. Users should be able to see the average rating of said company
  • Users should be able to rate a given company. Typically, a user should only be able to place a company once to avoid false average ratings. Afterward, any new rating to that company will update the original one. We should create an endpoint that uses a POST request to send a rating to the server about a particular company.
  • Users should be able to change a rating they previously made. As stated before, if a user wants to change their rating, it will just update their original one. Considering this, an endpoint that uses a PUT request should update a rating that was once made.
  • Users should be able to delete their ratings. Pretty self-explanatory, a user wants to delete a rating they made, so we create an endpoint with a DELETE request to delete a rating they made about a particular company.
  • Users should be able to see the average rating of said company. The company’s average rating should be displayed when a user comes across a company. If we want that data to be displayed, we make an endpoint with a GET request that reads the average rating of a particular company.

Conclusion:

Now, remember, this is me only breaking down a problem. There’s still a lot that comes into play when navigating a problem. We haven’t mentioned what framework we’ll be using to create the endpoints previously said, what server we’ll be producing, or how we’ll be displaying this rating system on the website. However, that is for you to decide on me, depending on if I make another article about this. We’ll see, until then I hope this article finds useful to you. Have a great day!

--

--

Jason Padilla
CodeX
Writer for

Software Engineer in Training. Marcy Lab School Graduate