<?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: Aditya simant</title>
    <description>The latest articles on DEV Community by Aditya simant (@adityasimant).</description>
    <link>https://dev.to/adityasimant</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%2F804988%2Fc60650ae-5fd6-4103-9097-8d4d5664bbc2.jpg</url>
      <title>DEV Community: Aditya simant</title>
      <link>https://dev.to/adityasimant</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adityasimant"/>
    <language>en</language>
    <item>
      <title>Microservices: The Future of Software Development</title>
      <dc:creator>Aditya simant</dc:creator>
      <pubDate>Tue, 03 Jan 2023 14:07:04 +0000</pubDate>
      <link>https://dev.to/adityasimant/microservices-the-future-of-software-development-4e4l</link>
      <guid>https://dev.to/adityasimant/microservices-the-future-of-software-development-4e4l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Microservice architecture, also known as ‘microservices,’ is a development method that breaks down software into modules with specialized functions and detailed interfaces.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Monilithic Architecture
&lt;/h2&gt;

&lt;p&gt;In a monolithic architecture, all components of an application are combined into a single, cohesive unit. This means that the various components of the application, such as the user interface, business logic, and data access layers, are all combined into a single codebase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s1qijBRf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c20g9qr7uk730gml2x11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s1qijBRf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c20g9qr7uk730gml2x11.png" alt="monoliths vs microservices" width="880" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This can make it easier to develop and maintain the application since all of the components are located in a single place. However, it can also make it more difficult to scale the application, since changes to one component can potentially affect the entire system. Monolithic architectures are typically well-suited to smaller applications, but may not be the best choice for larger, more complex applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitations of Monoliths
&lt;/h3&gt;

&lt;p&gt;There are a few key limitations to monolithic architectures:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Since all components of a monolithic application are combined into a single unit, it can be difficult to scale specific components without affecting the entire system. This can make it challenging to add new features or support a large number of users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modularity&lt;/strong&gt;: In a monolithic architecture, it can be difficult to reuse code between different components of the application. This can make it harder to develop and maintain the application over time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt;: Deploying a monolithic application can be more complex, since the entire application must be deployed as a single unit. This can make it harder to roll out updates or make changes to the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing&lt;/strong&gt;: Testing a monolithic application can be more challenging, since changes to one component can potentially affect the entire system. This can make it harder to identify and fix bugs.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What are microservices?
&lt;/h2&gt;

&lt;p&gt;Microservices: The Future of Software Development In recent years, microservices have gained popularity as a software architecture approach that allows developers to build and maintain complex applications more easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But what exactly are microservices, and why are they becoming the go-to choice for many software development projects?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Simply put, microservices are a way of building software applications as a collection of small, independent services that communicate with each other through APIs. Each microservice is responsible for a specific function within the larger application and can be developed, tested, and deployed independently. This modular approach to software development offers several benefits compared to traditional monolithic architecture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--15710lfT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y73cfklqzbb09x8oyfo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--15710lfT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y73cfklqzbb09x8oyfo2.png" alt="microservices" width="505" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the main advantages of microservices is that they allow for more efficient and agile development processes. Since each microservice is focused on a specific task, developers can work on them independently and make changes or updates without affecting the rest of the application. This makes it easier to fix bugs, add new features, and deploy updates without the risk of introducing new issues.&lt;/p&gt;

&lt;p&gt;Microservices also make it easier to scale applications as they grow. Since each microservice can be deployed and scaled separately, developers can easily add more resources to specific parts of the application as needed. This makes it possible to handle increased traffic and workloads without having to completely rewrite the entire application. Another benefit of microservices is that they allow for more flexibility in terms of technology choices. In a monolithic architecture, the entire application is built using the same technologies and frameworks. With microservices, each service can be built using the best tools for the job, which can lead to more efficient and effective development. Overall, microservices are a powerful tool for building and maintaining complex software applications. They allow for more agile and efficient development processes, better scalability, and greater flexibility in terms of technology choices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Architecture of Microservices
&lt;/h2&gt;

