DEV Community

Cover image for The HNG Stage 0️⃣ Project
Prince Adigwe
Prince Adigwe

Posted on

The HNG Stage 0️⃣ Project

For HNG Stage 0️⃣, we were required to build an integration with an external API. This integration was to feature rate limiting, timeout
handling, error handling, logging, and a dynamic timestamp among other requirements.

Here's my overall approach.

After reading through the requirements for the project the first time, I planned to read it again for proper understanding. But before I did that, I asked ChatGPT to internalize the project requirements before I read them again.

me n gpt

I then read through the requirements again. This time, gaining a clearer understanding of what was required.
I also asked ChatGPT to help elicit the requirements in case I missed something.

The requirements for the project consisted both of things I could do as well as what I couldn't. Thus, the next thing I did was to go to my paper and pen. I wrote down notes and things that needed clarification before the project could be developed.

MY APPROACH TO DEVELOPING THE SOFTWARE
Days before receiving the requirements for the stage 0️⃣ project, I was reading a book titled "applying UML and patterns" where the author taught how to apply certain patterns and methods in order to get from the requirements of a project to the end-result. Thus, methods learned from this book inspired my approach to developing the software.

I first tried to organize the entire requirements for the project into a use case. The requirements that couldn't fit into the use case were written as extra notes.

Next, I wrote down system contracts which detailed clearer specifications of what the Web service was to achieve for each scenario.

After doing system contracts, I began the design. The book I talked about also taught certain patterns(called the GRASP patterns) that make software design more intuitive and likely to yield maintainable, reusable code. These patterns were applied to the best of my ability.

Below is a picture of my sequence diagrams and class diagrams (after doing it with pen and paper, I realized there were apps for those)

my diagrams

Next, was the Web service implementation. At times I had to deviate from the software design as the situation required (like the book also predicted).

A test-driven approach was taken.

Methods from different books were also adapted, namely "Learning Patterns" and a couple of others (My brain didn't really tag the ideas with book titles 🤔).

Here is a screenshot of a Singleton (a pattern from the book, "Learning Patterns") implemented for the logging feature

Singleton Pattern

At times, I had to look at documentations, ask ChatGPT for help etc

Here are some pictures
FastAPI Documentation

Although sometimes, code wasn't copied from documentations blindly. Below you can see me asking ChatGPT for better understanding of certain code from a documentation

Eventually, the software was completed and pushed to production... Many times...
as I had to try different web hosts.
Each hosting provider disappointed me in one way or the other.

Finally, I was able to deploy it to railway

The project was implemented using Python/FastAPI and was a great opportunity to learn new and exciting things.

Top comments (0)