<?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: Prasanna</title>
    <description>The latest articles on DEV Community by Prasanna (@prasann).</description>
    <link>https://dev.to/prasann</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%2F567215%2Fea375f2e-9f47-4dce-a964-603ad1a283c0.jpeg</url>
      <title>DEV Community: Prasanna</title>
      <link>https://dev.to/prasann</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prasann"/>
    <language>en</language>
    <item>
      <title>What I did to become AWS certified 😎</title>
      <dc:creator>Prasanna</dc:creator>
      <pubDate>Sat, 04 Dec 2021 06:49:28 +0000</pubDate>
      <link>https://dev.to/prasann/working-my-way-to-get-aws-saa-certified--14l2</link>
      <guid>https://dev.to/prasann/working-my-way-to-get-aws-saa-certified--14l2</guid>
      <description>&lt;p&gt;I recently passed the AWS SAA certification 🎉, penning my experience here.&lt;/p&gt;

&lt;p&gt;I have been working with AWS for the past ~3 years on and off based on the projects and client needs. One of the challenges for me is that I was always reactive. Usually the needs are EC2, ECS, S3, Cloudfront, Cloudwatch and RDS and that's it. I haven't tried lots of their services, and I wasn't even aware of the optimisations that can be done on both cost as well as in the architecture front.&lt;/p&gt;

&lt;p&gt;Decided to pick up this certification AWS SAA to proactively design and build secured, resilient and cost optimised architectures upfront and not to wait for the issues to pop up and then optimise. This is my first certification and certainly re-lived my college exam days while preparing for this exam. &lt;/p&gt;

&lt;h2&gt;
  
  
  Preparation
&lt;/h2&gt;

&lt;p&gt;Started this around ~3 months back, but was very much overwhelmed with the amount of materials (courses/ notes) that's on the internet. Eventually settled on the following things,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.udemy.com/course/aws-certified-solutions-architect-associate-saa-c02/"&gt;Udemy course&lt;/a&gt; by &lt;strong&gt;&lt;a href="https://www.udemy.com/user/stephane-maarek/"&gt;Stephane Maarek&lt;/a&gt; 🎥&lt;/strong&gt; This is the longest course (~27hours) I have ever signed up for. This is an excellent start if you are looking to get this certification. This gives an intro and decent depth on all (almost) the AWS services. If you follow the hands-on approach along with Stephen, you will be equally confident in managing these services.&lt;/li&gt;
&lt;li&gt;This &lt;a href="https://github.com/keenanromain/AWS-SAA-C02-Study-Guide"&gt;Github notes&lt;/a&gt; 📝 Though the videos are exhaustive, it's impossible to remember everything that's in there. That's where these Github notes helped me. Whenever I had some 15 mins, i goto a section in here and read through that.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apps.ankiweb.net/"&gt;Anki Cards:&lt;/a&gt; 📇 Using flashcards to revise and memorise is my habit for a long time. Thanks to this &lt;a href="https://www.notion.so/AWS-SAA-Certification-1c3d99ed38ab494ea8ea467cd27ca725"&gt;reddit user&lt;/a&gt;, there is an excellent summary of all the services. You can import them to the anki app and you are good to go. 20 cards a day and your certification isn't far away 😁&lt;/li&gt;
&lt;li&gt;Took the &lt;a href="https://www.udemy.com/course/aws-certified-solutions-architect-associate-amazon-practice-exams-saa-c02/"&gt;practice exams in Udemy&lt;/a&gt;. ✍🏼 This is an eye opener for me. I can understand and relate to most of the questions (thanks to the course and notes) but this is where we need to apply the knowledge we learnt and it wasn't easy. I decided to take all the tests in the course as open book types. After a couple of tests, I realised an open book takes a lot of time and decided to make some guesses and mark those guess questions for later review.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  On the day experience
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I took the exam through Pearson Vue online. Make sure to keep the work desk (wherever the laptop/computer is placed) clean. They do check that 😅&lt;/li&gt;
&lt;li&gt;You can check in 30 mins before the scheduled time, and likely the exam will also start early.&lt;/li&gt;
&lt;li&gt;One day before the exam, go through the system check and keep things ready.&lt;/li&gt;
&lt;li&gt;You will have your video and mic turned on throughout the exam, you can't mute or turn off the video.&lt;/li&gt;
&lt;li&gt;My guess on the evaluation part. There are lots of questions where they offer partial marks. So the score isn't binary (right or wrong). so don't give up halfway, if you have done the preparations well you are likely to pass the exam.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some tips if i want to re-do this
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Book the exam dates upfront.&lt;/strong&gt; There isn't enough motivation to run through the gazillion notes, so have a milestone. It isn't a big problem, since you can amend the dates twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pair with a like minded person.&lt;/strong&gt; Again not to drop the ball on the certification and have someone to talk to.&lt;/li&gt;
&lt;li&gt;You can't master concepts along with the details in one go. accept that. so &lt;strong&gt;don't spend too much time on one thing&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spend more time on model exams/tests&lt;/strong&gt;. From a time perspective, split it 50-50 roughly. Spend 50% time to go over the video courses, understanding the concepts and the remaining 50 to go over the model tests.&lt;/li&gt;
&lt;li&gt;For non native english speakers, there is a provision to &lt;strong&gt;get 30 mins extra time for the exam.&lt;/strong&gt; &lt;a href="https://aws.amazon.com/certification/policies/before-testing/"&gt;https://aws.amazon.com/certification/policies/before-testing/&lt;/a&gt; (ESL+30). It's good to take this time, i cut close to the finishing 140 mins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy preparing, and all the best !!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>career</category>
      <category>motivation</category>
    </item>
    <item>
      <title>Micro-services Patterns: Saga - to music or to dance?</title>
      <dc:creator>Prasanna</dc:creator>
      <pubDate>Thu, 10 Jun 2021 06:37:16 +0000</pubDate>
      <link>https://dev.to/prasann/micro-services-patterns-saga-to-music-or-to-dance-4hio</link>
      <guid>https://dev.to/prasann/micro-services-patterns-saga-to-music-or-to-dance-4hio</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Cross posted from &lt;a href="https://www.prasanna.dev/posts/microservices-pattern-sagas" rel="noopener noreferrer"&gt;Prasanna's blog&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is a Saga pattern