&lt;p&gt;Microservices architecture is a design approach in which an application is built as a collection of small, independent services, each of which performs a specific task and communicates with other services through well-defined interfaces.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3wr_O6tG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ke78hubv1bfv5gadddd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3wr_O6tG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ke78hubv1bfv5gadddd.png" alt="Microservices architecture" width="730" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In a microservices architecture, each service is designed to be highly modular and loosely coupled, making it easier to develop, test, and maintain. This modular design also makes it easier to scale specific components of the application, since each service can be scaled independently.&lt;/p&gt;

&lt;p&gt;Microservices architectures are typically built using a combination of technologies, including APIs (Application Programming Interfaces) to facilitate communication between services, and containerization tools like Docker to package and deploy the individual services.&lt;/p&gt;

&lt;p&gt;Overall, the goal of a microservices architecture is to create a flexible, scalable, and maintainable application by breaking it down into smaller, independent components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Characteristics of a microservices architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LqbPE0Ke--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kjhb290v9zxhc6tavo1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LqbPE0Ke--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kjhb290v9zxhc6tavo1.png" alt="charateristics" width="880" height="791"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Split into numerous components&lt;/li&gt;
&lt;li&gt;Robust and resistant to failure&lt;/li&gt;
&lt;li&gt;Simple routing process&lt;/li&gt;
&lt;li&gt;Decentralized operations&lt;/li&gt;
&lt;li&gt;Built for modern businesses&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Leading Tech companies using microservices.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Amazon
&lt;/h3&gt;

&lt;p&gt;At the turn of the millennium, Amazon’s retail website was a monolith with tightly knit connections between and within its multi-tiered services. This meant that developers had to work carefully to make sure nothing broke every time an upgrade or upscaling activity had to be undertaken.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QfCYtIOL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rm27zqz8agjnsldc3uym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QfCYtIOL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rm27zqz8agjnsldc3uym.png" alt="Real-time Graph of Amazon.com’s Microservice Dependencies in 2008" width="880" height="667"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Real-time Graph of Amazon.com’s Microservice Dependencies in 2008&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This was not an exception, as many tech startups at the time adopted this methodology when building their applications. Even large-scale tech projects undertaken by big companies were created using monolithic architecture.&lt;/p&gt;

&lt;p&gt;However, as the demand for the project or product increased, Amazon added more developers to work on it, and the codebase became bigger. This made the architecture more complex to modify, adding overheads to the process and slowing down the software development lifecycle.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Netflix
&lt;/h3&gt;

&lt;p&gt;Just like Amazon, Netflix is a pioneer in the microservices space. Its migration began in 2008 when the streaming platform faced numerous scaling issues and service outages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VEJ--63h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/legwkx2reiuju7pw8hlf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VEJ--63h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/legwkx2reiuju7pw8hlf.png" alt="Dave Hahn Shows off the Entire Architecture of Netflix in One Flow Diagram" width="742" height="412"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Dave Hahn Shows off the Entire Architecture of Netflix in One Flow Diagram&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a primary database of the company was corrupted, causing a three-day blockage on DVD shipping to members, Netflix realized it was time to migrate to microservices. It began migrating away from vertically-scaled single points of failure, such as relational databases in its data centers. Instead, the platform adopted highly reliable cloud-based distributed systems that were horizontally scalable. Netflix chose Amazon Web Services as its cloud provider to achieve its migration goals.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Uber
&lt;/h3&gt;

&lt;p&gt;Like Amazon and Netflix, Uber, too, decided to shift away from its monolithic structure due to growth hurdles. The challenges faced by the ride-sharing platform included inefficiency in the development and launch of new features, the inability to fix bugs quickly, and problems with integrating its fast-growing global operations. It reached a point where the complex application architecture needed extensively experienced developers to make minor changes and updates to the system.&lt;/p&gt;

&lt;p&gt;To conquer the challenges presented by its monolithic application, Uber broke it down into cloud-powered microservices. Soon, individual microservices were developed for business functions such as trip management and passenger management. These services communicate with each other through an API gateway.&lt;/p&gt;

