Is Using Boolean Arithmetic Like This Ever a Good Idea?
I wrote a single line that chooses between different expressions based on whether `IorC` is equal to `"i"`, `"c"`, or `"s"`: `IorC = IorC**(IorC == "i") + CodedF**(IorC…
I wrote a single line that chooses between different expressions based on whether `IorC` is equal to `"i"`, `"c"`, or `"s"`: `IorC = IorC**(IorC == "i") + CodedF**(IorC…
I wrote a line that chooses between different values based on whether `IorC` is equal to `"i"`, `"c"`, or `"s"`, using Boolean results as arithmetic or multiplication factors:…
I'm learning Go as my first programming language, and I keep running into the choice between compact one-liners and more verbose, step-by-step code. For example, to select a…
I'm learning Go as my first programming language, and I keep running into the choice between concise one-liners and more explicit step-by-step code. Tutorials and coding exercises often…
Sometimes I write code that works correctly, but when I revisit it a few days later, I struggle to remember what I was trying to do. What practices…
Sometimes I write code that works correctly, but when I return to it a few days later, I struggle to remember what I was trying to accomplish. What…
I'm building a chess engine in Python as a hobby project. I started with straightforward, readable code, but I've gradually replaced parts of it with bitwise operations and…
I'm building a chess engine in Python as a hobby project. I started with straightforward, readable code, but I've gradually replaced parts of it with bitwise operations and…
I have several years of software development experience and care about practices such as KISS, DRY, BDD, OOP, readable design, and maintainability. For about a year I've used…
I have several years of software development experience and generally follow practices such as KISS, DRY, BDD, OOP, and established design patterns. For about a year, I've been…
I've heard people describe poorly written code as making their eyes bleed, but what does that actually mean? What specific habits or design choices make code difficult to…
I've been developing in Java for a few years, but I still find that simply reading the code often isn't enough to understand what it actually does. Important…
I've heard people describe difficult code by saying that reading it made their eyes bleed. I understand that code can be buggy, but what makes code feel bad…
I often solve a problem with a manual loop, only to discover later that the language already provides a built-in function or standard-library method for it. In general,…
I find snake_case easier to read because people naturally read words separated by spaces. For example, "imagineThisWord" seems harder to scan than "imagine_this_word." Is this preference purely subjective,…
I'm new to JavaScript after learning some C, and I'm feeling overwhelmed by how many different syntax options the language has. I recently encountered destructuring, for example: const…
I've always thought Python's walrus operator (:=) was neat, especially for making while-loop conditions clearer. At the same time, it mostly seems like syntactic sugar rather than a…
I've always thought Python's walrus operator (:=) was neat, especially for making some while-loop conditions clearer. At the same time, it mostly seems like syntactic sugar rather than…
I'm currently working on a game using Pygame and I'm trying to decide between two ways to unpack values from a dictionary that contains button information. I'm new…
I often find myself writing certain types of code in embedded processing, and I think it would be great if C++ had some simpler syntax options. For instance,…