# enum

An enum is a programming construct that defines a type from a set of named or symbolic members, which can represent distinct choices or variants.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Mercure Broadcasting in Laravel 13.32

DevFeed: [Mercure Broadcasting in Laravel 13.32](<https://devfeed.tech/articles/mercure-broadcasting-in-laravel-13-32-31558.md>)

Original publisher: [Read original article](<https://laravel-news.com/laravel-13-32-0>)

Author: Paul Redmond

Published: 2026-09-16T02:44:52Z

Content type: release

Language: en

Sources: [Laravel](<https://devfeed.tech/sources/laravel.md>)

Topics: [Laravel](<https://devfeed.tech/topics/laravel.md>), [releases](<https://devfeed.tech/topics/releases.md>), [Release notes](<https://devfeed.tech/topics/release-notes.md>), [real-time](<https://devfeed.tech/topics/real-time.md>), [enum](<https://devfeed.tech/topics/enum.md>), [WebSocket](<https://devfeed.tech/topics/websocket.md>)

Tags: [enums](<https://devfeed.tech/tags/enums.md>), [features](<https://devfeed.tech/tags/features.md>), [github](<https://devfeed.tech/tags/github.md>), [laravel](<https://devfeed.tech/tags/laravel.md>), [laravel-releases](<https://devfeed.tech/tags/laravel-releases.md>), [news](<https://devfeed.tech/tags/news.md>), [queue](<https://devfeed.tech/tags/queue.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [release](<https://devfeed.tech/tags/release.md>), [release-notes](<https://devfeed.tech/tags/release-notes.md>), [storage](<https://devfeed.tech/tags/storage.md>), [update](<https://devfeed.tech/tags/update.md>), [websockets](<https://devfeed.tech/tags/websockets.md>)

### AI overview

Laravel 13.32 adds a Mercure broadcast driver, filesystem methods for copying and moving files between disks, and enum support for queue pause and resume methods. The release also includes additional fixes and updates.

### Source excerpt

Laravel 13.32 adds a Mercure broadcast driver, Storage::copyToDisk() and moveToDisk(), enum support in queue pause/resume, and more. The post Mercure Broadcasting in Laravel 13.32 appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.

## Empowering Your Annotations with Fields

DevFeed: [Empowering Your Annotations with Fields](<https://devfeed.tech/articles/empowering-your-annotations-with-fields-30743.md>)

Original publisher: [Read original article](<http://blog.vanillajava.blog/2024/12/empowering-your-annotations-with-fields.html>)

Author: Peter Lawrey (noreply@blogger.com)

Published: 2024-12-21T22:13:00Z

Content type: tutorial

Language: en

Sources: [Vanilla Java](<https://devfeed.tech/sources/vanilla-java.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Java Language](<https://devfeed.tech/topics/java-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [enum](<https://devfeed.tech/tags/enum.md>), [info](<https://devfeed.tech/tags/info.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [java](<https://devfeed.tech/tags/java.md>), [java-language](<https://devfeed.tech/tags/java-language.md>), [opinion](<https://devfeed.tech/tags/opinion.md>)

### AI overview

This tutorial explains how Java annotations can contain nested classes, interfaces, enums, other annotations, static fields, and embedded logic. It discusses uses such as domain converters, framework lifecycle hooks, and syntactic sugar, while noting that excessive nesting can reduce readability.

### Source excerpt

Introduction Java's annotation system has come a long way since its introduction in Java 5. At first glance, annotations appear to be mere metadata markers on classes and methods. However, annotations can do much more than that. You can nest types within them, incorporate fields that reference helper classes, and even embed logic via static singletons. These capabilities provide a powerful mechanism for integrating domain-specific or framework-specific functionality right into your code, in ways that are both compact and self-documenting. Why Add Code to Annotations? The Java language specification usually treats annotations as static metadata describing a type, method, field, or parameter. However, you can leverage nested classes (including enums, interfaces, and even other annotations) to extend the functionality of a single annotation. This approach allows you to keep logic closely tied to the metadata, rather than scattering it across multiple classes. Common use cases include: Custom domain converters. For example, if you have a long that needs to be stored in an encoded format (e.g., Base85), you can supply a default converter directly within the annotation. Framework-specific lifecycle hooks. You can embed an interface for processing the annotation, enabling the framework to perform reflective lookups and apply behaviour at runtime. Syntactic sugar. Rather than writing @LongConversion(SomeConverter.class), you could write @ShortText, which internally references a known converter. Nesting Types in Java You can nest various kinds of types within your classes or annotations--these include interfaces, enums, classes, and even other annotations. Although nesting these types can feel unconventional, it is fully supported by the language. For example: public class A { public interface B { public enum C { ; public @interface D { public class E { // etc etc } } } } } While this example might look bizarre, it demonstrates the power and flexibility of Java's nesting rule

## The Boolean Trap

DevFeed: [The Boolean Trap](<https://devfeed.tech/articles/the-boolean-trap-39098.md>)

Original publisher: [Read original article](<https://read.engineerscodex.com/p/the-boolean-trap>)

Author: Engineer's Codex

Published: 2024-09-05T02:06:52Z

Content type: opinion

Language: en

Sources: [Engineer's Codex](<https://devfeed.tech/sources/engineer-s-codex.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [enums](<https://devfeed.tech/topics/enums.md>), [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>), [coding](<https://devfeed.tech/topics/coding.md>)

Tags: [apis](<https://devfeed.tech/tags/apis.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [function](<https://devfeed.tech/tags/function.md>)

### AI overview

This article explains the boolean trap: boolean parameters in functions and APIs can make code unclear and difficult to extend. It recommends using enums instead, even for binary choices, because enums improve readability, typing, maintainability, and extensibility.

### Source excerpt

Use enums instead

## AWS API Gateway's Request Validation: Navigating the Quirks

DevFeed: [AWS API Gateway's Request Validation: Navigating the Quirks](<https://devfeed.tech/articles/aws-api-gateway-s-request-validation-navigating-the-quirks-23894.md>)

Original publisher: [Read original article](<https://medium.com/smg-real-estate/aws-api-gateways-request-validation-navigating-the-quirks-38285cb0a1c1?source=rss----2186e5b9bd8f---4>)

Author: Thomas Klein

Published: 2024-08-09T12:07:11Z

Content type: tutorial

Language: en

Sources: [Homegate Engineering Blog - Medium](<https://devfeed.tech/sources/homegate-engineering-blog-medium.md>)

Topics: [Amazon API Gateway](<https://devfeed.tech/topics/amazon-api-gateway.md>), [Amazon Web Services](<https://devfeed.tech/topics/aws.md>), [API](<https://devfeed.tech/topics/api.md>), [gateway](<https://devfeed.tech/topics/gateway.md>), [JSON Schema](<https://devfeed.tech/topics/json-schema.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [enum](<https://devfeed.tech/topics/enum.md>), [HTTP](<https://devfeed.tech/topics/http.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [api-gateway](<https://devfeed.tech/tags/api-gateway.md>), [aws](<https://devfeed.tech/tags/aws.md>), [aws-api-gateway](<https://devfeed.tech/tags/aws-api-gateway.md>), [aws-lambda](<https://devfeed.tech/tags/aws-lambda.md>), [enum](<https://devfeed.tech/tags/enum.md>), [gateway](<https://devfeed.tech/tags/gateway.md>), [handler](<https://devfeed.tech/tags/handler.md>), [http](<https://devfeed.tech/tags/http.md>), [json](<https://devfeed.tech/tags/json.md>), [json-schema](<https://devfeed.tech/tags/json-schema.md>), [middleware](<https://devfeed.tech/tags/middleware.md>), [middy](<https://devfeed.tech/tags/middy.md>), [tests](<https://devfeed.tech/tags/tests.md>), [type-safety](<https://devfeed.tech/tags/type-safety.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [validation](<https://devfeed.tech/tags/validation.md>), [zod](<https://devfeed.tech/tags/zod.md>)

### AI overview

This tutorial examines AWS API Gateway request validation. It explains that query-parameter presence is checked, but enum values may not be enforced, while POST and PUT payloads are validated with JSON Schema Draft 4. It also discusses generic error messages and TypeScript-based validation approaches.

### Source excerpt

AWS API Gateway's request validation follows a specific set of rules that developers should be aware of when setting up their APIs. While it offers some validation features, it's important to understand its scope and limitations. Let's examine how it works with a common API configuration: parameters: - name: offerType in: query required: true description: RENT or BUY schema: type: string enum: - RENT - BUY With this configuration, API Gateway diligently checks for the presence of the query parameter, returning an HTTP 400 error if it's missing. However, it falls short when it comes to validating the actual value. Surprisingly, it would accept "KERMIT" without batting an eye, despite the clear enum specification. This behavior, while documented, can be a source of frustration for developers expecting more comprehensive validation. Interestingly, API Gateway shows more validation prowess with POST and PUT requests. It validates request payloads using JSON Schema Draft 4, demonstrating a somewhat inconsistent approach to input validation across different HTTP methods. Even when it does catch an error, API Gateway's feedback is less than illuminating. Instead of specific error details, you're met with a generic {"message": "Invalid request body"}. For more information, you'll need to dig into the associated log streams, which isn't ideal for surfacing error details in API responses. Example output in AWS console from a failed request validation when a body request validator is setup. API Gateway's validation is handy, but it leaves a lot to be desired. Developers often need to add extra checks for a truly robust API. While API Gateway supports various integrations and Lambda languages, let's focus on TypeScript. TypeScript's strong typing and runtime checks can catch issues early, sparing your users from cryptic error messages. Let's explore how to use this to make your API smarter and your users happier. Option 1: DIY Validation (AKA The "I've Got Trust Issues" Approac

## Lint Revisit: Providing Alternatives 🧙♀

DevFeed: [Lint Revisit: Providing Alternatives 🧙♀](<https://devfeed.tech/articles/lint-revisit-providing-alternatives-26175.md>)

Original publisher: [Read original article](<https://zarah.dev/2024/07/24/lintfix-alternatives.html>)

Author: Zarah Dominguez

Published: 2024-07-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [Zarah Dominguez](<https://devfeed.tech/sources/zarah-dominguez.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [Testing](<https://devfeed.tech/topics/testing.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [enum](<https://devfeed.tech/tags/enum.md>), [github](<https://devfeed.tech/tags/github.md>), [jira](<https://devfeed.tech/tags/jira.md>), [lint](<https://devfeed.tech/tags/lint.md>), [regex](<https://devfeed.tech/tags/regex.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This tutorial shows how to extend a TODO Detector lint rule with project-specific ticket prefixes, regular-expression validation, autofix alternatives, and tests for those alternatives. It also discusses difficulty placing the caret precisely in the generated fix.

### Source excerpt

In my previous post, we updated our TODO Detector to be more flexible. It is also easily extensible so that if we want to include more parameters or perhaps add more checks, we can follow the existing pattern and modify it.

## Unconfined Enums Adapter for Moshi

DevFeed: [Unconfined Enums Adapter for Moshi](<https://devfeed.tech/articles/unconfined-enums-adapter-for-moshi-25914.md>)

Original publisher: [Read original article](<https://medium.com/@xxfast/unconfined-enums-adapter-for-moshi-5d84542c8bf0?source=rss-43bae76e8f81------2>)

Author: Isuru Rajapakse

Published: 2022-05-11T12:08:49Z

Content type: tutorial

Language: en

Sources: [Stories by Isuru Rajapakse on Medium](<https://devfeed.tech/sources/stories-by-isuru-rajapakse-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [LineageOS](<https://devfeed.tech/topics/lineageos.md>), [API](<https://devfeed.tech/topics/api.md>), [enum](<https://devfeed.tech/topics/enum.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [moshi](<https://devfeed.tech/tags/moshi.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

This tutorial presents a Kotlin pattern for handling previously unknown enum-like values from REST APIs with Moshi. It explains Moshi enum adapters, the unknown-value fallback, and an interface-based approach that preserves the server's raw value instead of mapping it only to a generic unknown value.

### Source excerpt

If you wonder what an Unconfined Enum is, wonder no more because it is a thing I just made up. Enums by definition are confined, or finite. Therefore "unconfined enum" is really an oxymoron. Nevertheless, say you have this Fruit enum and want to map each value to an Android string resource. Kotlin's enum properties make this convenient enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange) } When we want to consume this enum from a Restful API with a Moshi converter, Moshi automatically generates the enum adapter for you, but if you want to customise the behaviour for whatever reason, you can do object FruitsAdapter { @ToJson fun toJson(type: Fruit): String = type.name @FromJson fun fromJson(name: String): Fruit = Fruit.values().first { it.name == name } } Happy days. Everything is working as expected. When things go bananascom.squareup.moshi.JsonDataException: Expected one of [Apple, Oranges] but was Bananas at path $ Good APIs don't break contracts. Not all APIs are good APIs, so some can break contracts. What do we do now? push out an update with added enum value and its string resource? Perhaps we can make use of EnumJsonAdapter's .withUnknownFallBack() enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange), Unknown(R.string.fruit_unknown) } Moshi.Builder() .add(KotlinJsonAdapterFactory()) .add(Fruit::class.java, EnumJsonAdapter.create(Fruit::class.java) .withUnknownFallback(Fruit.Unknown)) .build() This certainly stops the app from crashing, but what if we actually want to show the "bananas" that the API sends? you know, as a fail safe so that users wouldn't end up seeing "unknowns". Let's open up the Enums Enums are by definition finite. Enums are final by design. Enums can't be subclassed but they still can inherit interfaces. We will exploit this to create our "unconfined" enum interface Fruit { val name: String data class Unknown(override val name:

## How to implement Swift-friendly API with Kotlin Multiplatform Mobile

DevFeed: [How to implement Swift-friendly API with Kotlin Multiplatform Mobile](<https://devfeed.tech/articles/how-to-implement-swift-friendly-api-with-kotlin-multiplatform-mobile-23904.md>)

Original publisher: [Read original article](<https://medium.com/icerock/how-to-implement-swift-friendly-api-with-kotlin-multiplatform-mobile-e68521a63b6d?source=rss----b74ae24564e---4>)

Author: Aleksey Mikhailov

Published: 2021-08-07T16:49:33Z

Content type: tutorial

Language: en

Sources: [IceRock Development - Medium](<https://devfeed.tech/sources/icerock-development-medium.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Code](<https://devfeed.tech/topics/code.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-multiplatform-mobile](<https://devfeed.tech/tags/kotlin-multiplatform-mobile.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [sealed-interface](<https://devfeed.tech/tags/sealed-interface.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This tutorial explains how Kotlin Multiplatform Mobile exposes Kotlin APIs to Swift through generated Objective-C APIs. It demonstrates usability issues with sealed interfaces at the Kotlin-Swift boundary and introduces IceRock's MOKO KSwift Gradle plugin, which analyzes Kotlin/Native library metadata to generate a more convenient Swift API.

### Source excerpt

Kotlin Multiplatform Mobile allows you to compile Kotlin code into native libraries for Android and iOS. If in the case of Android the library obtained from Kotlin will be integrated with an application written in Kotlin, then for iOS the integration will be with Swift. There is a loss of usability at the junction of Kotlin and Swift, due to the difference in languages. This is mainly because the Kotlin/Native compiler (which compiles Kotlin in the iOS framework and is part of the Kotlin Multiplatform) generates the public API of the framework in ObjectiveC. We access Kotlin from Swift through this generated ObjectiveC API, since Swift interacts with ObjectiveC. Further, I will show examples of API waste at the Kotlin-Swift junction and a tool that allows you to get a more convenient API for usage from Swift. Let's look at the example of using a sealed interface in Kotlin: sealed interface UIState<out T> { object Loading : UIState<Nothing> object Empty : UIState<Nothing> data class Data<T>(val value: T) : UIState<T> data class Error(val throwable: Throwable) : UIState<Nothing> } This is a convenient construct to describe states, which is actively used in the Kotlin code. Let's see how it looks from the Swift side. public protocol UIState { }public class UIStateLoading : KotlinBase, UIState { }public class UIStateEmpty : KotlinBase, UIState { }public class UIStateData<T> : KotlinBase, UIState where T : AnyObject { open var value: T? { get } }public class UIStateError : KotlinBase, UIState { open var throwable: KotlinThrowable { get } } From the Swift side Kotlin's sealed interface looks like a set of classes with a common protocol. Of course, in this case, one cannot hope to check the completeness of the switch implementation, since it is not an enum. For developers familiar with Swift, the enum is considered a more correct analog of the sealed interface, for example: enum UIState<T> { case loading case empty case data(T) case error(Error) } We can write such an enum

## Idiomatic Alternatives to Enums in TypeScript

DevFeed: [Idiomatic Alternatives to Enums in TypeScript](<https://devfeed.tech/articles/idiomatic-alternatives-to-enums-in-typescript-19120.md>)

Original publisher: [Read original article](<https://medium.com/rbi-tech/idiomatic-alternatives-to-enums-in-typescript-fa8e6518d113?source=rss----904782439303---4>)

Author: Andy Weiss

Published: 2021-01-31T19:19:11Z

Content type: tutorial

Language: en

Sources: [RBI Tech](<https://devfeed.tech/sources/rbi-tech.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [enum](<https://devfeed.tech/topics/enum.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [compilation](<https://devfeed.tech/tags/compilation.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [programming](<https://devfeed.tech/tags/programming.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

This article examines TypeScript enums in relation to TypeScript's design goals and JavaScript output. It explains that enums are not merely type-level extensions, are compiled into JavaScript code, and may produce output the author considers less clean or idiomatic than expected.

### Source excerpt

If you're making a list, type check it once? TypeScript is often referred to as a syntactical superset of JavaScript. In practice, this means its compiler can understand standard JS, as well as the type declarations and annotations that enable its error-detecting superpowers. For the most part, the additional syntax provided by TypeScript is stripped away during trans-compilation to JS. Indeed, its ability to gracefully disappear and produce JavaScript output that closely resembles the original code as authored is a major part of its appeal and is enshrined in the project's design goals (emphasis mine): Statically identify constructs that are likely to be errors. Provide a structuring mechanism for larger pieces of code. Impose no runtime overhead on emitted programs. Emit clean, idiomatic, recognizable JavaScript code. Produce a language that is composable and easy to reason about. Align with current and future ECMAScript proposals. Preserve runtime behavior of all JavaScript code. Avoid adding expression-level syntax. Use a consistent, fully erasable, structural type system. Be a cross-platform development tool. Do not cause substantial breaking changes from TypeScript 1.0. What, then, to make of TypeScript enums? 🤔 The idea of an enumerated type -- that a programmer can constrain the values a piece of data can hold to a pre-defined list, and be alerted when their actions diverge from their intentions -- has a rich tradition in programming going all the way back to C. Enums are native to TypeScript, but don't exist in JavaScript. But while enums are supported in TypeScript, there is no corresponding implementation in JavaScript. Worse yet, rather than disappear from the emitted JS output, they are trans-compiled into code that would be hard to refer to as clean or idiomatic. https://bit.ly/362UoxF While the function declaration and invocation above are nearly identical in TS and JS, the enum declaration trans-compiles to an IIFE with nested assignments to an object

## Exhaustiveness Checking with Mypy

DevFeed: [Exhaustiveness Checking with Mypy](<https://devfeed.tech/articles/exhaustiveness-checking-with-mypy-33932.md>)

Original publisher: [Read original article](<https://hakibenita.com/python-mypy-exhaustive-checking>)

Author: Haki Benita

Published: 2020-12-07T22:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [enum](<https://devfeed.tech/topics/enum.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [articles](<https://devfeed.tech/tags/articles.md>), [ci](<https://devfeed.tech/tags/ci.md>), [django](<https://devfeed.tech/tags/django.md>), [enum](<https://devfeed.tech/tags/enum.md>), [exception](<https://devfeed.tech/tags/exception.md>), [python](<https://devfeed.tech/tags/python.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [vscode](<https://devfeed.tech/tags/vscode.md>)

### AI overview

This tutorial explains how to use mypy, an optional static type checker for Python, to detect unhandled values in enumerations before runtime. It presents a helper function that enables exhaustiveness checking, shows the resulting warning, and describes integrating mypy into CI.

### Source excerpt

What if mypy could warn you about possible problems at "compile time"? In this article I share a little trick to get mypy to fail when a value in an enumeration type is left unhandled.

## Kotlin Enum Recipes

DevFeed: [Kotlin Enum Recipes](<https://devfeed.tech/articles/kotlin-enum-recipes-29360.md>)

Original publisher: [Read original article](<https://arturdryomov.dev/posts/kotlin-enum-recipes/>)

Author: Artur Dryomov

Published: 2019-10-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [Artur Dryomov](<https://devfeed.tech/sources/artur-dryomov.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [article](<https://devfeed.tech/tags/article.md>), [enum](<https://devfeed.tech/tags/enum.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>)

### AI overview

A tutorial on practical Kotlin enum patterns, covering declaration naming, comma placement, namespacing, API modeling, Gson and Moshi deserialization, Android resources, templates, and specification-oriented tests.

### Source excerpt

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. Declaration Naming Use CamelCase, don't be ashamed. I doubt that anyone names sealed class using the UPPERCASE notation.

## Feature flags - A successful architecture

DevFeed: [Feature flags - A successful architecture](<https://devfeed.tech/articles/feature-flags-a-successful-architecture-28687.md>)

Original publisher: [Read original article](<https://jeroenmols.com/blog/2019/09/12/featureflagsarchitecture/>)

Author: info@jeroenmols.com (Jeroen Mols)

Published: 2019-09-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jeroen Mols](<https://devfeed.tech/sources/jeroen-mols.md>)

Topics: [feature flags](<https://devfeed.tech/topics/feature-flags.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Firebase](<https://devfeed.tech/topics/firebase.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [blogs](<https://devfeed.tech/tags/blogs.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [feature-flags](<https://devfeed.tech/tags/feature-flags.md>), [firebase](<https://devfeed.tech/tags/firebase.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>)

### AI overview

A tutorial on implementing a feature-flag architecture. It explains how to define flags, configure them locally and remotely, use them in testing, and resolve values through prioritized providers with explicit defaults.

### Source excerpt

Now that we know how feature flags can help us release faster, it's time to dive into the actual implementation details. How can we easily define feature flags?

## Exhaustive Collections Of Structs

DevFeed: [Exhaustive Collections Of Structs](<https://devfeed.tech/articles/exhaustive-collections-of-structs-25809.md>)

Original publisher: [Read original article](<https://www.steveonstuff.com/2019/03/14/exhaustive-collections-of-sructs>)

Author: Steve Barnegren

Published: 2019-03-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Steve Barnegren](<https://devfeed.tech/sources/steve-barnegren.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [dataset](<https://devfeed.tech/topics/dataset.md>), [data](<https://devfeed.tech/topics/data.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [collections](<https://devfeed.tech/tags/collections.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [data](<https://devfeed.tech/tags/data.md>), [dataset](<https://devfeed.tech/tags/dataset.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>)

### AI overview

The article examines modeling a heterogeneous dataset, such as a social networking feed, with enums and associated values. It explains that this approach can become difficult to scale and organize, then introduces collections of structs as a more flexible alternative.

### Source excerpt

It's not uncommon that we need to model a dataset composed of a finite number of discrete data types, where each data type has it's own unique data model. This is often the case for table view data sources - they're often comprised of a few different cell types, with each cell type having a different set of properties that it needs to be configured with.

## Artisanal Objective-C Sum Types

DevFeed: [Artisanal Objective-C Sum Types](<https://devfeed.tech/articles/artisanal-objective-c-sum-types-20448.md>)

Original publisher: [Read original article](<https://medium.com/twitch-news/artisanal-objective-c-sum-types-8ea1ab9da342?source=rss----3ae745429979--engineering>)

Author: Heath Borders

Published: 2018-05-14T18:49:35Z

Content type: tutorial

Language: en

Sources: [Twitch](<https://devfeed.tech/sources/twitch.md>)

Topics: [Objective-C](<https://devfeed.tech/topics/objective-c.md>), [enum](<https://devfeed.tech/topics/enum.md>), [C](<https://devfeed.tech/topics/c.md>), [Swift](<https://devfeed.tech/topics/swift.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [enum](<https://devfeed.tech/tags/enum.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [ios](<https://devfeed.tech/tags/ios.md>), [objective-c](<https://devfeed.tech/tags/objective-c.md>), [swift](<https://devfeed.tech/tags/swift.md>), [twitch](<https://devfeed.tech/tags/twitch.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

The article explains how to represent sum types in Objective-C. It contrasts Swift enums and C unions with enums, then presents a class-based, callback-driven approach for modeling distinct Objective-C object types under ARC.

### Source excerpt

A sum type combines many possible differently-typed values into a single value, expressed in Swift as an enum. https://medium.com/media/6217cfe231386e04ce2e7228080fae7a/href In C, we can achieve the power of Swift's enum with a combination of a C union and a C enum: https://medium.com/media/3f1696d38fcec2600a942ffbe03c8cd4/href First, I'm sure you notice Swift's enum is more concise, but it's also safer. In C, the compiler doesn't prevent us from either creating an example with a mismatched type or from consuming a union as a mismatched type: https://medium.com/media/82f0586deab20a07abc615a9e459028e/href Trying to mismatch our enum types in Swift won't compile. Yay! https://medium.com/media/03d37cc33364b48d851beb4ccf38a97d/href Unfortunately, in Objective-C, we can't use Objective-C objects in structs or unions in ARC, so we can't use our C sum type with Objective-C objects. However, we can build a similar construct by hand. First, we need a class to capture all of the distinct types, and expose them through a single block-based callback interface: https://medium.com/media/78216b190ad6501c26ad89d0864b1c5c/href We must declare forward references for our distinct types, which we'll define later. We mark new and init as NS_UNAVAILABLE so that consumers won't be able to instantiate our base class directly. If they use -Wobjc-designated-initializers, they won't be able to subclass our base class either (without importing ExamplePrivate.h, which we won't distribute to them). Next, we'll declare our distinct types: https://medium.com/media/329743de725ccd196c3f535306714cf9/hrefhttps://medium.com/media/1785598f614b3963a0a39ec81d8c5dac/href They're simply plain-old-objective-c-objects that extend our base class. Our base class and our distinct types all have switchFoo:bar:. The distinct types will simply call the respective callback block with self. The base class will have an empty implementation. We use NS_REQUIRES_SUPER on switchFoo:bar: because if we add another distinct

## PostgreSQL Data Types: ENUM

DevFeed: [PostgreSQL Data Types: ENUM](<https://devfeed.tech/articles/postgresql-data-types-enum-34596.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2018/05/postgresql-data-types-enum/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2018-05-02T09:00:26Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [data type](<https://devfeed.tech/topics/data-type.md>), [enum](<https://devfeed.tech/topics/enum.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>)

Tags: [alter](<https://devfeed.tech/tags/alter.md>), [data-type](<https://devfeed.tech/tags/data-type.md>), [database](<https://devfeed.tech/tags/database.md>), [enum](<https://devfeed.tech/tags/enum.md>), [join](<https://devfeed.tech/tags/join.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [table](<https://devfeed.tech/tags/table.md>)

### AI overview

This tutorial compares PostgreSQL ENUM types with reference tables and foreign keys. It explains how PostgreSQL registers ENUM types, how values are stored, and why changing accepted values is a DDL operation with transaction restrictions. The article recommends ENUMs for very static value sets and reference tables when values or ordering may change.

### Source excerpt

Continuing our series of PostgreSQL Data Types today we're going to introduce the PostgreSQL ENUM type. This data type has been added to PostgreSQL in order to make it easier to support migrations from MySQL. Proper relational design would use a reference table and a foreign key instead.

## Kotlin sealed classes and their differences from enums

DevFeed: [Kotlin sealed classes and their differences from enums](<https://devfeed.tech/articles/sealed-classes-in-kotlin-enums-with-super-powers-kad-28-27225.md>)

Original publisher: [Read original article](<https://antonioleiva.com/sealed-classes-kotlin>)

Published: 2017-06-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Antonio Leiva](<https://devfeed.tech/sources/antonio-leiva.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [sealed-classes](<https://devfeed.tech/tags/sealed-classes.md>)

### AI overview

A Kotlin tutorial explaining sealed classes as constrained class hierarchies. It compares them with enums, shows how subclasses can hold state, and explains compiler checking of branches when handling all possible types.

### Source excerpt

Everything Android, Kotlin and other random topics

## Creating easy, readable attributes with ActiveRecord enums

DevFeed: [Creating easy, readable attributes with ActiveRecord enums](<https://devfeed.tech/articles/creating-easy-readable-attributes-with-activerecord-enums-26267.md>)

Original publisher: [Read original article](<https://www.justinweiss.com/articles/creating-easy-readable-attributes-with-activerecord-enums/>)

Author: Justin Weiss

Published: 2015-06-30T07:39:15Z

Content type: tutorial

Language: en

Sources: [Justin Weiss](<https://devfeed.tech/sources/justin-weiss.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [activerecord](<https://devfeed.tech/tags/activerecord.md>), [code](<https://devfeed.tech/tags/code.md>), [database](<https://devfeed.tech/tags/database.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>)

### AI overview

A tutorial on Rails ActiveRecord enums for attributes with a small, mostly fixed set of values. It explains how enums map readable values to database integers, provide query and predicate methods, and introduce maintenance concerns such as ordering and sharing mappings outside Rails.

### Source excerpt

Imagine a question that can be either "pending", "approved", or "flagged". Or a phone number that's a "home", "office", "mobile", or "fax" (if it's 1982). Some models call for this kind of data. An attribute that can have only one of a few different values. And that set of values almost never changes. It's a situation where, if it were plain Ruby, you'd just use a symbol. You could create a PhoneNumberType or QuestionStatus model and a belongs_to relationship to hold these values, but that doesn't seem worth it. You could stuff them in a yaml file, but now you have to look in a totally different place to figure out what your object can do. In 4.1, Rails took a stab at solving this problem with ActiveRecord enums. A few values, in the model ActiveRecord enums are pretty easy. You give your model an integer column: bin/rails g model phone number:string phone_number_type:integer List the values that attribute can take: app/models/phone.rbclass Phone < ActiveRecord::Base enum phone_number_type: [:home, :office, :mobile, :fax] end And now you can deal with strings instead of numbers. Instead of this: irb(main):001:0> Phone.first.phone_number_type => 3 You'll see this: irb(main):002:0> Phone.first.phone_number_type => "fax" You can change that attribute using either strings or ints: irb(main):003:0> phone.phone_number_type = 1; phone.phone_number_type => "office" irb(main):004:0> phone.phone_number_type = "mobile"; phone.phone_number_type => "mobile" Or even using a bang method: irb(main):005:0> phone.office! => true irb(main):006:0> phone.phone_number_type => "office" You get methods for asking if your attribute has some specific value: irb(main):007:0> phone.office? => true And you can find all objects with the value you're looking for: irb(main):008:0> Phone.office Phone Load (0.3ms) SELECT "phones".* FROM "phones" WHERE "phones"."phone_number_type" = ? [["phone_number_type", 1]] If you want to see all the different values you can use, along with the numbers they're as