&lt;p&gt;The adoption of this microservices architecture helped Uber overcome its technological challenges. Here’s how:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Development teams took ownership of specific services, boosting development initiative quality, speed, and manageability.&lt;/li&gt;
&lt;li&gt;Teams focused on the services that needed to be scaled up, thus facilitating swift scaling up of the entire application as demand increased over time.&lt;/li&gt;
&lt;li&gt;Fault tolerance was improved, 
and Uber could update individual services without disrupting the rest of the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Microservices Best Practices
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8ab6Rvug--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57k7ugxsdxuvl4yahngd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8ab6Rvug--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57k7ugxsdxuvl4yahngd.png" alt="Best practices" width="812" height="886"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep services small and focused&lt;/strong&gt;: Each service should have a specific, well-defined purpose and should be small enough to be developed and maintained by a single team.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use APIs to facilitate communication between services&lt;/strong&gt;: Use APIs to define the interfaces between services, allowing them to communicate and exchange data in a standardized way.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Use containerization tools like Docker&lt;/em&gt;*: Containerization tools like Docker make it easier to package and deploy microservices, allowing you to scale and manage them more efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a cloud-based platform&lt;/strong&gt;: A cloud-based platform like Amazon Web Services (AWS), Microsoft Azure, or Google Cloud Platform (GCP) can make it easier to deploy and scale microservices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor and log everything&lt;/strong&gt;: Monitor the health and performance of your microservices to ensure they are functioning correctly, and use logging to track errors and debug issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Practice continuous integration and delivery&lt;/strong&gt;: Use continuous integration and delivery (CI/CD) practices to automate the build, test, and deployment of your microservices, allowing you to roll out updates and fixes more quickly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a microservices-friendly framework&lt;/strong&gt; : Consider using a framework like Spring Cloud or MicroProfile that is designed specifically for building and deploying microservices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a service mesh&lt;/strong&gt; : A service mesh like Istio can help you manage the complexity of a microservices architecture by providing features like load balancing, service discovery, and monitoring.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're considering using microservices in your next software project, the benefits are worth considering. I hope this blog helped explain the concept of microservices and their benefits in software development.&lt;/p&gt;

&lt;p&gt;Let me know if you have any questions!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Android : Mock Response with Retrofit &amp; OkHttp</title>
      <dc:creator>Aditya simant</dc:creator>
      <pubDate>Sat, 22 Oct 2022 04:49:20 +0000</pubDate>
      <link>https://dev.to/adityasimant/android-mock-response-with-retrofit-okhttp-3c8j</link>
      <guid>https://dev.to/adityasimant/android-mock-response-with-retrofit-okhttp-3c8j</guid>
      <description>&lt;h2&gt;
  
  
  What is Mock Server?
&lt;/h2&gt;

&lt;p&gt;A mock API server or mock server API imitates a real API server by providing realistic mock API responses to requests. They can be on your local machine or the public Internet. Responses can be static or dynamic, and simulate the data the real API would return, matching the schema with data types, objects, and arrays.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why API Mocking?
&lt;/h2&gt;

&lt;p&gt;A mock API server is useful during development and testing when live data is either unavailable or unreliable. While designing an API, you can use mock APIs to work concurrently on the front and back-end, as well as to gather feedback from developers.&lt;/p&gt;

&lt;p&gt;You can also use mock APIs to emulate APIs you don’t control. For example, you can use a local mock server to fake results from a public API when you aren’t connected to the Internet. Or, use mock data responses if live calls to an API would incur a charge from the provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Mock API Response with OkHttp and consume with Retrofit?
&lt;/h2&gt;

&lt;p&gt;We can simply acheive mocking API response with the help of &lt;code&gt;OkHttp&lt;/code&gt; and how? By using Interceptor from &lt;code&gt;OkHttp&lt;/code&gt;. &lt;code&gt;OkHttp&lt;/code&gt; provides a way to &lt;code&gt;intercept&lt;/code&gt; during every network operation requested by &lt;strong&gt;Client (Android Application)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Example?
&lt;/h2&gt;

&lt;p&gt;Let's say, we want to call an api endpoint called fake-login. This &lt;code&gt;API&lt;/code&gt; endpoint should return an response (Error or Success). But at this moment, we just received an &lt;code&gt;JSON&lt;/code&gt; as response from the Backend Engineering Team and APIs still under development.&lt;/p&gt;

&lt;p&gt;In this scenario, we can be benefited by &lt;code&gt;OkHttp&lt;/code&gt;. We can intercept during the network operation and ask &lt;code&gt;OkHttp&lt;/code&gt; to return a Mock Response for an/some API endpoints.&lt;/p&gt;

