Part 1 of Mastering Backend Development
Created by OpenAI's DALL-E

Part 1 of Mastering Backend Development

Hi there!?? . I am Oleksii, and here you can find articles about backend development and software architecture. I am trying to provide helpful content not only for people who have recently started their journey into backend development but also for experienced engineers. If you're new to my content and want more articles like this, click the "subscribe" button above or at Substack...


What is the backend development?

I want to start this series of articles about how to become a backend engineer or improve if you are already one by setting some foundation and describing the basic concepts. And first, explain how I understand what the backend development is.

The backend is everything behind the scenes on the server when you visit your favourite website or mobile application. It is responsible for storing and managing the data you see and use on the website. Let's take LinkedIn as an example; the backend stores information about your account and profile information, your job history search and preferences, connections and followers for your account and much more. The backend engineer's job is to ensure that information is stored correctly, secure, and accessible to the user. So this is what this series of articles will explain how to do. Let's get started!

IslandX: The Ultimate Pacific Escape Platform

I think the best way to learn something is by doing it, so I want to make it interactive and hands-on.

Disclaimer: The concepts I will cover are language agnostic, but in articles, I will use Java/Kotlin or pseud-code examples, as well as Spring Boot Framework, to illustrate an example of implementation. Articles will not cover learning Java/Kotlin or Spring Boot framework, but I will try to explain and provide links to the documentation where you can learn more about the language and framework along the way, and you can always ask me questions if something is unclear.

In this course, you will work with imaginary developer Max, who recently started his journey as a backend engineer and has an exciting project. The name of the project is IslandX: The Ultimate Pacific Escape Platform. The description of the project that he received is the following:

Last month, an underwater volcano formed a new island in the Pacific Ocean. All the conditions on the island seemed perfect, and it was decided to open it up for the general public to experience the pristine, uncharted territory. The island is big enough to host a campsite, so everybody is excited to visit, and there is already an extensive waiting list of people from all over the world. To regulate the number of people on the island, it was decided to develop an online web application to manage the reservations. You are responsible for designing and developing a backend system to manage the campsite reservations that will be able to handle the load of all the people who want to make a reservation. To streamline the reservations, a few constraints need to be in place:

  1. The campsite will be free for everyone.
  2. The campsite can be reserved for a maximum of 3 days.
  3. The campsite can be reserved at least one day(s) before arrival and up to 1 month in advance.
  4. Reservations can be cancelled anytime.
  5. All visitors must be registered on the platform and validate their identity for security reasons.

Max can not wait to start working on the project and draws his first diagram to understand better what the system may look like. He decided to start with the simple architecture, which you can find in Image 1, with three components: a client represents a web interface to the reservation system, the server where all logic will happen, and the database where reservations and visitor information will be stored. This kind of architecture is called 3-tier architecture.

Image 1: The 3-tier architecture of the IslandX system

You can read more about 3-tier and N-tier architecture in the AWS Whitepaper: "AWS Serverless Multi-Tier Architectures with Amazon API Gateway and AWS Lambda" [1] or in the Azure Architecture Center: "N-tier architecture style" [2].

Max is responsible for developing the Logical And Data layer of the system, so let's talk a bit more about them.

The server is the brain of the application that will handle information about reservations, allow new ones to be made, and store visitors' information. Some different languages and frameworks can be used to implement this business logic; examples of some highly used pairs of languages and frameworks:

  1. Python with Django
  2. C# with ASP.Net
  3. Java or Kotlin with Spring Boot | Quarkus | Micronaut
  4. Ruby with Ruby on Rails

Max knows some Java and has Spring Boot experience, so he decided to use them.

For the Reservation web application to communicate with the server, Max needs to write an application programming interface(API), which can be described as a set of definitions and protocols for building and integrating application software. [3]. There are different API writing protocols:

  • REST - It stands for REpresentational State Transfer. It is a loose set of rules that has been the de facto standard for building web API since the early 2000s.
  • GraphQL - provides a schema and type system suitable for complex systems with graph-like relationships between entities.
  • Web socket - Allows clients to establish a bi-directional connection with the server to receive real-time updates. Unlike REST, which always "pulls" data, web socket enables data to be "pushed".
  • Webhook - Webhooks are usually used by third-party asynchronous API calls to provide specific updates or information to your backend.
  • gRPC - A high-performance Remote Procedure Call (RPC) framework based on the idea of defining a service and specifying the methods that can be called remotely with their parameters and return types.
  • SOAP - SOAP stands for Simple Object Access Protocol. Its payload is XML only, suitable for communications between internal systems.

