Stringly Typed Booleans

I’m getting rather hacked off seeing boolean properties typed as strings. Stringly typed is a phrase I learnt off a post from the excellent Coding Horror blog and it describes a phenomena whereby properties that are of a specific type, e.g. Boolean, Date, int, are stored needlessly as strings.

I’m working on a website that communicates with a money laundering service to check whether an individual is “bad” or not. Individuals can pass the test, but importantly it is possible to pass the test with some warning flags raised. If any of the warning flags are raised then an email should be sent off to compliance for them to do…whatever it is they do. Fair enough right?

The warning flags are obviously booleans. There was either a warning raised or there wasn’t – there are no two ways about it (no pun intended). In the serialized response, the warning flags are encoded as “Yes” or “No”…which is understandable. Now, upon receiving the response, it is parsed and turned into an internal representation. This is where things get really weird. The programmer that coded the object that stores the response from the service has decided to encode the warnings as strings, initialised to “”. Which is totally fucking bonkers.

Why?

Well, now our boolean warnings aren’t really booleans – they have WAY more than two possible values and the meaning of these values is subjective. One may consider “”, null, “No” as false, but could conceivably also consider “false” or “0″. We get the same sort of problem with true – “Yes”, “1″, “true” and then we get a whole load of unknown values which is every other possible string in the world. Which might be considered to be true.

So how the hell can any number of programmers work on this piece of code without introducing errors because of differing definitions of truthy and falsey values? Well, they can’t. To illustrate the problem further, even loosely typed languages differ in their boolean coercion, for example JavaScript and PHP:

<script>
if("0") alert('Opposite day!');
</script>

<?php
if("0") echo 'Opposite day!';
?>

JavaScript considers “0″ true but PHP considers it false. Personally I think JavaScript is “right” here, but as I said before, it is totally subjective.

The icing on the cake is of course the extra code you have to write to check the truthy or falsey string values. Something along the lines of “if x is not null and not empty and not the word No then it is probably true…probably”, which would otherwise have been coded as “if x then true” if x was a boolean – which is orders of magnitude shorter.

Of course, there are some bat shit crazy strongly typed languages that allow you to assign null to a Boolean, but that is a different story altogether.

