<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohamed Sweelam</title>
    <description>The latest articles on DEV Community by Mohamed Sweelam (@sweelam).</description>
    <link>https://dev.to/sweelam</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1100987%2Fce878a0f-9a65-4844-a42c-e53473039463.jpeg</url>
      <title>DEV Community: Mohamed Sweelam</title>
      <link>https://dev.to/sweelam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sweelam"/>
    <language>en</language>
    <item>
      <title>A Thoughtful Approach to Databases in Cloud-Native Architectures</title>
      <dc:creator>Mohamed Sweelam</dc:creator>
      <pubDate>Sat, 25 Jan 2025 18:15:43 +0000</pubDate>
      <link>https://dev.to/sweelam/a-thoughtful-approach-to-databases-in-cloud-native-architectures-2a0a</link>
      <guid>https://dev.to/sweelam/a-thoughtful-approach-to-databases-in-cloud-native-architectures-2a0a</guid>
      <description>&lt;p&gt;Many engineers still confuse Single-Tenant Databases with Multi-Tenant Databases when discussing cloud-native systems like Microservices. They often think of a database as just a container they can request on-demand, forgetting that a database is a valuable asset that requires proper care—especially while keeping costs manageable. In this short article, I will tell you, how you should take care of your lovely database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs1nv0ormgobgdkittog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs1nv0ormgobgdkittog.png" alt="Budget Constraint" width="554" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  It is all about Performance
&lt;/h2&gt;

&lt;p&gt;Youssif is a skilled software engineer who designs systems capable of supporting operations for many years. One day, he was discussing with his friend Alex the database design they needed to consider for a new system expected to scale rapidly.&lt;/p&gt;

&lt;p&gt;Alex said, "We are building cloud-native systems, so we must follow the database-per-service pattern to avoid the known issues associated with shared databases in microservices."&lt;/p&gt;

&lt;p&gt;Youssif replied, "That's a good idea. What do you think, Alex? What should we ask the DevOps team to prepare for us?"&lt;/p&gt;

&lt;p&gt;Alex said, "Since we're using AWS, we should request multiple RDS instances. Let’s start with the initial design and provision nine RDS instances to serve nine microservices applications."&lt;/p&gt;

&lt;p&gt;Youssif said, "I don't think that's the right approach. We should first talk to the team to understand more about the system's qualities and the performance they expect. If their operations aren't too demanding and they’re constrained by budget, I’d prefer starting with a single RDS instance but using multiple databases or schemas. What do you think?"&lt;/p&gt;

&lt;p&gt;Alex: "That's a good idea!"&lt;/p&gt;

&lt;h2&gt;
  
  
  Various Methods for Constructing the Pattern
&lt;/h2&gt;

&lt;p&gt;Thinking about design patterns is like teaching a student. You want to help them learn something from a book, but every teacher has their own unique way of teaching. In the end, all of them ensure that the student understands the concept presented in the book.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2zg44ccjdnb80zejawb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2zg44ccjdnb80zejawb.png" alt="HLD" width="800" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The High-Level Design (HLD) shown above represents the initial architecture for a ride-sharing application similar to Uber. The team decided to use an Oracle database for their needs, for whatever reason. Given that Oracle licensing costs are significantly high, does it make sense to ask the DevOps team to provision multiple Oracle servers for the application? No&lt;/p&gt;

&lt;p&gt;But they need to build a feature to manage organization offers—something resembling multi-tenancy. Did you forget the pattern? No, I didn’t. But did you forget the teacher example I shared with you?&lt;/p&gt;