&lt;/h2&gt;

&lt;p&gt;Saga design pattern is a way to manage a single business transaction that spans across various micro services. Saga pattern breaks a single business transaction into a sequence of local transactions that updates each service and publishes a message or event to trigger the next local transaction step. If any of these local transaction fails, saga will execute the subsequent flows to  rollback and cleanup the transaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do we need this
&lt;/h2&gt;

&lt;p&gt;In a micro-services architecture, it's hard to trace where the transaction has failed and what needs to be rolled back etc. Saga brings in a structure to deal with this problem and also allows the micro-services to act within the specified boundaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing Saga
&lt;/h2&gt;

&lt;p&gt;Saga is implemented by adding a &lt;code&gt;transactionId&lt;/code&gt; to all the local transactions. A &lt;code&gt;transactionId&lt;/code&gt; represent a single business transactions, so with that as an identifier it is possible to trace all the corresponding service interactions.&lt;/p&gt;

&lt;p&gt;This managing of local transactions can be done in 2 styles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Orchestration style&lt;/li&gt;
&lt;li&gt;Choreography style&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Orchestration Style Sagas
&lt;/h2&gt;

&lt;p&gt;Orchestration pattern mimics an Orchestra, where each person (system in this case) waits for the conductor (another system) to give instructions on what needs to be done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fsqki7gj43luy871b1ggz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsqki7gj43luy871b1ggz.png" alt="Orchestration style saga"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I don't prefer this design usually for the following reasons,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tight coupling between the conductor and the other systems in the ecosystem.&lt;/li&gt;
&lt;li&gt;Conductor is a single point of failure.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Choreography Style Sagas
&lt;/h2&gt;

