RSSAmplifier

Blog

Artur Dryomov

Recent content on Artur Dryomov

arturdryomov.devRSS feed ↗35 posts

Latest posts

Amazon S3 Paper Cuts

Amazon Simple Storage Service became not so simple over time. Not surprising at all — a lot has happened since 2006. The API reference has more than 100 actions and Amazon itself puts S3 features into a couple dozen of categories . It’s a good tool for countless applications — naturally, it has caveats. Fortunately or not, it’s also a product. As such, caveats become problems and problems become…

The Bus Factor of Zero

Onboarding new developers to a team is an opportunity for introspection. It’s one thing to share tribal knowledge, and another to realize that the mere existence of such knowledge can be counterproductive. Recently, I had an opportunity to onboard a new developer to one of our projects. Fortunately, almost everything went right. In a couple of days, the developer was able to contribute minor…

Modern Git for Modern Times

Git has been around for a long time — since April 2005. That’s 20 years! Fun fact — Bazaar and Mercurial were released around the same time as Git. Not so fun facts — during this time Atlassian removed the Mercurial support from Bitbucket and Canonical retired Bazaar altogether . Meanwhile, GitHub and GitLab are alive and well — safe to say, Git is here to stay. In fact, we might see Git 3.0 soon…

Python, foreign functions and Steam

Language ecosystems are not perfect. Sometimes resulting executables are performant but the syntax is horrible, sometimes there is a nice package manager but standard functions are scarce to a fault — it’s all about the compromise. Python is nice to use but the performance might be not great. The latter causes such tools as NumPy to emerge. How does it work? Well, it uses C calls…

Music Stats with DuckDB

Music! Everyone likes music. Well, I certainly hope so. Stats! Well, not everyone likes stats but I certainly do. In this article I’ll describe an approach to work with music scrobbles from different sources and in different formats using DuckDB . DuckDB is a perfect match for such ad-hoc scenarios — it has a minimal footprint, great performance and useful features. Scrobbles I’ve been using…

Testing Files without Files

File operations become less and less common. As users, we store more and more data in a vendor storage due to its convenience. I remember the contacts file format but cannot locate one on a local machine — I have Google Contacts instead. As developers, we use datastores — from S3 to Hive Metastore . Such datastores are scalable, fault tolerant and cheap. However, even if files and file systems are…

Autonomous GitHub Pull Requests

In general, people are lazy. This is our nature — we want to achieve more by doing less. Developers are on the next step of this urge — we want to automate similar actions, patterns in human behavior. And what’s more repetitive than working on pull requests for each source code change we make? Workflow Over time and multiple iterations I’ve established the following workflow. Open a PR. Assign…

Kotlin Code Organization

What’s the motivation behind organizing the code? Two points come to mind. Help humans. Consistent environments are easier to understand and adapt. Storing the source code in src/ instead of _k_/ makes it easier to find. Help machines. Build systems need hints. The code in main/ should be assembled all the time, while test/ is test-specific and shouldn’t make it to a production environment. Sounds…

On Technical Writing

Books were the internet for me before the real one became accessible. Authors wrote a thing and I’ve read it, consuming the information behind the text. First, I’ve read each book we had at home. Then everything meaningful from a kids’ section of the local library. And then I’ve been introduced into the serious stuff. I think The Hobbit was the beginning. Then The Three Musketeers , The Adventures…

Kotlin Enum Recipes

Enumerations, in a form of enum class declarations, got a bad rep on Android. In fact, the official documentation straight out recommends to avoid them . How rude is that? At the same time, Effective Java has a full chapter about enum . The situation reminds me of the trolley problem . Kind of. In this article, I’ll distance myself from Android specifics and show useful enum -related snippets.…

Midnight in Android Themes

Android Q introduces dark themes . Or night mode ? No idea. Anyways, it is here and can be helpful with using applications in dark environments or with bringing back that sweet Winamp skins vibe. Implementing dark themes is surprisingly deep and affects the whole application. At times it feels like a redesign. I’ve tried to collect steps we’ve made to introduce the dark theme in the Juno rider…

Superior Testing: Managing Production

The testing process does not magically stop after deploying an artifact. We’ve only just begun . It is impossible to check everything in a sandboxed environment. From a certain perspective it seems like the whole run time is the testing process. How is it possible to check the correctness without tests? Right — by running the thing. We do the same in production — just on a bigger scale and with…

