Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Name: Biprodas Barai

ID: 1804058
Issues from given resources:
1) Adding new features is becoming very difficult.
2) During the pick hours, the site runs very slowly.

Proposed Solution for Problem One

Reason for difficulties:


This spaghetti code does not follow any standardization, modifying or adding new features is
difficult here. So to get free from this complexity we should refactor and re-folder structure.
So we can follow a Code architecture Like Clean Code architecture.

Let's describe Clean code architecture and where should be our Code structure like below.

If we follow the Onion Structure:


Our Folder Structure

SRC
Domain
Entity
......
Applications
Behaviors
.......

Infrastructure
Persistence
......
Presentation
Controller
.......

Domain Layer
Entity
User
Photo
Comment
Like

Application Layer
Behavior
UserService
PostService
PhotoService
CommentService
LikeService

Infrastructure
Persistence
………………………
Presentation Layer
Controller

UserController
GET/user
POST/user/{id}
GET/{id}
PUT/user
PATCH/user/type={type}
POST/user/login

PostController
GET/
POST/ post/{user_id}
GET/{id}
PUT/post/{post_id}
DELETE/post/{post_id}

PhotoController
GET/
GET/{id}
POST/ photo/{user_id}
DELETE/photo/{post_id}

CommentController
POST/comment/post/{post_id}
PUT/comment/post/{post_id}/{comment_id}
DELETE/comment/post/{post_id}/{comment_id}

LikeController
POST/like/post/{post_id}/type={true|false}
POST/like/photo/{photo_id}/type=false

Summary
Now the code will be more readable and to add new features it will be easier, don’t have to face
any complexity. It will save time and cost.
Proposed Solution for Problem Two

Reason for slow site running:


Due to the low resources of RAM and power processing in the pick it makes slow loading.

There is also a problem:


No vertical and horizontal scaling is not possible here.
If we buy a server then not enough money left to put a load balancer in front of it.

So there might be the best solutions for our application host in the Cloud.
I prefer from my side we may host in AWS(Amazon Web Service).

The reason why I want to prefer AWS for hosting.

1. Pay-as-you-go Model: AWS provide this model and our pick time definited (6:30 pm to
11:00 pm). So we do have not to extra pay there and our application is for a long time so
it will be a most considerable point.

2. Scalability: It offers easy scalability. we can increase or decrease resources based on


demand, allowing for flexibility and cost optimization. So have not to think about load
balancing. It will scale automatically horizontally or vertically so no problem with RAM.

3. Managed Services: Cloud providers handle the infrastructure maintenance, including


hardware upgrades, security patches, and backups, reducing operational overhead. As it
provides infrastructure we have not be worried about processing power and extra
maintenance costs it will save money and time.

4. Global Reach: Cloud providers have data centres in multiple regions, allowing us to
deploy resources closer to your users for improved performance. So we have not been
thinking about server down, fault tolerance.

In summary 5000 users, the cost difference might not be significant, and other factors such as
ease of management, scalability, and flexibility could be more critical. So Cloud services will
provide a convenient and flexible solution for smaller workloads.

You might also like