&lt;p&gt;Choreography pattern mimics a dance performance where each dancer knows their role and can perform it independently. Hence, there is no need of centralised conductor role.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6cc22kp1ykg54b7dizar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6cc22kp1ykg54b7dizar.png" alt="Choreography style saga"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some benefits of this pattern are,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster development. Teams can build independently, with defined contracts.&lt;/li&gt;
&lt;li&gt;Loose coupling, easier to change systems.&lt;/li&gt;
&lt;li&gt;Better fault tolerance. There is no single point of failure here&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Sample Scenario
&lt;/h2&gt;

&lt;p&gt;Let us walk through a sample use case and see how we can go about solving it using choreography style sagas.&lt;/p&gt;

&lt;p&gt;Since we are talking about music and dance, let me take a use case of booking a movie ticket.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A customer can purchase a movie ticket by paying online.&lt;/li&gt;
&lt;li&gt;Once the payment is successful, the movie ticket is confirmed to that customer.&lt;/li&gt;
&lt;li&gt;If there is a payment failure, no ticket will be issued, and the order stands cancelled.&lt;/li&gt;
&lt;li&gt;If the show is cancelled, the customer will be fully refunded.&lt;/li&gt;
&lt;li&gt;If the customer choses to cancel a ticket, then they will be refunded a partial amount only.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Identifying Events and Commands
&lt;/h2&gt;

&lt;p&gt;Now, to implement them independently by various services, we need to identify the boundaries of various services and also their resposibilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.eventstorming.com/" rel="noopener noreferrer"&gt;Event storming&lt;/a&gt; is one activity that the team can do to identify these events aka boundaries of responsibilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Results of the event storming looks like this:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I will be using the following notion to illustrate various commands and events involved in the above use-case.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F1iamlnevf4t8zya48it3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F1iamlnevf4t8zya48it3.png" alt="legend"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F47bkezi9o8g33eqpezdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F47bkezi9o8g33eqpezdw.png" alt="booking-flow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fg3z1x08cluebwmpd0dij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fg3z1x08cluebwmpd0dij.png" alt="cancel-flow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once these events and commands are identified, teams independently can go ahead and start implementing them. Rollbacks are just another events mapped to a different command.&lt;/p&gt;

&lt;p&gt;This gives a power to the team to act independently and reduces the bottleneck on a single service.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>microservices</category>
      <category>design</category>
    </item>
    <item>
      <title>Slicing Microservices</title>
      <dc:creator>Prasanna</dc:creator>
      <pubDate>Sun, 04 Apr 2021 08:36:34 +0000</pubDate>
      <link>https://dev.to/prasann/slicing-microservices-1agj</link>
      <guid>https://dev.to/prasann/slicing-microservices-1agj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Cross posted in &lt;a href="https://www.prasanna.dev/posts/slicing-microservices" rel="noopener noreferrer"&gt;prasanna.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Building applications using micro-services are becoming a default go-to architecture these days. I have been part of few teams that build and deploy micro-services in a large scale. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;One pertinent question that often asked is "&lt;strong&gt;&lt;em&gt;Did we slice it right?&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is slicing a service mean
&lt;/h2&gt;

&lt;p&gt;Slicing a micro-service refers to defining the boundaries of the micro-service. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What should the service be responsible for&lt;/li&gt;
&lt;li&gt;What kind of data should it hold&lt;/li&gt;
&lt;li&gt;When it should delegate it's responsibility to another micro-service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below are some of my experiences, that i have seen working.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to do it
&lt;/h2&gt;

&lt;p&gt;One of the common behaviour we did in the teams I worked so far, is to let micro-services &lt;strong&gt;evolve&lt;/strong&gt; organically. We add feature/capabilities to the existing service and later trim down the service by spawning a new one. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ffz8fj6jt4y0z5rlp1irs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ffz8fj6jt4y0z5rlp1irs.png" alt="organic slicing of micro-service"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of the benefits,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No need of upfront discussion&lt;/strong&gt;. Most likely we will have lesser information about the feature, then likely that our design might reflect the incompetencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spawning a new service will have it's own cost&lt;/strong&gt;. How much ever you automate, it still adds up the infrastructure cost, maintenance cost. If we are wrong about the slicing then we had to spend some more time and effort to unify it with some other service.&lt;/li&gt;
&lt;li&gt;Once we have built a feature, most of the &lt;strong&gt;people in the team will understand the use-case and will appreciate the need of a separate service&lt;/strong&gt;. It doesn't become a single person's decision or a group of architect's decision. But a decision that comes from ground up. There  is a better chance for the service the retain it's shape when it grew this way.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach does require a good discipline in having a constant check on the growth of a service. A highly coupled service is very hard to break down later. And if we are too late to cut down a service, it might become an expensive operation too.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to do it
&lt;/h2&gt;