Namespacing in Kotlin

The development process is a research. Find the state machine, organize mutations, wire it for consumers. The process repeats and leads to the meta-research. We investigate scenarios and search for reusable parts. Patterns arise, implementations follow. Ideally, the code resembles a fractal structure. An architecture is said to be fractal if subcomponents are structured in the same way as the…

Superior Testing: Cleaning Up

There is a game called Viscera Cleanup Detail . The task in this game is to… clean things up. Well, it is a bit more exciting since it involves alien invasions, but at the end of the day players become space janitors. It is surprisingly addictive. Cleaning things is useful and helpful in a lot of ways. Developers understand that, but usually there is an additional motivation to keep things…

Abstracting Kotlin Sealed Classes

Things tend to be similar. Cars and bikes are different for sure but both have wheels, engines, exhaust systems and so on. Such similarities between models are usually described using basic polymorphism in virtual domain modeling. Kotlin makes this process a bit more pragmatic using sealed class declarations. Specifying type hierarchies using sealed classes is simple, but what about declaring…

Superior Testing: Need for Speed

Everybody wants to have a faster development cycle. Everything should be flawless and straightforward. Nobody wants to have hour-long builds and stuck CI queues. We need results! Now! Or maybe even in the past, preemptively. Guard from the Ruby ecosystem comes to mind, starting tests on file changes, without doing it manually. Talking about tests — they are a part of the cycle, right? We run them…

Modern DateTimes on Android

Java 8 gave us a great gift — the java.time package, known as JSR 310 and ThreeTen . The story behind java.time is unique. It was introduced in JEP 150 by an independent developer — Stephen Colebourne ( @jodastephen ). Yep, the same person who designed and developed Joda-Time . It was even endorsed by Brian Goetz, the Java Concurrency in Practice author! The result is a great API — explicit and…

Superior Testing: Check Your Checks

False positives . Such an interesting combination of words, isn’t it? The nature of false positives is mostly human. We misinterpret conditions, define them wrong, forget about effects — but the machine obeys. We get what we want but not what we need. This is dangerous. The civilization downfall in various science fiction books is a false positive result. The AI gets instructions to eliminate all…

Merge Git Authors

Stats! Stats are awesome. You can collect them, you can analyze and visualize them, you can boil, grill and fry them… Wait, that’s not food, right? git shortlog Let’s say we have a Git repository. We want to count commits per author. There is a Git command for that! $ git shortlog --summary --numbered 2 Bender Rodriguez 2 Philip J. Fry 1 Bending Unit 22 1 Turanga Leela There are actually…

Superior Testing: Make Fakes not Mocks

After years of writing and reading tests I’ve discovered that mocking is either overused or underused. Not sure why exactly it happens but striking the right balance seems to be a complicated issue. In this Superior Testing article I’ll show how to replace mocking in favor of faking and collect benefits. Mocking Sync Let’s say we have a books repository allowing us to get a book based on its ID.…

Filling Android Autofill Gaps

We can have different opinions but should be able to agree on one thing — we are humans. Well, except ones who like Gerrit and use Dashboard on macOS . Those are clearly aliens (Mulder was right). All humans tend to forget things. Important and useless, smart and dumb, beautiful and ugly — it does not matter, any thought or information can disappear. Precious credentials for applications we work…

Superior Testing: Stop Stopping

Let’s start with confessions. The initial idea to kick-off a series of articles about testing was the shortest article ever. A single phrase. Just do it . I mean, isn’t it obvious that testing is awesome and useful? Unfortunately, after talking to dozens of developers I’ve come to the shocking fact that most of them don’t write tests. Our customer doesn’t pay for tests . We don’t have time . The…

Acceptance Criteria Bureaucracy

Cooperation! It sure sounds better than bureaucracy. A released product is a result of cooperation between the Business and the Tech. There is an obvious issue though. Both sides have different mindsets. The misunderstanding is inevitable. How do we solve this? Well, there are still wars on the planet so apparently humanity wasn’t able to find a solution. What about establishing not world peace…

Designing Errors with Kotlin