684 thoughts on “Stringly Typed Booleans

  1. Статья представляет интересный взгляд на данную тему и содержит ряд полезной информации. Понравилась аккуратная структура и логическое построение аргументов.

  2. Я впечатлен этой статьей! Она не только информативна, но и вдохновляющая. Мне понравился подход автора к обсуждению темы, и я узнал много нового. Огромное спасибо за такую интересную и полезную статью!

  3. Интересная статья, в которой представлены факты и анализ ситуации без явной предвзятости.

  4. Статья содержит обновленную информацию и факты, подтвержденные надежными источниками.

  5. Я просто не могу не поделиться своим восхищением этой статьей! Она является источником ценных знаний, представленных с таким ясным и простым языком. Спасибо автору за его умение сделать сложные вещи доступными!

  6. Я хотел бы отметить глубину исследования, представленную в этой статье. Автор не только предоставил факты, но и провел анализ их влияния и последствий. Это действительно ценный и информативный материал!

  7. Hi there would you mind letting me know which webhost you’re using? I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot faster then most. Can you recommend a good hosting provider at a fair price? Thanks a lot, I appreciate it!

  8. аренда яхты на канарах

  9. Asking questions are in fact fastidious thing if you are not understanding something entirely, except this post gives nice understanding even.

  10. Это поддерживается ссылками на надежные источники, что делает статью достоверной и нейтральной.

  11. Металлообработка и металлы j-metall.ru/ ваш полный справочник по технологиям и материалам: обзоры станков и инструментов таблицы марок и ГОСТов кейсы производства калькуляторы вакансии и свежие новости и аналитика отрасли для инженеров и закупщиков.

  12. Статья представляет обобщенный взгляд на проблему, учитывая ее многогранные аспекты.

  13. Автор явно старается сохранить нейтральность и представить множество точек зрения на данную тему.

  14. Pretty nice post. I just stumbled upon your weblog and wished to say that I have really enjoyed browsing your blog posts. After all I will be subscribing to your feed and I hope you write again very soon!

  15. Статья предлагает разнообразные точки зрения на тему, предоставляя читателям возможность рассмотреть различные аспекты проблемы.

  16. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why waste your intelligence on just posting videos to your weblog when you could be giving us something informative to read?

  17. It is the best time to make some plans for the long run and it’s time to be happy. I’ve learn this post and if I could I desire to suggest you few interesting issues or tips. Maybe you can write subsequent articles regarding this article. I wish to read more issues approximately it!

  18. Статья содержит анализ преимуществ и недостатков различных решений, связанных с темой.

  19. Я ценю балансировку автора в описании проблемы. Он предлагает читателю достаточно аргументов и контекста для формирования собственного мнения, не внушая определенную точку зрения.

  20. Everything is very open with a clear description of the challenges. It was truly informative. Your site is extremely helpful. Many thanks for sharing!

  21. Автор статьи представляет информацию в четкой и нейтральной форме, основываясь на надежных источниках.

  22. Надеюсь, что эти дополнительные комментарии принесут ещё больше позитивных отзывов на информационную статью! Это сообщение отправлено с сайта GoToTop.ee

  23. and I was making a basket of dock-leavesto hold what you’d picked,but the cold leaves unplaited themselves 10.1 Betnation is te allen tijde gerechtigd om eenzijdig de Diensten, (de omvang van) de weddenschappen, quoteringen, inzetlimieten alsook de limieten met betrekking tot het speelgedrag van Spelers vast te stellen en te wijzigen, zoals (maar niet beperkt daartoe) de duur van de toegang tot het Spelersaccount, de limiet van Transacties en of de (overige) speellimieten van Spelers. Betnation behoudt zich daarnaast het recht voor om naar eigen goeddunken de Return to Player (RTP) te verlagen of te verhogen, zonder voorafgaande kennisgeving aan de Spelers. Super Boost van Electric Elephant , Starburst XXXtreme van Netent en Peking Luck van Pragmatic Play staat nu fier bovenaan. Cryptovaluta-uitbetalingen worden typisch binnen 24 uur verwerkt na goedkeuring, maar hangen af van blockchain-netwerkcondities. Opmerkelijk is het systeem van vier gratis opnames per maand; vanaf de vijfde opname wordt €60 aan verwerkingskosten in rekening gebracht.
    https://app4live.octusdesign.com/2025/10/03/een-diepgaande-analyse-van-spinybet-voor-mobiele-spelers-in-nederland/
    Pragmatic Play heeft een indrukwekkende verzameling slotspellen die wereldwijd geliefd zijn bij spelers. Enkele top Pragmatic Play slots zijn Wolf Gold, Sweet Bonanza, John Hunter and the Tomb of the Scarab Queen en The Dog House. Deze spellen staan bekend om hun innovatieve bonusfuncties en hoge winstkansen. Je vindt bij sommige van onze favoriete goksites ook live casinospellen en bingo varianten op de beste spellen van Pragmatic Play. Sugar Rush was al een geweldig spel en Sugar Rush 1,000 tilt de grootsheid naar een hoger niveau. Kortom, het is een must-play voor alle gokkastenliefhebbers. Sugar Rush 1000 speel je bij deze casino’s: Met Sweet Bonanza Dice legt Pragmatic Play de lat hoog en biedt het een spelervaring die zowel leuk als spannend is. Dankzij de royale multipliers, free spins en een gunstige RTP kan elke draai voor verrassingen zorgen. Bereid je voor op een adrenalinekick en puur speelplezier!

  24. Auch die angebotenen Zahlungsmethoden können Ihnen als Spieler verraten, ob es sich hierbei um einen guten Vertreter des Online Glücksspiel handelt, oder eben nicht. Schließlich arbeiten Global Player im Bereich der Zahlungsanbieter nur mit den besten Online Casinos ohne OASIS zusammen. Sollten also Firmen wie VISA, Mastercard, Paypal und Co als Einzahlungsmöglichkeit zur Verfügung stehen, dann ist das ein klares Qualitätsmerkmal. Eine vernünftige Recherche vor der finalen Auswahl des neuen Online Casinos ohne OASIS ist also unerlässlich. Das Bonusangebot des Book of Ra Casinos BingBong runden attraktive tägliche Promotionen mit Freispielen und Reload Boni ab. Halten Sie also Ausschau nach Promotionen für 25 Freispiele Book of Ra ohne Einzahlung, die sich oftmals in den E-Mail Nachrichten des Anbieters verstecken könnten. 
    https://king12.com/verde-casino-deutschland-umfassender-uberblick-und-vorteile-fur-spieler/
    Bei den Slots hat sich Novomatic nicht lumpen lassen und eine breite Einsatzspanne angebracht. Man kann die Spielautomaten mit einem Einsatz zwischen 0,01 € und 900 € zocken, was sie auch für Highroller interessant macht. Sollten Sie jemand sein, der Turniere und große Gewinnchancen liebt, dann ist das Superboss Casino die perfekte Wahl für Sie. Das Casino bietet eine breite Palette spannender Turniere, die ständig aktualisiert werden und auf der Turnierseite zu finden sind. Jedes Mal, wenn ein Turnier endet, beginnt ein neues, sodass Ihnen immer wieder neue Möglichkeiten geboten werden, gegen andere Spieler anzutreten und fantastische Preise zu gewinnen. · Geringe Wahrscheinlichkeit, große Gewinne zu erzielen; Wenn Ihnen der Sinn nach einem Retro-Style Slot mit lukrativen Bonusfeatures und tollen Grafiken steht, dann sollten Sie unbedingt den Stickers Slot von NetEnt ausprobieren. Bringen Sie die Walzen ins Rollen und sammeln Sie Ihre liebsten Fruchtsymbole ein, angefangen von saftigen Pflaumen, Melonen, Orangen und natürlich den süßen Erdbeeren. Zusätzlich gibt es noch die üblichen Kartensymbole, wie Asse, Könige, Damen, Buben und die 10. Außerdem hat dieser Slot tolle Bonusfeatures zu bieten, wie zum Beispiel die Sticky Wilds und Sticky Spins.

  25. Sugar Rush w Vulkan Vegas Casino to coś więcej niż tylko automat do gry – to przygoda w świecie słodkich rozkoszy i ekscytujących wygranych. Dzięki zachęcającemu motywowi, hojnym bonusom i przyjaznemu dla użytkownika projektowi jest to idealny wybór dla każdego, kto chce cieszyć się wysokiej jakości grą na automacie. Poczuj radość i potencjalne nagrody w Sugar Rush – Twoja słodka przygoda czeka! Sugar Rush wyróżnia się grafiką z motywem cukierków i zabawnymi efektami dźwiękowymi. Ta atrakcyjna wizualnie gra jest łatwa w obsłudze, idealna zarówno dla początkujących, jak i doświadczonych graczy. Każdy symbol na bębnach reprezentuje różne słodycze, zwiększając zabawę i wciągające wrażenia z gry. Odpowiedzialna gra polega na świadomym podejściu do rozrywki oraz zarządzaniu swoim budżetem. Poniżej przedstawiamy kilka zasad, które warto stosować podczas gry w Sugar Rush:
    https://md.fachschaften.org/s/LR0q-tvJ_
    Walden Farms Kornelia Warda-PonieckaPłaczącej Wierzby 11, Wola Gołkowska, 05-503 Głosków Brał również udział w FAME MMA, debiutując na 16. gali 5 listopada 2022 r. w Gliwicach, gdzie przegrał walkę z Dzinoldem decyzją sędziów. Miał konflikt z innym streamerem, Adrianem Polakiem, który obejmował publiczne kłótnie, w tym incydent w restauracji i groźby przed konferencją FAME MMA. Oprócz tych dwóch bonusów, że oferują one jeszcze jedną przewagę metody gry w kasynach. Sugar rush System płatności Pay anywhere na przykład niektóre platformy stosują wymagania dotyczące obrotu bonusem i depozytem, że powiedział. Istnieje nawet euchre gry w poniedziałki w Leelanau, w której zamierzają zachować swoje wygrane.

  26. С удовольствием! Вот ещё несколько положительных комментариев на информационную статью:

  27. These files are necessary for the operation of our website, so you cannot disable them. Educator Training Lash Extend is a formula modeled after a clinically proven lash growth serum with an active peptide blend. If you’re looking for a non-drug, medical-grade formula to up the oomph factor on your lashes, then our Lash Extend features a synergistic combination of silk amino acids, peptides, and botanicals to promote lash growth by conditioning, strengthening, and anchoring the hairs. Silk amino acids coat and condition the lashes, peptides encourage hair bulb keratinocyte production and optimal hair anchorage, and active botanicals such as chamomile and aloe vera help repair damaged hairs. Prostaglandin analogues are drugs used to treat a condition of the eye called Glaucoma, and one side effect from this drug was found to be lash growth. Off the back of this, prostaglandin derived lash serums were born.
    https://md.nowum.fh-aachen.de/s/4KhpngBRI
    Then you can decide as you go with classic and hybrid lashes. You can choose where to get the hybrid classic lashes attached. Even with the fallout, the mixed lash installation leaves enough drama in your eyes. This integration presented by hybrid eyelash makes getting eyelash extensions interesting. All people and all eyes are different–that’s why working as a lash stylist is such fun! At Lady Lash, we always strive to give you the best advice for your own eyes and natural lashes, drawing on our years of training and styling to make sure you love your eyelash extensions. If you have trouble determining your eye shape, or think that something different might be more for you, just let us know! Our receptionists and stylists love to talk all things lashes, and together we can come up with a design perfect for you.

  28. An intriguing discussion is definitely worth comment. I believe that you ought to publish more about this subject, it may not be a taboo matter but generally folks don’t talk about these topics. To the next! Cheers!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>