&lt;p&gt;Here are some of the themes i have come across. I will try to explain my thoughts using a bare minimum add-to-cart like domain problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Entity based slicing
&lt;/h3&gt;

&lt;p&gt;Very common and obvious start for a new service. &lt;/p&gt;

&lt;p&gt;Example: &lt;code&gt;UserService&lt;/code&gt; dealing with the CRUD of a &lt;code&gt;User&lt;/code&gt; entity in the system. &lt;/p&gt;

&lt;p&gt;It's easy to conclude &lt;strong&gt;entities (domain models)&lt;/strong&gt; as boundaries, since it's intuitive for people to see the separation. But whether it's right? is highly questionable and depends a lot, on the use case.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's simple, easy and often end up in chaos&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;One of the significant problems, i have seen is that these services will be very much in demand by other service. They entire network becomes very chatty. One can assume the &lt;code&gt;User&lt;/code&gt; entity will be needed at each and every step of the application and will have lots of interaction. Worst, is when the services decided to retain their copy of the data to enhance the performance of the application.&lt;/p&gt;

&lt;p&gt;Orchestrator will become a monolith. Since there will be lots of entity services to do mundane operation, orchestrator will become the one service to hold the business logic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fsi5fohmhiv4aqoa1h7xi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsi5fohmhiv4aqoa1h7xi.png" alt="entity based slicing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Journey based slicing
&lt;/h3&gt;

&lt;p&gt;Slicing services based on &lt;strong&gt;user journeys and behaviour&lt;/strong&gt;. This is quite popular, especially among the product people. Mostly, the product evolution happens on a feature/journey based. So whenever a new journey is identified it's time to build a new service.&lt;/p&gt;

&lt;p&gt;Ex: &lt;code&gt;RatingService&lt;/code&gt; a service that allows you to rate an entity. It can be products, people or article etc. Behaviours can include to make sure you don't rate same article twice, compute average ratings etc.&lt;/p&gt;

&lt;p&gt;One of the advantage of this technique is that usually the teams i have worked in the past, they own the journey and hence it's clear for them what needs to be the part of this service&lt;/p&gt;

&lt;p&gt;Huge drawback I have seen with this approach, is that it forces the data being duplicated across services. In order to maintain the true flavour of Microservice, we will end up having independent databases and eventually having duplicate data&lt;/p&gt;

&lt;h3&gt;
  
  
  Best of both worlds
&lt;/h3&gt;

&lt;p&gt;It makes a lot of sense to combine the above 2 approaches. Identify the core entities (domain models) of the system, and have them as either independent or logically grouped service. Apply journey based slicing on top of this entity services. So, the teams will own the journey service and the entity services can be maintained by group of teams.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdegdriqsoudx0xhr4pgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdegdriqsoudx0xhr4pgt.png" alt="best of both worlds"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of the conventions that i have seen/worked while slicing Micro-services&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Entity services should be thin and lenient.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Entity services should be merely act as APIs to the database operations. Do not try bringing in business logic here. &lt;/p&gt;

