A step-by-step guide to goroutines & channels

Go is widely being used for backend programming and its community is growing larger each day. Most people choose Go because of its easy-to-implement concurrency abilities.

This story is about how to implement concurrency in Go with a step-by-step guide. So this story considers you already know the basics of concurrency from other programming languages.

Why Go?

Doesn’t use OS…


The story of migrating a 1 million throughput domain

“Technology is the driver, ecommerce is the outcome.”

Favorites in Trendyol, most people in Turkey have either used it or heard it.

We’ve stopped using GraphDB and transformed our datasource to NoSQL (Couchbase) without losing essential features. We wanted to share our experiences and tell you why and how we did it.

Let’s first start with our legacy design:


Lately, in our team in Trendyol, we’ve slowly adapted Quarkus for our Java projects, due to its high performance (and we definitely recommend it!).

In this particular API, we wanted to send messages to a topic and we were pretty used to doing it in Spring, but it was our first try in Quarkus.

We’ve spent lots of time getting the hang of it. So I wanted to share how you can implement it and save you the trouble.

Eclipse Microprofile Reactive Messaging (the Reactive Messaging Client which Quarkus’ official documentation uses) didn’t support what we wanted to accomplish.

It…


aka Bogosort

I was spending a lot of time lately thinking about how I can improve my program’s sorting performance a little bit more. I was thinking:

Hey, there are sorting algorithms that have proven themselves well and that everyone knows, but there must be something we all are missing, maybe?

Well, I found something and I wasn’t wrong. There was something that we didn’t know much about, though it wasn’t exactly what I was looking for.

I found a really slow sorting algorithm called Monkey Sort aka Bogosort.

Photo by Brian Mann on Unsplash

Monkey Sort is based on Infinite Monkey Theorem:

The infinite monkey theorem is…


Design Patterns: Observer Pattern

Observer Pattern defines one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.

Photo by Dalton Abraham on Unsplash

Aside from formal definition, Observer Pattern helps us to listen (subscribe) to a subject and be up-to-date whenever a change occurs.

Subjects are open for the Observers to subscribe, and does not know (nor care about) how they are implemented and vice versa.

Simple Example:

Suppose you are building a social media app and implementing it for multiple platforms.

a platform enum (for the sake of simplicity)

public enum Platform {
WEB(1),
MOBILE(2);
}

a view interface…


Design Patterns: Decorator Pattern

Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.”

Photo by Christopher Jolly on Unsplash

Aside from formal definition, Decorator Pattern wraps around an object of a Decorator class, allowing you to dynamically change the behavior of an object at client code.

Simple Example:

Suppose you own a local pizza shop.

Of course you have menus with fixed prices, but you also have a “have-it-your-way” style pizza that allows customers to add whatever ingredient they want.

You calculated the costs of them all by yourself with a piece of paper and a pen, but now your…


Design Patterns: Strategy Pattern

Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use them.”

Photo by Kelly on Unsplash

Aside from formal definition, Strategy Patterns are widely used when you need to switch your algorithm or strategy in different places of your code.

Simple Example:

Suppose you build a game that has a Cat class that implements a Diet class. But let’s say your cat gained too much weight and now it needs to go on a diet that will help it lose weight for its health.

In this case, you can implement a…

Emre Tanriverdi

Software Engineer @Trendyol

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store