To choose which to use, Max decided to read a good article from Alex Xu that gives an overview of them: "What are the API architectural styles?". After checking out the requirements and options, Max chose to start with the REST since it is commonly used for this type of system he needs to develop.

A database represents the data layer, and choosing the database for the backend system is as essential as selecting the language and framework. There are different types of databases with varying areas of application:

  1. Relational or SQL Databases - Postgres, MySQL, Oracle, and more.
  2. No-SQL Databases - MongoDB, Neo4J, Cassandra, Redis, and more.
  3. Time-Series Databases - InfluxDB, Elasticsearch and more.

Then, it can be divided by structure types: Columnar, Graph, Key-Value, geo-spatial, document-based and more. The database topic has lots of information, and the choice depends on the developed system, requirements, constraints and dependencies that existing systems and infrastructure can cause, as well as the expertise present in the team. I will not focus on details about every database type, but you can check the article "A nice cheat sheet of different databases in cloud services" by Alex Xu , which can be a starting point for reading more about a particular database.

IslandX system needs to store different data, such as reservation information or visitor information, which can be structured very well, so Max decided to use a relational database and chose Postgres because it is open-sourced, has a huge community, and offers many features.

Now, when the components are decided, Max decided to go over the requirements again and identify what functionality the backend system should provide before jumping into the coding. He wrote it as a set of statements with details on what he should consider during development:

  1. The users will need to find out when the campsite is available. So, the system should expose an API to provide information on the availability of the campsite for a given date range, with the default being one month.
  2. The user will provide their email, full name and identity document when reserving the campsite, along with the intended arrival date and departure date. The system needs to expose an API for registration and login for the user to manage the reservation later and store identity documents securely, preventing unauthorized access.
  3. To provide the reservation functionality, the system should provide appropriate endpoint (s) to allow reservation creation/modification/cancellation of the reservation. During reservation creation, the user will receive a unique identifier for the reservation that can be used to modify or cancel the reservation later.
  4. Due to the island's popularity, multiple users will likely attempt to reserve the campsite for the same/overlapping date(s). The system should be able to handle concurrent requests to reserve a campsite gracefully. The system should be able to handle a large volume of requests for getting a campsite availability.

Max knows that he may have missed something, but for now, he has an idea of what he needs to develop and what the expectations are from the system. The next step is creating a project, and Max will use Spring Initializr to make things easier.

Max is leaving to create a project and prepare to write the first lines of code for this project, and next time, Max will start building his first APIs using Spring Boot and understand the different HTTP methods and statuses.

If you are unfamiliar with Spring Boot and creating services using it and want to read more before the next part, you can check out a great tutorial from Spring about Building REST services with Spring!

Subscribe if you want to follow Max's journey to becoming a great backend engineer and learn something new while creating the IslandX project!



Feel free to let me know if this interests you or if there are any suggestions or additional topics you would like me to cover as part of this series of articles.


References

[1]: AWS Serverless Multi-Tier Architectures with Amazon API Gateway and AWS Lambda, AWS Whitepapers, accessed on January 27 2023, https://docs.aws.amazon.com/whitepapers/latest/serverless-multi-tier-architectures-api-gateway-lambda/introduction.html

[2]: N-tier architecture style, Azure Architecture Learning Center, accessed on January 27 2023, https://learn.microsoft.com/en-us/azure/architecture/guide/architecture-styles/n-tier

[3]: June 2, 2022, What is an API?, Red Hat, accessed on January 27 2023, https://www.redhat.com/en/topics/api/what-are-application-programming-interfaces

要查看或添加评论,请登录

Oleksii Skorykh的更多文章

社区洞察

其他会员也浏览了