&lt;p&gt;For example, making the email-address non updatable in the entity service level. It makes sense to not to allow the end-user to allow update the email addresses, but often that might be a need from a back office personnel (admin user). So restricting such operation in the entity level might not be worth it. &lt;strong&gt;Journeys should take care of validations.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's hard to predict the future requirements so keep EntityServices simple and open for extension.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Avoid journey service calling other journey services&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Journey services, should be independent of others. Store data that are necessary for the journey and use entity services to collaborate with common data. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build composite entities wherever needed&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, to answer the immediate question that will raise due to the above constraint. How to manage the duplicate business logic.  To be honest, &lt;strong&gt;DRY principle is overrated in my opinion.&lt;/strong&gt; But in case if you are looking for such thing, then try adding another layer of composite entities.&lt;/li&gt;
&lt;li&gt;These composite entities, will encapsulate multiple entities and some business logic around this. One classic example from the app we built is a tax computation service. It involves the product, and the location of the buyer to calculate the tax.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these things are from my past experience, I'm sure I'm going to learn more and course correct myself in this journey. But one thing that i feel will always help in evolving micro-services is to constantly question the slicing decision to get it at a right state. And also a good knowledge on the &lt;a href="https://martinfowler.com/bliki/DomainDrivenDesign.html" rel="noopener noreferrer"&gt;Domain driven design&lt;/a&gt; helps a lot to take these decisions.&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>architecture</category>
      <category>design</category>
      <category>programming</category>
    </item>
    <item>
      <title>Scaling Applications Using Micro-Frontends</title>
      <dc:creator>Prasanna</dc:creator>
      <pubDate>Mon, 25 Jan 2021 18:58:06 +0000</pubDate>
      <link>https://dev.to/prasann/scaling-applications-using-micro-frontends-4kgn</link>
      <guid>https://dev.to/prasann/scaling-applications-using-micro-frontends-4kgn</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Cross posted from &lt;a href="https://www.prasanna.dev/posts/scaling-applications-using-microfrontends" rel="noopener noreferrer"&gt;Prasanna's blog&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This blog post is a summary of a presentation that I made at the Archimydes Mastermind Event that happened on 17th Dec 2020.&lt;/p&gt;

&lt;p&gt;Modern web applications tend to have complex and feature-heavy Frontends when compared to backends.&lt;/p&gt;

&lt;p&gt;With so many choices for frameworks and programming paradigms, building a consistent Frontend to scale is a challenging problem to solve. We cover ways in which you can scale your Frontend application and your development teams by using a Micro-Frontends design pattern.&lt;/p&gt;

&lt;p&gt;I'll start by introducing the pattern of Micro-frontends first. Then we'll be looking into some of the key decisions that need to be taken while starting a Micro-frontend project. Finally, we will see the circumstances where this pattern will be effective.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Scaling Applications&lt;/strong&gt;
&lt;/h2&gt;

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

&lt;p&gt;In general, scaling applications implies scaling backend applications to serve an increasing number of users. Usually, it's about how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increase Performance&lt;/li&gt;
&lt;li&gt;Reduce Latency&lt;/li&gt;
&lt;li&gt;Sustain load&lt;/li&gt;
&lt;li&gt;Manage compute costs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these parameters are typically applicable for the backend applications.&lt;/p&gt;