&lt;p&gt;Let's get into the coding part&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
object APIProvider {
    //Return a lazy instance of OkHttp client
    private val myHttpClient: OkHttpClient by lazy {
        val ins = OkHttpClient().newBuilder()
            .connectTimeout(1, TimeUnit.MINUTES)
            .readTimeout(1, TimeUnit.MINUTES)
            .writeTimeout(1, TimeUnit.MINUTES)
            .retryOnConnectionFailure(true)
        ins.build()
    }

    //Public access point for Mock API Service
    fun getMockAPI(): MockAPIEndpoint = retrofitInstance.create(MockAPIEndpoint::class.java)

    //Return a lazy Retrofit instance
    private val retrofitInstance: Retrofit by lazy {
        Retrofit.Builder()
            .baseUrl("https://rommansabbir/api/v2/")
            .client(myHttpClient)
            .build()
    }
}

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

&lt;/div&gt;



&lt;p&gt;We have an &lt;code&gt;Singleton&lt;/code&gt; Object called&lt;code&gt;APIProvider&lt;/code&gt;, which expose an public function to get access of &lt;code&gt;MockAPIEndpoint&lt;/code&gt;. Lets take a look at the &lt;code&gt;MockAPIEndpoint&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
interface MockAPIEndpoint {
    @GET("fake-login")
    fun login(): Call&amp;lt;ResponseBody&amp;gt;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;MockAPIEndpoint&lt;/code&gt; has only one &lt;code&gt;API&lt;/code&gt; at this moment and we want to return a mocked &lt;code&gt;JSON&lt;/code&gt; object as Response.&lt;/p&gt;

&lt;p&gt;Now, lets work on our &lt;code&gt;LoginInterceptor&lt;/code&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
class LoginInterceptor: Interceptor{
    override fun intercept(chain: Interceptor.Chain): Response {
        //If requested endpoint matched to targeted endpoint, we will return an mocked response.
        if (chain.request().url.toUri().toString().endsWith("fake-login")) {
            val responseString = "OUR_JSON_RESPONSE_FROM_ASSET_OR_OTHER_SOURCE"
            return chain.proceed(chain.request())
                .newBuilder()
                .code(200)
                .protocol(Protocol.HTTP_2)
                .message(responseString)
                .body(
                    responseString
                        .toByteArray()
                        .toResponseBody(
                            "application/json".toMediaTypeOrNull()
                        )
                )
                .addHeader("content-type", "application/json")
                .build()
        } else {
            //Skip the interception.
            return chain.proceed(chain.request())
        }
    }
}

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

&lt;/div&gt;



&lt;p&gt;Here, we are intercepting during the API request. If requested endpoint matches to our targeted endpoint, we will return a mocked JSON object as response. We can get this JSON from Asset or other source (eg. String).&lt;/p&gt;

&lt;p&gt;We are almost done with our API Mocking. Let's add our &lt;code&gt;LoginInterceptor&lt;/code&gt; to &lt;code&gt;OkHttpClient&lt;/code&gt;. Update &lt;code&gt;APIProvider::myHttpClient&lt;/code&gt; as shown down.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    //Return a lazy instance of OkHttp client
    private val myHttpClient: OkHttpClient by lazy {
        val ins = OkHttpClient().newBuilder()
            .connectTimeout(1, TimeUnit.MINUTES)
            .readTimeout(1, TimeUnit.MINUTES)
            .writeTimeout(1, TimeUnit.MINUTES)
            .retryOnConnectionFailure(true)
        //Adding our LoginInterceptor only on Debug mode only
        if (BuildConfig.DEBUG){
            ins.addInterceptor(LoginInterceptor())
        }
        ins.build()
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Now, when we want to execute an API request to the targeted endpoint with Retrofit, OkHttp will return Mock API Response.&lt;/p&gt;

</description>
      <category>android</category>
      <category>api</category>
      <category>beginners</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Testkube: The Kubernetes-native testing framework</title>
      <dc:creator>Aditya simant</dc:creator>
      <pubDate>Thu, 29 Sep 2022 16:01:39 +0000</pubDate>
      <link>https://dev.to/adityasimant/testkube-the-kubernetes-native-testing-framework-3m4h</link>
      <guid>https://dev.to/adityasimant/testkube-the-kubernetes-native-testing-framework-3m4h</guid>
      <description>&lt;h2&gt;
  
  
  What is TestKube?
&lt;/h2&gt;

&lt;p&gt;Testkube is a Kubernetes-native testing framework. It enables running tests directly in your Kubernetes cluster and then saves the results to a centralized space. It abstracts away all the troubles of containerizing different test types. Testkube makes testing in Kubernetes a smooth cloud-native experience.&lt;/p&gt;

&lt;p&gt;TestKube gives us a centralized test result and is simple to integrate with GitOps and CI/CD procedures.&lt;/p&gt;

&lt;p&gt;So, in this blog, we will go to cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why Testkube?&lt;/li&gt;
&lt;li&gt;Is it for you?&lt;/li&gt;
&lt;li&gt;Installation of Testkube&lt;/li&gt;
&lt;li&gt;Demo.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisties:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of K8s&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why TestKube?
&lt;/h2&gt;

&lt;p&gt;TestKube Decouples the testing activities performed at CI/CD pipeline and defines them in Testkube so that we can run our tests anytime without having to run the entire CI/CD pipeline for running an individual test, So moving across CI/CD platforms becomes more accessible as we don't need to redefine all the tests as we can reuse the way tests has been defined and orchestrated in TestKube.&lt;/p&gt;

&lt;h2&gt;
  
  
  CI/CD Workflow With TestKube
&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%2Fuploads%2Farticles%2F3swjf6g0ncdexrran5gb.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%2F3swjf6g0ncdexrran5gb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CI/CD Workflow Without TestKube
&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%2Fuploads%2Farticles%2Fhjdyhob1fcab1hg3mr89.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%2Fhjdyhob1fcab1hg3mr89.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because TestKube retrieves the test files from the project repository and executes them as you want, you don't need to perform any complicated settings to run your tests.&lt;/p&gt;

&lt;p&gt;The complexities involved with CI/CD testing are simplified as TestKube Manages all the testing activities themselves.&lt;/p&gt;

&lt;p&gt;TestKube provides the entire infrastructure for taking care of all testing workloads from inside the Kubernetes cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is TestKube for you?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you are doing Integration testing for your application under Kubernetes, Testkube is for you.&lt;/li&gt;
&lt;li&gt;If you wish to surpass K8's limitations, such as network limits or lack of access to testing environments&lt;/li&gt;
&lt;li&gt;If your CI/CD and testing processes are too closely related&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now, open your terminal and write this command.👇&lt;br&gt;
&lt;code&gt;$ kubectl testkube install&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, run this👇 command to view all the TestKube components.&lt;br&gt;
&lt;code&gt;$ kubectl get pods -n testkube&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, your screen will look like this👇&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%2Fe4gphzsqfimozjf84lr1.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%2Fe4gphzsqfimozjf84lr1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we will be able to see both client and server versions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To see the version of the &lt;strong&gt;TestKube&lt;/strong&gt;, run this command.👇
&lt;code&gt;$ kubectl testkube version&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run your test, run this command.👇&lt;br&gt;
&lt;code&gt;kubectl testkube run test our-first-test-name&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The screen will look like this.👇&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%2Fn76er5kses0izmjjcdw8.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%2Fn76er5kses0izmjjcdw8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Running a K6 Test
&lt;/h2&gt;

&lt;p&gt;K6 is integral part of Testkube. During the Testkube installation, the Testkube k6 executor installs by default. You must first build a Test in Testkube to perform a K6 test.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new JS file.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// bash

$ touch k6-test.js

// You can give any name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now we will create a k6 load test and run it. Write this code 👇 inside the k6-test.js file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
 { duration: '5s', target: 20 },
 { duration: '5s', target: 10 },
],
};
export default function () {
const res = http.get('https://httpbin.test.k6.io/');
check(res, { 'status was 200': (r) =&amp;gt; r.status == 200 });
sleep(2);
}

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

