Tales of disastrous development

Published Sep 29, 2019. 1 minutes to read.

Code snippets and short stories that just don’t register.


Current user ID, but not really

Found in production code.

Application.getCurrentUser().getId()

When invoked, always returns value 0. Instead you are supposed to use Application.getCurrentUser().getSession().getId(), because that totally makes sense somehow.


Not an Integer

In Ruby versions prior to 2.4.0 class of int depends on it’s size.

/ # irb
irb(main):001:0> 1.class
=> Fixnum
irb(main):002:0> 111111111111111111111111111111.class
=> Bignum

No rest for the wicked

Ruby has a built-in time dilation field.

/ # irb
irb(main):001:0> sleep 0.5
=> 0
irb(main):002:0> sleep 0.5
=> 1
irb(main):003:0> sleep 0.5
=> 0
irb(main):004:0> sleep 0.5
=> 1
irb(main):005:0> sleep 0.5
=> 1
irb(main):006:0> sleep 0.5
=> 1
irb(main):007:0> sleep 0.5
=> 1
irb(main):008:0> sleep 0.5
=> 0

A complete disaster of explanation can be found here.


What a Terrible Failure

This Android API exists. And someone said Google engineers lack a sense of humor.

public static int Log#wtf(...);
© Matiss Treinis 2019, all rights, some wrongs and most of the lefts reserved.
Unless explicitly stated otherwise, this article is licensed under a Creative Commons Attribution 4.0 International License.
All software code samples available in this page as part of the article content (code snippets and similar) are licensed under the terms and conditions of Apache License, version 2.0.