&lt;p&gt;For frontend applications, we typically stop with a good CDN to deliver static assets efficiently. However,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Scaling frontend apps is also about scaling development teams, both by size (growing a size of a single team) or count (multiple teams)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Additionally, applications are getting more frontend heavy because: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;backends are getting easier to deploy and get off the ground&lt;/li&gt;
&lt;li&gt;end-user compute is getting cheaper and more powerful everyday&lt;/li&gt;
&lt;li&gt;more functionality is being pushed to end-user interfaces and devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a result of this, product teams need to figure out an efficient way to build and deliver frontend applications with multiple development teams working at scale. Product teams need to execute this while reducing bottlenecks in the development process.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Monoliths, Microservices and Micro-frontends&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Monoliths are not a bad design choice&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's always best to start any application as a monolith. Upfront slicing of module boundaries is very hard and tends to go wrong. As the application grows, it's better to identify module boundaries and split them up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From monoliths, the best choice to evolve the backend services as microservices. We can then guarantee:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Strong module boundaries&lt;/li&gt;
&lt;li&gt;Independent deployment&lt;/li&gt;
&lt;li&gt;Polyglot development and tech diversity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, most of the microservices I have seen are as follows&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;Independent deployments ! == Independent releases&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Teams are able to develop and deploy backends independently. However, they need to wait for the frontend to be developed and deployed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter Micro-frontends&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Micro-frontends are nothing but taking the concept of micro-services to the frontend. Slice the frontend of the application to respect the module boundaries of the backend, and create an end-end independent release path.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;All of Microservices' promises + Independent releases&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Gains with Micro-frontends&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Independent teams&lt;/li&gt;
&lt;li&gt;Independent releases&lt;/li&gt;
&lt;li&gt;Simple, decoupled codebases&lt;/li&gt;
&lt;li&gt;Incremental upgrades&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Problems that need solving&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;T*&lt;strong&gt;o 'share, or not to share'?&lt;/strong&gt;* - Code reusability is one of the most overrated principles in software development. The problems of reusability are often ignored or not shared. In going the micro-frontend way, this needs to be discussed among the teams. Out of the gate, a duplicate first strategy works since it allows teams to execute faster initially.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application loading performance&lt;/strong&gt; - Micro-frontends can cause an impact on the loading performance of the application. There are ways to mitigate it, but the effort it takes has to be taken into consideration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design consistency across the application -&lt;/strong&gt; Having a larger number of people working on an application will lead to inconsistencies. Again, there are ways to mitigate this, however, the effort involved in mitigation needs to be considered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Key decisions while doing Micro-frontends&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's go over some of the major decisions that we need to take during the early stages of a micro-frontend application. I will try to cover the solution(s) that we took while building an application with distributed teams across 3 regions for 2 years. The decisions can vary based on the project context but nevertheless these problems need to be solved.&lt;/p&gt;

&lt;p&gt;In order to explain the challenges and decision, I will take up the following use-case:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Building an application to allow user to configure and buy a laptop. Similar to that of Apple's.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;A user can &lt;strong&gt;&lt;em&gt;configure&lt;/em&gt;&lt;/strong&gt; a laptop with various components, accessories, protection plans, etc. The user should be able to &lt;strong&gt;&lt;em&gt;search&lt;/em&gt;&lt;/strong&gt; for accessories, or maybe built-in models, and then finally should be able to &lt;strong&gt;&lt;em&gt;order&lt;/em&gt;&lt;/strong&gt; the product and get it fulfilled.&lt;/p&gt;

&lt;p&gt;Apart from the 3 services - configure, search, and order, I will have another service called "Frame" merely to hold the application together. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frame&lt;/strong&gt;: A business logic agnostic orchestrator service that knows how to download the rest of the services' frontend&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A) Composing multiple front-ends into a single application&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;End users don't care about the tech used. Their experience should not be affected due to tech.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Composing multiple frontends into a single application is one of the first problems that needs solving when choosing micro-frontends.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Composing front-ends&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can achieve this composition in 2 ways, let's go over the pros and cons of these approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Build-time Composition vs Run-time Composition&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Build-time composition&lt;/strong&gt; is where multiple frontend applications are built as a single big application and served. This can be accomplished using &lt;strong&gt;npm&lt;/strong&gt; or &lt;strong&gt;yarn&lt;/strong&gt; packages.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Good dependency management, resulting in smaller bundles&lt;/li&gt;
&lt;li&gt;Independent cross team development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A monolith built by different teams&lt;/li&gt;
&lt;li&gt;Non atomic deployments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A Run-time composition&lt;/strong&gt; is where the frontends get integrated into the browser directly when the user requests a page. This may be done on the "Server-Side" or in the "Client-Side"&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Independent teams with independent deployments&lt;/li&gt;
&lt;li&gt;Atomic deployments, so no versioning issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Too many API requests from Client(?), with increased bundle size&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Toolkit options for Runtime composition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server side:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSI (Server Side Includes)&lt;/li&gt;
&lt;li&gt;Tailor (from Zalando)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Side:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JSPM&lt;/li&gt;
&lt;li&gt;SystemJS&lt;/li&gt;
&lt;li&gt;FrintJS&lt;/li&gt;
&lt;li&gt;Single-Spa&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;We chose Run-time composition for the project we worked on. Since our app was rendered on the client-side, it was simpler for us to achieve this.&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;B) Communication between the frontends&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Multiple frontends need to share data with each other. Though this needs to be minimal, it's unavoidable. A couple of options to achieve this is by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;State management tools&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A global store in the application and all frontends using the same library to access the store.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Window events&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another approach could be to utilize the window (DOMs) eventing capability. Below is a sample event.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;We used to communicate through common redux store and redux events as all the apps in our micro-frontends were using Redux.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;C) Design Consistency&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One of the hardest problem to solve for is design consistency. &lt;/p&gt;

