Zapoj sa do knižnej hry a vyhraj poukážku až 300 €

Prečítate na zariadeniach:

  • Pocketbook
  • Kindle
  • Smartfón či tablet s príslušnou aplikáciou
  • Počítač s príslušnou aplikáciou

Nie je možné meniť veľkosť písma, formát je preto vhodný skôr pre väčšie obrazovky.

Viac informácií v našich návodoch

Prečítate na zariadeniach:

  • Pocketbook
  • Kindle
  • Smartfón či tablet s príslušnou aplikáciou
  • Počítač s príslušnou aplikáciou

Viac informácií v našich návodoch

Prečítate na:

Neprečítate na:

Ako čítať e-knihy zabezpečené cez Adobe DRM?

Understanding The Weird Parts: [patched]

When something behaves weirdly, ask not “Why is this broken?” but “What model would make this behavior necessary or inevitable?” In JavaScript’s type coercion, the model is one of flexible, dynamic conversion trying to prevent runtime errors. In Python’s mutable defaults, the model is one of efficiency and consistency with function attribute behavior. Every weird part has a rationale, even if that rationale is historical accident (e.g., typeof null because of how type tags were implemented in early JavaScript).

Weirdness is often the result of simplified mental models. The beginner’s model of arithmetic (addition as repeated counting) fails for negative numbers because it is a special case. The expert’s model (addition as group operation on the integer ring) handles all cases uniformly. Reading the ECMAScript specification, the Python data model documentation, or Euclid’s axioms transformed by modern set theory is the work of moving from folk understanding to formal understanding.

Why do such parts exist? Often, because formal systems grow organically. Programming languages evolve from practical needs, accruing edge cases and legacy behaviors. Mathematics expands by generalization, sometimes producing results that contradict earlier intuitions (e.g., the Banach-Tarski paradox). Human cognition itself is a patchwork of evolutionary shortcuts, leading to systematic biases. The weird parts are not bugs in the universe—they are features of systems that were never designed from scratch with perfect foresight. Perhaps no field offers a richer collection of weird parts than software engineering. Consider JavaScript’s type coercion: [] + [] evaluates to an empty string, [] + {} becomes "[object Object]" , but {} + [] is 0 . The explanation involves the language’s implicit type conversion rules, the distinction between statement and expression contexts, and the + operator’s overloaded behavior. At first glance, this seems arbitrary. But after studying the specification—how the ToPrimitive abstract operation works, how valueOf and toString are called—the weirdness becomes understandable. It is still surprising, but no longer mysterious. understanding the weird parts

Similarly, Python’s default mutable arguments are a classic weird part: def append_to(element, target=[]): target.append(element); return target will share the same list across multiple calls if not passed explicitly. This violates the expectation that default arguments are recreated each time. The underlying reason is that default arguments are evaluated at function definition time, not at call time. Understanding this requires shifting from an intuitive “fresh copy each time” model to the actual model: default arguments are stored as attributes of the function object.

The value of exploring such weird parts is not pedantry. When developers ignore these edge cases, bugs emerge—silent data corruption, inexplicable performance issues, subtle security vulnerabilities. More importantly, learning why a weird part exists reveals deeper principles: the difference between compile-time and runtime, the distinction between syntax and semantics, the trade-offs between consistency and backward compatibility. Weird parts are the stress tests that transform a journeyman coder into a master engineer. Mathematics is often presented as a fortress of pure logic, yet it is riddled with weird parts. Consider the set of all sets that do not contain themselves. Does it contain itself? If yes, then no; if no, then yes. Russell’s paradox shattered naive set theory and forced a reexamination of the very foundations of mathematics. The “weirdness” here was not a flaw but a revelation: our intuitive notion of “any well-defined collection” was too naïve. When something behaves weirdly, ask not “Why is

In any complex discipline—whether programming, mathematics, linguistics, or even philosophy—there exists a territory known colloquially as “the weird parts.” These are the corners of the system that defy intuitive grasp, where the elegant, simple rules we learned first break down into counterintuitive exceptions, paradoxes, or behaviors that seem almost willfully obscure. To understand the weird parts is not merely to collect arcane trivia; it is to achieve a deeper, more mature mastery of the subject itself. This essay explores the nature of “weird parts” across several domains, why they exist, how to approach them, and why embracing them is essential for genuine understanding. The Nature of Weirdness: Where Intuition Fails Weirdness arises at the intersection of two forces: the inherent complexity of a system and the limitations of human cognitive heuristics. Most introductory learning is built around idealized, simplified models. In JavaScript, for example, beginners learn that typeof returns a string indicating a variable’s type. Then they encounter typeof null returning "object" —a known, acknowledged bug that cannot be fixed without breaking existing code. That is weird. In mathematics, we learn that multiplication is repeated addition—until we try to multiply two negative numbers and get a positive result. In logic, we learn that a statement is either true or false—until we encounter the liar paradox (“This sentence is false”). Weird parts are not mistakes (though some are historical accidents); they are boundary conditions that expose the limits of our mental models.

Fractal geometry offers another kind of weirdness: objects with non-integer dimension, infinite perimeter enclosing finite area (the Koch snowflake), or curves that fill space entirely. These defy Euclidean intuition, but they model coastlines, clouds, and biological growth more accurately than idealized shapes. The weird parts here become useful tools once we accept that dimension is not a simple whole number but a measure of complexity. The weirdest parts of all may be within our own minds. Cognitive biases like the conjunction fallacy (Linda the bank teller problem) show that human probability judgments violate the basic axioms of probability theory. We think that “Linda is a bank teller and a feminist” is more likely than “Linda is a bank teller,” even though the conjunction cannot be more probable than its constituent. This is weird because our brains evolved for heuristic reasoning about social and survival scenarios, not for abstract logical consistency. Weirdness is often the result of simplified mental models

Write code that explicitly tests weird behaviors. Derive mathematical paradoxes step by step. Try to construct sentences that break your native language’s grammar rules. Weird parts become familiar only through exposure. But not passive exposure—active experimentation. Change one variable, see what happens. Ask “what if” questions.

Ľúbi sľuby
Kniha: Je taký (Tomáš Janovic), 2004
Je taký
  • Tomáš Janovic
understanding the weird parts