&lt;/div&gt;



&lt;p&gt;Save the file as k6-test.js or anything you like.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now execute the test script. First, we need to define it as k6/script 👇
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
$ kubectl testkube create test --file path/to/your/k6-test.js --type "k6/script" --name k6-test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, run this command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl testkube run test k6-test -f

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

&lt;/div&gt;



&lt;p&gt;Now, we can view our logs and test results in the Testkube dashboard. Run this command.👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl testkube dashboard

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Thank You
&lt;/h2&gt;

&lt;p&gt;I hope you learn something from this blog. &lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>testing</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How I won my first hackathon.</title>
      <dc:creator>Aditya simant</dc:creator>
      <pubDate>Wed, 28 Sep 2022 17:35:38 +0000</pubDate>
      <link>https://dev.to/adityasimant/how-i-won-my-first-hackathon-16l4</link>
      <guid>https://dev.to/adityasimant/how-i-won-my-first-hackathon-16l4</guid>
      <description>&lt;h2&gt;
  
  
  What is a Hackathon and Why should you care?
&lt;/h2&gt;

&lt;p&gt;A Hackathon is the best place to learn and collaborate with a lot of diverse people just like you. In simple words, Hackathon is about bringing your crazy ideas to reality through technology. It’s an event where anyone, regardless of their individual field can come &amp;amp; participate to learn, build &amp;amp; share their creations.&lt;/p&gt;

