Extremely disappointing customer service from @redBus_in! The chatbot fails to understand customer concerns and keeps repeating the same questions. Even the phone support team offers little to no help. Frustrating experience overall. 😑
Explaining 9 Types of API Testing
🔹 Smoke Testing
This is done after API development is complete. It simply validates if the APIs are working and nothing breaks.
🔹 Functional Testing
This creates a test plan based on the functional requirements and compares the results with the expected outcomes.
🔹 Integration Testing
This test combines several API calls to perform end-to-end tests. It tests intra-service communications and data transmissions.
🔹 Regression Testing
This test ensures that bug fixes or new features don't break the existing behaviors of APIs.
🔹 Load Testing
This tests an application's performance by simulating different loads. It helps calculate the capacity of the application.
🔹 Stress Testing
This deliberately creates high loads on the APIs to test if they are able to function normally under stress.
🔹 Security Testing
This tests the APIs against possible external threats to ensure security.
🔹 UI Testing
This tests the UI interactions with the APIs to make sure the data is displayed properly.
🔹 Fuzz Testing
This injects invalid or unexpected input data into the API and tries to crash it. This helps identify API vulnerabilities.
–
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/kNfv0DVDdf
1/3 Monorepo World
Everything monorepos and dev tooling
Where: Mountain View, CA
When: October 2024
Learn more here: https://t.co/GKMpgZzJ4t
@MonorepoWorld@NxDevTools
MVC vs MVP Architecture — What’s the Difference?
MVC (Model View Controller) and MVP (Model View Presenter) are design patterns that separate an application into distinct components.
Both patterns aim to separate concerns, but they have some differences in their approach.
To get a clear picture of how each pattern works and the differences between them, let’s break down how they operate:
1) User interaction
Both patterns start when a user interacts with the application's UI, which is managed by the View.
2) Event handling
The view recognizes user activities that cause events, such as button clicks or keystroke events. In MVC, the View forwards the event to the corresponding Controller. Whereas, in MVP, the View forwards the event to the related Presenter.
3) Business logic
In both patterns, the Controller and Presenter take over at this stage. Both components process the event and apply any business logic required. They also decide if data manipulation is necessary, and if so they interact with the Model.
4) Model update
The process at this stage is again very similar for both patterns. If data changes are required, then both the Controller and Presenter will instruct the Model to update its data. The Model will then handle the data manipulation and persist the changes.
5) UI updates
This is the main area where the two design patterns differ. In the MVC pattern, the View listens for changes in the Model and updates itself accordingly. In MVP, the Presenter plays an active role. It fetches the new data from the Model and directly updates the View to reflect those changes.
MVP was established after MVC to improve on the drawbacks of MVC.
Both patterns aim to separate concerns and improve maintainability. However, their procedure diverges when it comes to who handles the business logic and how the UI gets updated.
MVC is typically less complex but it can have tightly coupled components. Whereas, MVP is generally more complex but has more decoupled components.
~~
A big thank you to our partner Postman who keeps our content free to the community.
Did you know Postman just released a package library feature that enables reusable scripts (I.e., change once, use everywhere)? Significantly faster development. Check it out: https://t.co/vGn7utvQwc
What are the differences between WAN, LAN, PAN and MAN?
In the world of networking, different types of networks are defined based on their size, range, and purpose. The most common types of networks are WAN (Wide Area Network), MAN (Metropolitan Area Network), LAN (Local Area Network), and PAN (Personal Area Network).
1. Personal Area Network (PAN)
A PAN is a network used for communication among devices close to one person, typically within a range of a few meters.
Use Cases:
- Connecting personal devices like smartphones, tablets, and wearables.
- Enabling hands-free communication through Bluetooth headsets.
- Synchronizing data between a computer and a smartphone.
2. Local Area Network (LAN)
A LAN is a network that connects computers and devices within a limited area such as a home, office, or building.
Use Cases:
- Sharing resources like printers and file servers within an office.
- Facilitating communication and collaboration among employees.
- Providing internet access within a home or small business.
3. Metropolitan Area Network (MAN)
A MAN covers a larger geographic area than a LAN but smaller than a WAN, typically spanning a city or a large campus.
Use Cases:
- Connecting multiple campuses of a university.
- Providing high-speed internet access across a city.
- Linking local government offices within a metropolitan area.
4. Wide Area Network (WAN)
A WAN spans a large geographic area, often a country or continent. The most prominent example of a WAN is the Internet.
Use Cases:
- Connecting branch offices of multinational companies.
- Facilitating global communication and data exchange.
- Enabling remote access to central resources.
–
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/uc5M7CdXXC
What is the best way to learn SQL?
In 1986, SQL (Structured Query Language) became a standard. Over the next 40 years, it became the dominant language for relational database management systems. Reading the latest standard (ANSI SQL 2016) can be time-consuming. How can I learn it?
There are 5 components of the SQL language:
- DDL: data definition language, such as CREATE, ALTER, DROP
- DQL: data query language, such as SELECT
- DML: data manipulation language, such as INSERT, UPDATE, DELETE
- DCL: data control language, such as GRANT, REVOKE
- TCL: transaction control language, such as COMMIT, ROLLBACK
For a backend engineer, you may need to know most of it. As a data analyst, you may need to have a good understanding of DQL. Select the topics that are most relevant to you.
Over to you: What does this SQL statement do in PostgreSQL: “select payload->ids->0 from events”?
--
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/uc5M7CdXXC
Oauth 2.0 Explained With Simple Terms.
OAuth 2.0 is a powerful and secure framework that allows different applications to securely interact with each other on behalf of users without sharing sensitive credentials.
The entities involved in OAuth are the User, the Server, and the Identity Provider (IDP).
What Can an OAuth Token Do?
When you use OAuth, you get an OAuth token that represents your identity and permissions. This token can do a few important things:
Single Sign-On (SSO): With an OAuth token, you can log into multiple services or apps using just one login, making life easier and safer.
Authorization Across Systems: The OAuth token allows you to share your authorization or access rights across various systems, so you don't have to log in separately everywhere.
Accessing User Profile: Apps with an OAuth token can access certain parts of your user profile that you allow, but they won't see everything.
Remember, OAuth 2.0 is all about keeping you and your data safe while making your online experiences seamless and hassle-free across different applications and services.
Over to you: Imagine you have a magical power to grant one wish to OAuth 2.0. What would that be? Maybe your suggestions actually lead to OAuth 3.
--
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/uc5M7CdXXC
How to improve API performance?
Here are 5 tips:
1. 𝗣𝗮𝗴𝗶𝗻𝗮𝘁𝗶𝗼𝗻
Pagination is a common optimization technique when result sets are large. By streaming results back to the client in pages, service responsiveness can be improved.
2. 𝗔𝘀𝘆𝗻𝗰𝗵𝗿𝗼𝗻𝗼𝘂𝘀 𝗟𝗼𝗴𝗴𝗶𝗻𝗴
Synchronous logging writes to disk on every API call, slowing down the system. With asynchronous logging, logs are first sent to a lock-free buffer and control is immediately returned. The buffer contents are then flushed periodically to disk, significantly reducing I/O overhead.
3. 𝗖𝗮𝗰𝗵𝗶𝗻𝗴
Frequently accessed data can be cached for fast retrieval. Clients can query the cache first instead of hitting the database directly every time. For cache misses, the database can be queried as a fallback. In-memory caches like Redis provide faster data access compared to databases.
4. 𝗣𝗮𝘆𝗹𝗼𝗮𝗱 𝗖𝗼𝗺𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻
Request and response payloads can be compressed using algorithms such as gzip to reduce transmitted data volume. This speeds up upload and download times.
5. 𝗖𝗼𝗻𝗻𝗲𝗰𝘁𝗶𝗼𝗻 𝗣𝗼𝗼𝗹𝗶𝗻𝗴
Opening and closing database connections has significant overhead. Using a pool of open connections avoids this. The connection pool manages lifecycle events internally.
What other performance optimization tricks have you found useful for APIs?
–
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/kNfv0DVDdf
HTTP Status Code You Should Know.
The response codes for HTTP are divided into five categories:
Informational (100-199)
Success (200-299)
Redirection (300-399)
Client Error (400-499)
Server Error (500-599)
These codes are defined in RFC 9110. To save you from reading the entire document (which is about 200 pages), here is a summary of the most common ones:
Over to you: HTTP status code 401 is for Unauthorized. Can you explain the difference between authentication and authorization, and which one does code 401 check for?
--
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/FIzCeaWsZV
How do we design effective and safe APIs?
APIs have increasingly become the backbone of modern software.
𝗧𝗼 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱 some of the 𝗸𝗲𝘆 𝗽𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲𝘀 and 𝗯𝗲𝘀𝘁 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝘀 𝗼𝗳 𝗔𝗣𝗜 𝗱𝗲𝘀𝗶𝗴𝗻, Let's 𝗮𝗻𝗮𝗹𝘆𝘇𝗲 𝗮 𝘀𝗼𝗰𝗶𝗮𝗹 𝗺𝗲𝗱𝗶𝗮 𝗽𝗹𝗮𝘁𝗳𝗼𝗿𝗺 𝗲𝘅𝗮𝗺𝗽𝗹𝗲:
🔹 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗻𝗮𝗺𝗶𝗻𝗴
Clarity is key when creating APIs.
Adopting simple resource names, like /users for accessing user profiles and /posts for retrieving user posts, streamlines the development process and reduces mental strain.
🔹 𝗨𝘀𝗲 𝗼𝗳 𝗽𝗹𝘂𝗿𝗮𝗹𝘀
It's important to maintain a standard of consistency in API design.
For consistency and readability, use plural resource names, such as GET /users/{userId}/friends vs. /friend), to avoid ambiguity in API requests.
🔹 𝗖𝗿𝗼𝘀𝘀-𝗿𝗲𝗳𝗲𝗿𝗲𝗻𝗰𝗶𝗻𝗴 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀
Interlinking resources, like taking comments on a post using GET /posts/{postId}/comments, simplifies the retrieval of related data.
It provides a more streamlined and well-organized user experience.
🔹 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆
It goes without saying, security is a must-have.
To secure the API endpoints, employ authentication methods like X-AUTH-TOKEN and X-SIGNATURE, and use authorization headers for verifying user permissions.
Learn more about API security here: https://t.co/iAVl6VRmoI
🔹 𝗩𝗲𝗿𝘀𝗶𝗼𝗻𝗶𝗻𝗴
Using versioning and communicating version updates is another important practice.
Endpoints like GET /v2/users/{userId}/posts allow API versioning to maintain functionality regardless of updates.
This approach ensures backward compatibility and a smooth transition for users and us.
Learn more about API versioning here: https://t.co/JwVRzZArr2
🔹 𝗣𝗮𝗴𝗶𝗻𝗮𝘁𝗶𝗼𝗻
This technique is important for performance.
Paginate large datasets, like feeds or comment lists, with GET /posts?page=5&pageSize=20 to enhance data delivery and UX.
🔹 𝗜𝗱𝗲𝗺𝗽𝗼𝘁𝗲𝗻𝗰𝘆
Maintaining API reliability is necessary.
Idempotency ensures that operations like profile updates (PUT /users/{userId}/profile) achieve their intended result, regardless of how often they are executed.
These practices are very important, but there’s still much more to API design.
Learn more about API design here: https://t.co/Z9FLjyzV53
Thorough documentation, powerful monitoring and logging, and consistent error handling are just a few more of the many essential habits required for designing effective and safe APIs.
Adopting these principles and practices enables us to develop secure and performant APIs that deliver good user experiences.
~~~
📩 If you found this helpful, I write an email every Thursday to help you level up your engineering and system design skills. Sign up here: https://t.co/T4o0O5mWsA
A big thank you to our partner Postman who keeps our content free to the community.