Fun fact — the area of the Java island is 138 793 km², the Kotlin island occupies 15 km². Of course, it is blatantly incorrect to compare languages based on same-named island areas. At the same time, it brings things in perspective. Java is the cornerstone of the JVM platform. The platform itself overshadows everything it hosts: Groovy, Ceylon, Scala, Clojure and Kotlin. It brings a lot to the…

Abandon Jenkins for Great Good!

CI and CD techniques are a part of all good happened to the software development. Having CI in place means better productivity and higher confidence in the result of the everyday work. Sounds kind of obvious, right? Well, let’s take a look at the dark side of the Moon . Do you have a person on the team who occasionally curses Gradle or (and) Maven, Android SDK or (and) NDK? Maybe someone who knows…

Reactive Pipelines in Action

Human beings are reactive by nature — fortunately or not. The reason is mostly physiology. The dopamine hormone helps us to feel comfortable and secure while we do familiar things. Eating a sandwich sounds and feels far better than gardening, doesn’t it? Essentially it is a fight between psychology (the mind, proactive actions) and physiology (the body, reactive actions). The same thing happens in…

Reactive State Mutations via CQRS

State-state-state. It surrounds us. Think hard enough and everything around will become either a state or a state mutation. The current time is a state and each passing second is a state mutation. A tree can be represented by a state and each drop of rain mutates it, increasing the water supply level and applying the pressure on leaves. The concept is not new, but sometimes it becomes too hard to…

Optimizing Android Vector Images. Or Not?

An average working day of an Android developer involves doing something with UI. Pushing widgets around, changing text and images… The colleges of mine convert SVG images to VectorDrawable via a specific converter and I use Android Studio. Which tool does the job better? Let’s find out! Tools Converters (do optimizations under the hood): Android Studio (3.1.4) — IDE. svg2android — website,…

Reactive Abstractions in Android World

Who knows how many test suites were not created because of a classic parry. It cannot be tested — it uses a platform call! Well, it is not actually true all the time. Unit testing something that only a human eye and neural networks can catch — like animations — doesn’t make sense. On the other hand, retrying a network request on a re-established connection can and should be tested. As a bonus, it…

How the Pull Request is Built

Contact information of a friend of mine mentions that he doesn’t have Facebook or Twitter accounts, but he is available at a really cool social network called… GitHub. Actually, GitHub is a social network, it even had direct private messages until April 2012 . The developer community should be grateful to GitHub not only for awesome Octocats but for the popularizing a concept of pull…

Mobile Developer Morning Fun

Do you read this article on a phone? No? Well, I’m pretty sure you have a phone. Fun fact — I’ve bought the best phone I ever had, the Nexus 5X, from Amazon. Another fun fact — there is a pretty good chance you’ve bought something from Amazon too since it grabbed 4% of US retail sales in 2017 . That’s a lot! Amazon not only sells things but hosts a significant portion of internet resources thanks…

Do Androids Dream of UI Testing?

Automation is a foundation stone of the software development. People didn’t like counting numbers themselves, so they invented calculators. Calculators went to be computers and here we go, waiting for AI to take over, watching movies about transhumanism on our way here. Automation related to UI testing seems to be a Holy Grail from that standpoint. Sure thing, it can replace manual QA procedures…

A Dagger to Remember

Story Time! Kotlin and Java annotations have a complicated relationship. This goes from the syntax to the toolchain. Does anybody remember that at the beginning of time Kotlin annotations were placed in square brackets? In 2015 the syntax was changed to the current form . Before that, it was [Inject] instead of @Inject . Yep. The syntax is fine at this point, but kapt ( Kotlin annotation…

The Art of a Dependency Upgrade

RxJava 1.x reaches EOL on March 31, 2018, meaning no further development. That’s not surprising since the 1.x was in a bugfix-only mode since June 1, 2017. This is an interesting event in a software lifetime, since not so many libraries actually live and prosper long enough to produce a superior version, at the same time handling support for an older version for so long. Fortunately enough, RxJava…

Kotlin: The Problem with `null`

I think almost everybody in the CS world knows about the Null References: The Billion Dollar Mistake talk. However, it does not really matter if the concept of null references a good idea or a really bad one. We live in the world where we just have to deal with null this way or another. Yep, just deal with it. So let’s ask the “How” question instead of the “Why” one.