&lt;p&gt;The first-ever Civo Hackathon was an initiative to bring together developers, architects, experts, and students from across the globe to develop innovative Kubernetes projects on &lt;a href="https://civo.com"&gt;Civo&lt;/a&gt;. It provides a learning experience towards hosting applications on Kubernetes while exploiting the blazing fast speed and the simplicity of Civo’s Kubernetes platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  MY JOURNEY
&lt;/h2&gt;

&lt;p&gt;It all started out when I first heard about the Hackathon in my community space, as I was in my freshmen year and was exploring various fields, I decided to give it a shot and registered for the hackathon without any prior experience. All I knew was that we were expected to make some projects on a given theme, which in this hackathon was deploying application using kubernetes. As of today I am a open-source enthusiast and I work/contribute mostly in DevOps, Kubernetes and containers, but during that time I barely knew what kubernetes, servers, containers or deployment was. As the date for the hackathon approached, we were asked to make teams and start planning. &lt;/p&gt;

&lt;p&gt;I didn't knew anyone in the hackathon to form team with nor did any of my friends participated with me, so I decided to make team with random people in hackathon. I started emailing random participant in a hope of getting a reply and getting to know each other to make a team. Approximately I emailed around 12-15 people, to which I got 2 replies. &lt;/p&gt;

&lt;p&gt;None of us knew each other before the hackathon. We randomly connected with each other through emails and Discord groups. It was a wonderful experience meeting and collaborating with new people. Our main goal was to learn and explore new technologies.&lt;/p&gt;

&lt;p&gt;Members of my team :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Aditya simant (me)&lt;/li&gt;
&lt;li&gt;Bala yokesh mani.&lt;/li&gt;
&lt;li&gt;Prajwal jaiswal.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As the Hackathon started, I was scared that I might mess up and because of me my teammates would be defeat as well. After recollecting myself I just took up a challenge to myself that I have to do it anyhow without thinking about the results, even if I lose at least I will take some learning back with me which will help me in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  THE PROJECT
&lt;/h2&gt;

&lt;p&gt;For the hackathon we created the Speech Companion. It was a simple application but a complete project. We tried to focus on how we can solve a small daily life problem using our project.&lt;br&gt;
We as students always struggle with assignments and projects. Most of this work requires reading a big amount of text. We always wished there was a technology that can read the given text for us and also write the given text. So we built a project named Speech Companion.&lt;/p&gt;

&lt;p&gt;Speech Companion can convert your given speech into text for convenience. It can also read the given text for you making your work a lot easier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/balayokesh/speech-companion"&gt;Speech Companion Github.&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How we built it?
&lt;/h2&gt;

&lt;p&gt;How we built the application: We made use of &lt;code&gt;ReactSpeechRecognition&lt;/code&gt; npm library for implementing the voice to text functionality. We also used JavaScript's inbuilt &lt;code&gt;speechSynthesis&lt;/code&gt; module for text to voice conversions. We chose to &lt;code&gt;usereactJS&lt;/code&gt; as our frontend library since it offers quick state refreshes and component based approach. We used &lt;code&gt;fontawesome&lt;/code&gt;icons for implementing icons on the user interface. We also wrote our custom &lt;code&gt;CSS&lt;/code&gt; for designing the home page with the best possible User Interface for users.&lt;/p&gt;