&lt;p&gt;Of course, they can provide multi-tenant support without violating the pattern by leveraging Oracle's multi-database features. This approach offers several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resource Optimization: Requires fewer hardware and infrastructure resources.&lt;/li&gt;
&lt;li&gt;Cost Efficiency: Significantly reduces Oracle licensing and operational costs.&lt;/li&gt;
&lt;li&gt;Improved Code Design: Encourages cleaner and more maintainable architecture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All they need is to make every microservice accessing specific database. The setup might look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Microservice 1 → Database 1
Microservice 2 → Database 2
Microservice 3 → Database 3
...
Microservice N → Database N
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They can also manage database creation dynamically with something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE tenants (
    tenant_id VARCHAR(50) PRIMARY KEY,
    db_url VARCHAR(255),
    db_username VARCHAR(50),
    db_password VARCHAR(50),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And a nice dynamic code that manages tenants over DB&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class TenantService {

    private final JdbcTemplate adminJdbcTemplate;

    public TenantService(JdbcTemplate adminJdbcTemplate) {
        this.adminJdbcTemplate = adminJdbcTemplate;
    }

    public void createTenant(String tenantId) {
        String dbName = "tenant_" + tenantId;

        // Step 1: Create Database
        adminJdbcTemplate.execute("CREATE DATABASE " + dbName);

        // Step 2: Initialize Schema
        JdbcTemplate tenantJdbcTemplate = new JdbcTemplate(
            DataSourceBuilder.create()
                .url("jdbc:mysql://localhost/" + dbName)
                .username("root")
                .password("password")
                .build()
        );

        tenantJdbcTemplate.execute("CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(100), email VARCHAR(100));");

        // Step 3: Save Metadata to Admin DB
        adminJdbcTemplate.update(
            "INSERT INTO tenants (tenant_id, db_url, db_username, db_password) VALUES (?, ?, ?, ?)",
            tenantId, "jdbc:mysql://localhost/" + dbName, "root", "password"
        );
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Designing databases for cloud-native systems requires a careful balance between scalability, cost efficiency, and maintainability. While the database-per-service pattern is ideal for avoiding the pitfalls of shared databases in microservices, its implementation must consider the system’s performance requirements and budget constraints. Ultimately, the choice of database architecture should be guided by the system’s unique needs. By thoughtfully applying design patterns and leveraging features like dynamic provisioning, teams can build robust, scalable, and efficient cloud-native applications. Remember, the goal is not just to follow a pattern but to adapt it to ensure the system operates effectively within its constraints.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Endless Journey: When Does Learning Really Stop?</title>
      <dc:creator>Mohamed Sweelam</dc:creator>
      <pubDate>Thu, 18 Apr 2024 14:12:47 +0000</pubDate>
      <link>https://dev.to/sweelam/when-does-learning-stop-4883</link>
      <guid>https://dev.to/sweelam/when-does-learning-stop-4883</guid>
      <description>&lt;h2&gt;Know the Truth&lt;h2&gt;&lt;/h2&gt;
&lt;br&gt;
The majority of industries are bustling with activity, but none are quite as frenetic as the software industry. This dynamic field is not only vast but constantly evolving, often introducing new developments even as we try to keep up with the existing ones.

&lt;/h2&gt;
&lt;p&gt;Many engineers contemplate switching to other fields, sometimes even within the software industry itself, believing that a new field might offer greater comfort and better opportunities. However, they often overlook the harsh reality—a reality that weighs heavily on anyone who isn't careful.&lt;/p&gt;

&lt;p&gt;It has always been acceptable to take a break, perhaps for a couple of years, especially if you enjoy routine work and are comfortable with it. However, in today's 'AI era', such complacency can be genuinely dangerous. You will face numerous doubts, fears, and anxieties; every day, you might hear about new developments in the field that could significantly impact you.&lt;/p&gt;





&lt;h2&gt;You aren't Alone&lt;h2&gt;&lt;/h2&gt;
&lt;br&gt;
It can certainly feel overwhelming, given the ever-increasing amount of knowledge you need to acquire each day. However, remember, you are not alone in this journey. Try to see it from a different perspective: Why shouldn't we learn? What stops us? We are here to help and support each other, to uplift our communities. Isn't that truly exciting? &lt;br&gt;

&lt;/h2&gt;
&lt;p&gt;The great thing about this career is that it's genuinely exciting. It may feel frustrating when you can't get things right the first time, but the joy of finally succeeding is unmatched. You become the happiest person in the world, and you'll always cherish that triumphant moment when you can say, 'It works!'&lt;br&gt;
&lt;/p&gt;

&lt;br&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6guizedljt4rqrydxww.png" alt="I make it finally!" width="800" height="800"&gt;


&lt;h3&gt;Navigating Progress Together: Staying Updated&lt;h3&gt;&lt;/h3&gt;
&lt;br&gt;
To stay updated, it’s crucial to understand how to collaborate and keep pace with others. Knowing where to go, how to stay informed, and finding answers to these essential questions are key components of maintaining relevance in your field.

&lt;/h3&gt;
&lt;p&gt;I will try to help you with some tips and tricks that can enable you be always updated:&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Book Rankings and Reviews&lt;/strong&gt;&lt;br&gt;
On platforms like Amazon, you can explore a wide selection of books, paying close attention to bestsellers and rankings. Book reviews are also invaluable, providing insights that can help you decide which book to purchase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Utilizing GPTs&lt;/strong&gt;&lt;br&gt;
Today, tools like ChatGPT are reliable sources for obtaining trusted information. By upgrading to a GPT-4 account, you can use it not only to discover book recommendations but also to explore other essential resources, such as learning paths and course suggestions; by they way, the images attached in this article are all generated by AI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Social Media Engagement&lt;/strong&gt;&lt;br&gt;
On Twitter, consider following engineers and company profiles from your industry of interest. These accounts often share updates about new developments and innovations, providing timely insights directly from the source.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Choosing Online Learning Platforms&lt;/strong&gt;&lt;br&gt;
The number of online learning platforms is rapidly increasing. It's advisable to focus on one or two platforms to avoid information overload. Conduct thorough research before making your choice. For instance, Coursera and LinkedIn Learning are excellent starting points for a wide range of educational content.&lt;br&gt;
&lt;/p&gt;




&lt;/li&gt;

&lt;/ul&gt;


&lt;h2&gt;Balancing Learning and Well-being&lt;h2&gt;&lt;/h2&gt;
&lt;br&gt;
While the pursuit of knowledge is commendable, overwhelming yourself with too many subjects simultaneously can be detrimental to your health. Implementing a strict scheduler can help you manage your learning pace effectively.

&lt;/h2&gt;
&lt;p&gt;It’s great to stay informed about current trends, but remember, you don’t need to master every detail. Keeping yourself updated in a manageable way is the best approach in this fast-paced environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F16dkl6tixsypon9a5514.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F16dkl6tixsypon9a5514.png" alt="leanrning" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h2&gt;Conclusion&lt;h2&gt;&lt;/h2&gt;
&lt;br&gt;
In conclusion, the journey through the software industry, or any field of rapid innovation such as the AI era, poses unique challenges and opportunities. The key to thriving is not just keeping pace with technological advancements but also managing our learning and well-being thoughtfully.

&lt;/h2&gt;
&lt;p&gt;Embracing continuous learning, leveraging tools like GPT, engaging on social media, and selecting online platforms are all effective strategies to stay current and relevant. However, it is equally important to remember that we do not need to master every detail or chase every trend.&lt;/p&gt;

&lt;p&gt;Setting realistic goals, using tools like scheduling for balance, and reminding ourselves that we are part of a supportive community can make this journey less overwhelming and more rewarding. Ultimately, the aim is not just to survive but to thrive, finding joy and satisfaction in our achievements and in the knowledge that we are moving forward together.&lt;br&gt;
&lt;/p&gt;


</description>
    </item>
    <item>
      <title>Beyond Code: Understanding the Value of Documentation</title>
      <dc:creator>Mohamed Sweelam</dc:creator>
      <pubDate>Wed, 14 Jun 2023 02:43:20 +0000</pubDate>
      <link>https://dev.to/sweelam/beyond-code-understanding-the-value-of-documentation-9l</link>
      <guid>https://dev.to/sweelam/beyond-code-understanding-the-value-of-documentation-9l</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Working as a software engineer in a team necessitates seamless collaboration, where teammates can easily find the information they need. To facilitate this, it is crucial to support your work with comprehensive documentation. This ensures that your teammates can readily access the required information in an effortless manner, fostering clear and efficient cooperation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Case: Flight System
&lt;/h2&gt;

&lt;p&gt;Assuming you are working with a team that is building distributed systems, specifically a microservices application. Let's consider an example of a flight system that consists of three microservices: &lt;code&gt;customer-service&lt;/code&gt;, &lt;code&gt;flight-service&lt;/code&gt;, and &lt;code&gt;email-service&lt;/code&gt;. Additionally, the system includes various components such as databases, caching, and messaging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can you imagine?&lt;/strong&gt; Of course, you can. However, in reality, imagination alone is not sufficient. It is crucial to have tangible resources at hand. That's why it is essential to prepare your first document called the 'High-Level Design' (HLD for short)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmtekvezxf299vietu8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmtekvezxf299vietu8y.png" alt="HLD Diagram" width="757" height="713"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What did you feel after looking at the diagram? feeling better, no?&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  UML Diagrams
&lt;/h3&gt;

&lt;p&gt;As a software engineer, you should be aware of &lt;a href="https://www.uml-diagrams.org/uml-25-diagrams.html" rel="noopener noreferrer"&gt;UML digrams&lt;/a&gt; , you might be wondering, Isn't self-code doc enough? something like java-doc or maybe swagger! although it is perfectly fine to support your code with these docs, but it is not enough for your teammate to understand your "solution design".&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Assuming you have an API that's doing the actual flight booking.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F074cexkeeynk1zz7c98a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F074cexkeeynk1zz7c98a.png" alt="Code snippet" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The API is doing the followings: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;validating the input&lt;/li&gt;
&lt;li&gt;calling &lt;code&gt;customer-service&lt;/code&gt; to get customer details&lt;/li&gt;
&lt;li&gt;updating the database&lt;/li&gt;
&lt;li&gt;send email via &lt;code&gt;email-service&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Now, the question is, How can your teammate know?
&lt;/h3&gt;

&lt;p&gt;Your teammate, who is working with you on the same application, wants to utilize your code, potentially adding new features or integrating it. They need to review your solution design from a helicopter view before diving into the details and without having to contact you.&lt;/p&gt;

&lt;p&gt;Here, the Sequence Diagram comes into play.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frx7cdadkod8kl67vhkp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frx7cdadkod8kl67vhkp1.png" alt="Sequence Diagram" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By providing a supporting diagram for your solution, you can greatly simplify your friend's understanding of the system. This approach ensures clarity for everyone, including new team members. Furthermore, when presenting your work to the team, you will be able to illustrate the solution efficiently, saving valuable time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Documentation should be mandatory for any system you work on, rather than being optional. Treating documentation with the same level of importance as the code base is crucial. It allows for clear understanding, maintenance, and future development of the system. Moreover, it is essential to choose the appropriate location to store and maintain the documentation, ensuring easy accessibility for the entire team.&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>distributedsystems</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