&lt;p&gt;In our team, we addressed this challenge by forming guilds. Consider that there are three teams, and each team has a designer assigned to it.&lt;/p&gt;

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

&lt;p&gt;We formed a guild comprising of all designers and some interested developers. They encompass a virtual team. They take all the design decisions and make sure their respective teams are abiding by the central design tenets.&lt;/p&gt;

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

&lt;p&gt;Initially, the guild created a style guide for the application. Mainly CSS and the application teams copy-pasted it from the style guide to build components.&lt;/p&gt;

&lt;p&gt;As we developed more features, we started pulling out Higher-order JS components and made them sharable. This is more of an evolution and works well once you have a stable design system in place.&lt;/p&gt;

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

&lt;p&gt;And also, since the teams were using the same frontend framework (React) it was easier for us to build this component library.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;D) Testing Strategy&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Deciding on "How to test" is important. Since it's a relatively newer paradigm and there are lots of moving parts in the application.&lt;/p&gt;

&lt;p&gt;Primarily we will be discussing the "Integration tests" and "Functional tests" from the testing strategy, as there won't be much difference in the way the "Unit tests" are done.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Integration tests&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Having a lightweight "Consumer Driven Contracts" (CDC) helped us a lot.&lt;/p&gt;

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

&lt;p&gt;A CDC is where the consumer services' give some tests to the provider service. A provider has to run all of its consumer services before publishing an artifact for deployment.&lt;/p&gt;

&lt;p&gt;This doesn't need to be very complex and can be done quickly using some lightweight options without using any big frameworks. But then, it's all case by case.&lt;/p&gt;

&lt;p&gt;In our scenario, Frame was the consumer of all the services and it shared a simple JSON contract and a small JS test with all of its providers. This ensured that the frame wasn't broken when a service deployed automatically.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Functional tests&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is one of my least favorite testing methods, however, like everything else in tech, it does have some staunch supporters and followers. In our case, we only had a few critical and successful user journeys automated using Selenium for functional testing.&lt;/p&gt;

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

&lt;p&gt;These journeys cut across multiple services and hence are harder to develop and maintain. Some of the FAQs I usually get on these tests are&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;FAQs&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Who owns functional tests?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ans. The product team and business analysts. They define the scenarios for automation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Who writes functional tests?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ans. Guild containing QAs from all teams and a few developers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Who fixes functional tests?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ans. Team which breaks it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;When should you opt for Micro-frontends?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Micro frontends are not for everyone. It adds significant overhead with development and maintenance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A. Distributed self-contained teams, with a need for parallelization&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your development teams aren't co-located, and there is a decent amount of parallelization that needs to be done, this could be a reason to implement micro-frontends.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;B. Collaborate with different frameworks in the frontend&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Imagine you are inheriting a legacy application but want to build a new feature with modern design elements, then micro-frontends gives you a good head start.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;C. Teams that have experience building Microservices application, and are willing to take it to the next step&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of the points mentioned here are forward-thinking practices. Micro-frontends needs a good solid understanding of the domain and good discipline to contain things within one's boundary. &lt;/p&gt;

&lt;p&gt;Finally, it's worth remembering that:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's not a sprint. It's a marathon.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Micro-frontends adds significant overhead to the overall application. This isn't desired for smaller applications or for the application that will be built and managed by a single team. The above mentioned challenges are worth solving, only if you are up for a longer run with multiple teams.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>microfrontends</category>
    </item>
  </channel>
</rss>
