<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Junerey Casuga on Medium]]></title>
        <description><![CDATA[Stories by Junerey Casuga on Medium]]></description>
        <link>https://medium.com/@junereycasuga?source=rss-2385c9b8a731------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*eedGL_esQEQ2HlMalhL8IQ.jpeg</url>
            <title>Stories by Junerey Casuga on Medium</title>
            <link>https://medium.com/@junereycasuga?source=rss-2385c9b8a731------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 05:01:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@junereycasuga/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Reasons Why I Chose Go over NodeJS as my Primary Programming Language]]></title>
            <link>https://junereycasuga.medium.com/reasons-why-i-chose-go-over-nodejs-as-my-primary-programming-language-aa845528c61d?source=rss-2385c9b8a731------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa845528c61d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Junerey Casuga]]></dc:creator>
            <pubDate>Tue, 24 May 2022 12:44:44 GMT</pubDate>
            <atom:updated>2022-05-25T03:10:58.559Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wdjAT7Vaq_MKjubh" /><figcaption>Photo by <a href="https://unsplash.com/@geekgunda?utm_source=medium&amp;utm_medium=referral">Chinmay Bhattar</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There are already a lot of articles out on the internet that talks about why they chose Go over other programming languages. And most of them would talk about how much faster Go is compared to others.</p><p>While it’s true that Go is known for its performance, it is more often that I’m attracted to the developer experience a language offers.</p><p>In this article, I will be talking why I use <strong>Go</strong> more than NodeJS as my primary programming language.</p><p>To bring more context to this article, I have been in the web development space for a decade now. I started my professional career with <strong>PHP</strong>, which was probably more or less the norm back then. About 5 years ago, I have mainly focused on backend development by writing internal tools and developing APIs for mobile apps. And at the same time made a switch to <strong>NodeJS</strong>. And for the past couple of years, I have been working more and more with <strong>Go</strong>, both privately and professionally at <a href="https://appsynth.net/">Appsynth</a>.</p><h3>What is Go?</h3><p>I didn’t really want to touch on what Go is in terms of who and when it was developed as you may already find a lot of these online. Instead, I just want to focus on what I liked about the language itself compared to my previous primary language, NodeJS.</p><p>If you’d like to learn what Go is, it’s best and would highly suggest to visit their <a href="https://go.dev/">website</a> as they already provide a very nice documentation about the language.</p><h3>Simplicity</h3><p>Most people would describe Go as a simple language. And I wouldn’t argue on that as it is indeed a very simple language. With Go, it is more likely that you’re doing things in just a single way as opposed to other languages that you may perform the same task in various approach.</p><p>Let’s take looping as an example. In JavaScript, there are several ways of performing loops/iteration depending on what what you’re trying to do. While in Go, there is only one way of looping, just in different patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*3Ulv_YFnWqI1VXlLtb30yw.png" /><figcaption>For loop comparison</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*QeJyYBGVeqgabn32rxfzrA.png" /><figcaption>While loop comparison</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*SyaWCURuapg5nTfeZVKbYw.png" /><figcaption>Array/Slice iteration comparison. Take note, I haven’t even included JavaScript’s Array.forEach</figcaption></figure><p>If you haven’t already noticed, looping in Go is using only one way of looping, i.e. <strong>for loop</strong>, just in different patterns for different purposes.</p><p>While JavaScript’s way of expressing things in multiple way promotes flexibility, it also leads to inconsistency among developers and projects.</p><h3>Standard Libraries</h3><p>Go comes with a <a href="https://pkg.go.dev/std"><strong>robust list of standard libraries</strong></a> including some features that would sometimes make you want to install 3rd party NPM modules when using NodeJS.</p><p>Yes, I said “standard” libraries. Which means Go developers don’t need to spend time searching and choosing between different libraries from 3rd party providers.</p><p>An example of that is when working with dates. While JavaScript allows you to work with dates without installing 3rd party libraries, it’s more often that JavaScript developers tend to reach for 3rd party modules. And it’s also more often that JavaScript developers need to pick and choose which module to use amongst many such as date-fns, luxon, dayjs, and many more.</p><p>With Go, the <a href="https://pkg.go.dev/time">time</a> package already comes out-of-the-box and in my opinion is way more easier to use compared to JavaScript’s default Date functions.</p><p>Using Go’s standard libraries mean these out-of-the-box features guarantees high reliability.</p><p>If you’re working on JavaScript projects for a while now, you probably also already know that reliability has been a problem in the community several times. Worst, <a href="https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/"><em>it has broken the internet</em></a> and may occur again in the future.</p><h3>Concurrency</h3><p>While JavaScript has already concurrency implemented, Go was designed with a very high focus on concurrency since the beginning.</p><p>Go relies very much on simplicity when it comes to concurrency. Talking about simplicity once again, there is only one language construct for asynchronous programming in Go, while there are many different ways in JavaScript.</p><h3>Tools and CLI</h3><p>Go comes with a range of tools bundled in a single CLI.</p><p>It comes with a <strong>compiler</strong> that can turn your code into an executable binary, even for specific CPU architectures and operating systems, which allows you to make deployments more simple as you only have to take care of a single file.</p><p><strong>Code formatting</strong> and <strong>linting</strong> also comes with the language out-of-the-box, and works seamlessly with your code editors. All you have to do is to install Go and you are good to go 😉</p><p>With JavaScript, you would often need to install a 3rd party library yet again to have these features.</p><h3>Conclusion</h3><p>Should you choose Go over NodeJS? I think this decision is subjective. If you are a developer and looking for a better developer experience and performance gains on your applications, then I would highly suggest looking into Go.</p><p>I may have already chosen what language I would like to use for most part, that didn’t mean that I will stop writing in JavaScript/TypeScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa845528c61d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Go + gRPC with Go kit]]></title>
            <link>https://junereycasuga.medium.com/go-grpc-with-go-kit-ff8c9151d2c1?source=rss-2385c9b8a731------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff8c9151d2c1</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Junerey Casuga]]></dc:creator>
            <pubDate>Sat, 21 Nov 2020 10:06:56 GMT</pubDate>
            <atom:updated>2020-11-23T04:28:44.413Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*qdzBTuCBp6dMo84BWOzX1A.png" /></figure><p>Building applications with Go can be sometimes intimidating especially when you’re just starting to learn it. Let alone transporting your APIs through gRPC. In this post, I will guide you on writing a simple Go microservice using gRPC with the help of Go kit.</p><h3>What is Go kit? and why?</h3><p><a href="https://pkg.go.dev/github.com/go-kit/kit">Go kit</a> is the brain child of <a href="http://peter.bourgon.org/go-kit/#what-go-needs">Peter Bourgon</a> which he talked about during a FOSDEM and the Google Campus London meetup in 2015. As what he has envisioned, Go kit is a toolkit for building microservices in Go</p><p>It provides you a set of standard libraries (packages) that are considered essentials when building microservices so you can focus on what’s important, your application’s business logic. Here is a list of packages Go kit provides:</p><ul><li><strong>Authentication</strong> (Basic/Casbin/JWT)</li><li><strong>Circuit Breaker</strong> (Hystrix/GoBreaker/HandyBreaker)</li><li><strong>Logging</strong>: Provides an interface for structured logging.</li><li><strong>Metrics</strong>: Provides an interface for service instrumentation. Has adapters for CloudWatch, Prometheus, Graphite, and more.</li><li><strong>Rate Limiting</strong></li><li><strong>Service Discovery Utilities</strong></li><li><strong>Tracing</strong> (OpenCensus, OpenTracing, Zipkin)</li><li><strong>Transport</strong> (HTTP/gRPC/ NATS/AWS Lambda, and more)</li></ul><p>Other than being a toolkit, it also encourages good design principles for your application such as SOLID design principles, Domain-Driven Design (DDD), and Hexagonal architecture.</p><h3>Go kit’s Concept</h3><p>Go kit’s concept is based on three major components:</p><ul><li>Services</li><li>Endpoints</li><li>Transports</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KfkBtI-xPec2MH7PVT6dbA.png" /></figure><h4>Services (Business Logic)</h4><p>This is where the core business logic of your API is located. In Go kit, each service method are converted into an Endpoint.</p><h4>Endpoints</h4><p>An endpoint represents a single RPC method. Each Service method converts into an Endpoint to make RPC style communication between servers and clients.</p><h4>Transports</h4><p>In a microservice architecture, a microservice often communicate through transports such as HTTP or gRPC. A single endpoint can be exposed by multiple transports.</p><h3>Let’s build our microservice</h3><p>For our example microservice, we will build a very simple function that would get the sum of two numbers. Before we get started, make sure that you have <a href="https://grpc.io/docs/languages/go/quickstart/">Protocol buffer and Go plugins</a> for the protocol compiler installed.</p><p>To give you an overview what our project structure would look like by the end of this article, you can refer to the directory tree below.</p><pre>.<br>├── cmd<br>│   └── main.go         # main entrypoint file          <br>├── endpoints<br>│   └── endpoints.go    # contains the endpoint definition<br>├── pb<br>│   ├── math.pb.go      # our gRPC generated code<br>│   └── math.proto      # our protobuf definitions<br>├── service<br>│   └── api.go          # contains the service&#39;s core business logic<br>└── transports<br>    └── grpc.go         # contains the gRPC transport</pre><h4>Protobuf</h4><p>First of, we would need to create our Protobuf file inside our pb directory. Since you’re reading this, I would assume that you already know the basics of Protobuf; and the code snippet below should be pretty straightforward to understand 😄</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91d7275a17624bde2cc15c1c97379fc4/href">https://medium.com/media/91d7275a17624bde2cc15c1c97379fc4/href</a></iframe><p>Once we have our Protobuf file set, we would then need to generate our gRPC code using the following command.</p><pre>protoc --go_out=plugins=grpc:. pb/math.proto</pre><h4>Service</h4><p>Next up, we will create the core business logic of our microservice. So in service/api.go , we would add our service definition by using the following code below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/584517ce1b624968ea0c7762b2fc11e3/href">https://medium.com/media/584517ce1b624968ea0c7762b2fc11e3/href</a></iframe><h4>Endpoint</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fde1c4fa4d23f8c72e0d5135ed99e02/href">https://medium.com/media/6fde1c4fa4d23f8c72e0d5135ed99e02/href</a></iframe><p>From the code above for endpoints/endpoints.go, we have the Endpoints struct that serves as a helper struct to collect all of the endpoints into a single parameter.</p><p>The MathReq and MathResp simply defines the request parameters and response values for the Add method.</p><p>makeAddEndpoint func constructs our Add endpoint wrapping the service.</p><p>And finally, MakeEndpoints func returns a Endpoints that wraps the provided server and wires in all of the expected endpoints.</p><h4>Transport</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/daa1b853154a1e04aaaa280d5578443b/href">https://medium.com/media/daa1b853154a1e04aaaa280d5578443b/href</a></iframe><p>In our code for transports/grpc.go, we have NewGRPCServer which makes a set of endpoints available as a gRPC MathServiceServer .</p><h4>Main entrypoint</h4><p>This is where we stitch things together. Here we initiate our services, endpoints and our gRPC server, then we serve it using google.golang.org/grpc</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2abc8bb3cee35ee38ccc0f8184eb59f/href">https://medium.com/media/e2abc8bb3cee35ee38ccc0f8184eb59f/href</a></iframe><h3>Source Code</h3><p>You can find the source code of this example at <a href="https://github.com/junereycasuga/gokit-grpc-demo">https://github.com/junereycasuga/gokit-grpc-demo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff8c9151d2c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Node.js to Go]]></title>
            <link>https://medium.com/conflux-tech/from-node-js-to-go-db4548db3782?source=rss-2385c9b8a731------2</link>
            <guid isPermaLink="false">https://medium.com/p/db4548db3782</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Junerey Casuga]]></dc:creator>
            <pubDate>Mon, 22 Jun 2020 11:36:23 GMT</pubDate>
            <atom:updated>2020-06-23T03:54:28.349Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVQgfaxpKtXGpsljQEVR_A.png" /></figure><p>At <a href="https://conflux.tech/">Conflux</a>, we love JavaScript. In fact, most of our APIs were built using Koa, a Node.js framework designed by the same team behind Express. And even though we’re slowly moving into Flutter when it comes to building mobile applications, we still use ReactJS for building UIs for web.</p><p>Since we are a team who loves to learn and explore new things, we are always on a look out to things that we think would benefit us. So, we decided to take a look into <a href="https://golang.org/">Go</a>.</p><h3>Why Go?</h3><p>JS is a good language, but with numerous flaws. One of them is not being a statically typed language. What about TypeScript you must say? Yes, we do write all of our projects in TypeScript but it doesn’t always guarantee the type-correctness at runtime.</p><p>Another is performance. You probably know already that Javascript is not one of the most performant language out there. There are of course many options when it comes to performance such as Rust, Haskell, Elixir and so on. But we think Go is a great place to start as it is one of the simplest among the options.</p><p>Interestingly enough, even Ryan Dahl, the creator of Node.js took interest in Go.</p><blockquote>“If you’re building a server, I can’t imagine using anything other than Go” — Ryan Dahl, creator of Node.js</blockquote><p>Then TJ Holowaychuk, the author of Express, migrated into Go in 2014.</p><blockquote>“If you’re doing distributed work then you’ll find Go’s expressive concurrency primitives very helpful.” — TJ Holowaychuk, creator of Express.js</blockquote><h3>The Switch</h3><p>As developers coming from Node.js, switching to Go isn’t easy. We had to deal with a learning curve before we can even start building our microservices. Thankfully, we found a framework that allowed us to quickly enter the world of Go.</p><p><a href="https://gofiber.io/">Fiber</a> is a new web framework written in Go and is inspired by Express. It has a lot of methods and principles that seem to be very common to Express but still has Go’s performance.</p><p>Here’s a simple Hello World example using Fiber:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3U4FDR4QTyPWVNbYbOa-Q.png" /><figcaption>Sample “Hello, world” example using Fiber</figcaption></figure><p>If you have used Express, the code snippet above might look something familiar. If not, take a look at an example written using Express below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bqcZUr8PkI0IsDVL6M9ZXg.png" /><figcaption>Sample “Hello, world” example using Express</figcaption></figure><h3>Conclusion</h3><p>Of course the given examples above doesn’t show everything about Fiber and Express. There would still be differences between the languages they were using. Especially in terms of the discipline between writing a Go application and a Node.js application.</p><p>We just think that Fiber gave us a “feel like home” feeling because of its borrowed methods and philosophy from Express.</p><p>And since we will be writing more Go applications in the future, we have also published a Fiber REST boilerplate on Github. Our Fiber REST boilerplate can be found here: <a href="https://github.com/conflux-tech/fiber-rest-boilerplate">https://github.com/conflux-tech/fiber-rest-boilerplate</a></p><p><em>If you’re looking for a talented team to build your application, </em><a href="https://conflux.tech/"><em>Conflux</em></a><em> might be the choice for you </em>😎</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db4548db3782" width="1" height="1" alt=""><hr><p><a href="https://medium.com/conflux-tech/from-node-js-to-go-db4548db3782">From Node.js to Go</a> was originally published in <a href="https://medium.com/conflux-tech">Conflux</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>