&lt;p&gt;Then comes the deployment. This was done in just a few simple steps. We first containerized our app using Docker. Then we created a kubernetes cluster on the Civo Website and added three simple .yaml files in our application.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;deployment.yaml&lt;/code&gt; file -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
apiVersion: apps/v1
kind: Deployment
metadata:
  name: speech-companion
spec:
  replicas: 2
  selector:
    matchLabels:
      app: speech-companion
  template:
    metadata:
      labels:
        app: speech-companion
    spec:
      containers:
        - image: prajwalj27/speech-companion
          name: speech-companion


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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;service.yaml&lt;/code&gt; file -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
apiVersion: v1
kind: Service
metadata:
  name: speech-companion
  labels:
    app: speech-companion
spec:
  ports:
    - name: "speech-companion"
      port: 3000
  selector:
    app: speech-companion  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ingress.yaml&lt;/code&gt;file -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: traefik
  labels:
    app: speech-companion
  name: speech-companion-ingress
spec:
  rules:
    - host: speech-companion.ae150322-a780-4657-a1e0-604a842c2fc0.k8s.civo.com
      http:
        paths:
          -
            backend:
              service:
                name: speech-companion
                port:
                  number: 3000
            path: /
            pathType: "Prefix"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's next for the project?
&lt;/h2&gt;

&lt;p&gt;Speech Companion has a lot of improvements to make yet. We can design it such that it can also be used in different languages, also we can give users the best experiences by changing the accent and speed for the better.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use of Civo Kubernetes
&lt;/h2&gt;

&lt;p&gt;Before the hackathon, all the members of our group had experience in making web applications using React or other frameworks, but none of us had ever worked with cloud platforms. To participate in this hackathon it was mandatory to make use of the services provided by Civo in our project.&lt;/p&gt;

&lt;p&gt;So one week before the hackathon we started exploring some of the core concepts related to DevOps. We got to learn about containers, containerized applications, Docker, Kubernetes, etc. And the best place to get started with learning and using Kubernetes is the Civo Academy. Most people find it difficult to start learning Kubernetes right away, as a result, the videos in the Civo Academy are structured in such a way that is easy to understand for most of the beginners.&lt;/p&gt;

&lt;p&gt;Talking more about Civo, I would say the simplicity and the ease with which we can work on our applications is really impressive. With just few clicks here and there, selecting some options and within a few minutes we can have our fully running clusters. The people in the slack community are also very helpful. Even if there is a small problem or a thing that we are unable to understand, people in the community are always willing to solve our problems at any time of the day.&lt;/p&gt;

&lt;p&gt;Overall I would like to say it was a wonderful experience participating in this hackathon.&lt;/p&gt;

&lt;h2&gt;
  
  
  We won it by 3rd overall position
&lt;/h2&gt;

&lt;p&gt;While randomly checking my emails I saw their email,&lt;br&gt;
I was so happy at that moment that finally, I have done something, You know "The best thing in life is unexpected".&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Never Underestimate yourself.&lt;/li&gt;
&lt;li&gt;Don't think too much start taking action.&lt;/li&gt;
&lt;li&gt;Ask a lot of questions.&lt;/li&gt;
&lt;li&gt;Build for fun, make sure you learn something new.&lt;/li&gt;
&lt;li&gt;Don't just run to winning.&lt;/li&gt;
&lt;li&gt;Learn while building.&lt;/li&gt;
&lt;li&gt;Collaboration and team building help a lot.&lt;/li&gt;
&lt;li&gt;Time Management&lt;/li&gt;
&lt;li&gt;No one wants you to be an expert&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Enjoy every single small achievement that you earned and be proud of it always. Share the learnings, write a blog on it, and help and guide others.&lt;/p&gt;

&lt;p&gt;"It's never too late to start something, Dont think just start experimenting with things that's how you will learn, Hackathons are all about learning and experimenting things".&lt;/p&gt;

</description>
      <category>react</category>
      <category>kubernetes</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
