DB Replication (IV): Replication lag
You can read the previous article in the series here: replication mechanisms
It’s time we talk about an important property of real-world replication: replication lag.
In the first article of the series, we mentioned that there are two forms of replication: synchronous and asynchronous. Synchronous replication waits until every follower has app...
DB Replication (III): Replication mechanisms
You can read the previous article in the series here: replication mechanisms
We’ve been talking about replication log and change stream in the last two articles in this series. This is the mechanism the leader uses to communicate changes to the followers. As you can imagine, there are different implementations with their advantages and disadvan...
DB Replication (II): Failure recovery fundamentals
In the previous article we learned the basics of replication and why it is useful to learn about it.
We also learned about leader/follower replication. We select a replica to be the leader, and clients will only be able to send writes to this replica. After a write is processed by the leader it notifies every follower (the other replicas in the...
DB Replication (I): Introduction to database replication
Replication is the process by which data is copied, stored and kept up-to-date across different data storage systems.
Most of the theory behind replication has existed since the ’70s. With the advent of cloud computing and distributed databases, this information has become more important than ever for professional software engineers.
While it’...
Depend on behavior, not on data
This is one of the most powerful pieces of advice in OO programming I’ve ever received.
It means that objects shouldn’t be seen just as a collection of data structures. Instead, you should visualize them as software entities that can respond to messages and answer questions about themselves.
We achieve this by hiding away implementation detail...
Things I wish I had known when I started programming, Part 8
Yepp, more things I wish I’d known when I started, 8th edition.
You can find the first article in the series here.
And the previous article here
Programming is not about memorizing, it’s about understanding
When I started programming I felt very frustrated when I tried to write simple things just to find out I forgot some syntax details. I c...
Writing good software comments II
In a previous article, we talked about the importance of comments in software development.
Even though they are powerful tools for improving the readability of our code, we should use them with care. A good comment can make the code easier to understand, but a bad one can harm your productivity.
Bad comments clutter your editor and make code h...
Writing good software comments I
Comments are, to put it mildly, a controversial topic.
There are two very strong opinions in software development, both extremely popular and widespread. The first one states that comments are evil, and you should not use them under any circumstance. The main argument is that instead of using comments, you should try to make the code as readabl...
Ruby iterators and the yield keyword (with examples)
Ruby iterators and the yield keyword
Ruby iterators are a special type of method supported by collections. They are like any other regular method, but they receive an additional input in the form of a code block. Iterators are one of the most useful features of the Ruby language, and using them effectively is a great way of creating clean metho...
A gentle introduction to pointers using the C programming language
Pointers are one of those concepts that make no sense when you first learn about them. Usually, a change of perspective is enough for something in your brain to click and - puff! - everything magically falls in its place.
Despite this initial confusion, pointers are extremely powerful tools. Moreover, in some languages (like C or Go) understand...
Things I wish I had known when I started programming, Part 7
Yepp, more things I wish I’d known when I started, 7th edition.
You can find the first article in the series here.
And the previous article here
Test your code
Writing tests is one of those things that you appreciate more as you gain experience.
In the beginning, it’s hard to understand why we need tests. I know it works, how do I know it w...
Better arguments == Better functions
Arguments play a very important role in the readability of a function. When implemented properly, they show intent and provide information about the function’s behavior. This is one of the reasons why investing time in engineering good arguments can help to improve the quality of your code. Let’s see how we can make the most of our arguments, or...
Things I wish I had known when I started programming, Part 6
Yepp, more things I wish I’d known when I started, 6th edition.
You can find the first article in the series here.
And the previous article here
Don’t try to predict the future
We suck at predicting the future.
Every time you make an architectural/design decision, you close options in your design and constrain your program’s options for cha...
The Interface Segregation Principle
The Interface Segregation Principle (ISP) is concerned with the way clients access the functionality developed in another class. It states that clients should not be forced to depend on functionality they don’t use.
Following this principle has several upsides. On one hand, it protects your objects from depending on things they don’t need. Remo...
Things I wish I had known when I started programming, Part 5
Yepp, more things I wish I’d known when I started, 5th edition.
You can find the first article in the series here.
And the previous article here
You read code more often than you write it. Optimize for reading
Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human bei...
Things I wish I had known when I started programming, Part 4
Yepp, more things I wish I’d known when I started, 4th edition.
You can find the first article in the series here.
And the previous article here
Love maintenance work or at least learn to appreciate it
Very few things are more despised by programmers than doing maintenance work and working with legacy apps.
This can be counterproductive, as...
The Liskov Substitution Principle
In 1987, while delivering a keynote on data abstractions and hierarchies, Barbara Liskov introduced the idea that would eventually become the Liskov Substitution Principle. The following is a modern (and very formal) description of the principle:
Let Φ(x) be a property provable about objects x of type T. Then Φ(y) should be true for objects ...
Effective code reviews in 5 easy steps
Code reviews are one of those things that you either really love or really hate.
When done well, they can dramatically increase the quality of your code and teach you lots of important practices. Poorly done reviews, on the other hand, can make you dread every time you try to push your code into version control.
While your team’s attitude and ...
103 post articles, 6 pages.