# enum

Published articles for enum.

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

## the algebra of dependent types

DevFeed: [the algebra of dependent types](<https://devfeed.tech/articles/the-algebra-of-dependent-types-36214.md>)

Original publisher: [Read original article](<https://dotat.at/@/2025-05-28-types.html>)

Published: 2025-05-29T00:07:51Z

Content type: article

Language: en

Sources: [Tony Finch's blog](<https://devfeed.tech/sources/tony-finch-s-blog.md>)

Topics: [Programming](<https://devfeed.tech/topics/programming.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Standard ML](<https://devfeed.tech/topics/standard-ml.md>), [Rust](<https://devfeed.tech/topics/rust.md>)

Tags: [algebra](<https://devfeed.tech/tags/algebra.md>), [enum](<https://devfeed.tech/tags/enum.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [languages](<https://devfeed.tech/tags/languages.md>), [programming-languages](<https://devfeed.tech/tags/programming-languages.md>), [type-system](<https://devfeed.tech/tags/type-system.md>), [type-theory](<https://devfeed.tech/tags/type-theory.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

An explanation of why big-sigma and big-pi notation appears in dependent type theory. It connects dependent functions and dependent pairs to algebraic data types, showing how products correspond to multiplication and sum types to addition, with examples from type theory, Standard ML, Haskell, and Rust.

### Source excerpt

TIL (or this week-ish I learned) why big-sigma and big-pi turn up in the notation of dependent type theory. I've long been aware of the zoo of more obscure Greek letters that turn up in papers about type system features of functional programming languages, μ, Λ, Π, Σ. Their meaning is usually clear from context but the reason for the choice of notation is usually not explained. I recently stumbled on an explanation for Π (dependent functions) and Σ (dependent pairs) which turn out to be nicer than I expected, and closely related to every-day algebraic data types. sizes of types The easiest way to understand algebraic data types is by counting the inhabitants of a type. For example: the unit type () has one inhabitant, (), and the number 1 is why it's called the unit type; the bool type hass two inhabitants, false and true. I have even seen these types called 1 and 2 (cruelly, without explanation) in occasional papers. product types Or pairs or (more generally) tuples or records. Usually written, (A, B) The pair contains an A and a B, so the number of possible values is the number of possible A values multiplied by the number of possible B values. So it is spelled in type theory (and in Standard ML) like, A * B sum types Or disjoint union, or variant record. Declared in Haskell like, data Either a b = Left a | Right b Or in Rust like, enum Either<A, B> { Left(A), Right(B), } A value of the type is either an A or a B, so the number of possible values is the number of A values plus the number of B values. So it is spelled in type theory like, A + B dependent pairs In a dependent pair, the type of the second element depends on the value of the first. The classic example is a slice, roughly, struct IntSlice { len: usize, elem: &[i64; len], } (This might look a bit circular, but the idea is that an array [i64; N] must be told how big it is - its size is an explicit part of its type - but an IntSlice knows its own size. The traditional dependent "vector" type is a sized li

## Understanding task types in the Gemini Embedding API

DevFeed: [Understanding task types in the Gemini Embedding API](<https://devfeed.tech/articles/understanding-task-types-in-the-gemini-embedding-api-31145.md>)

Original publisher: [Read original article](<https://technicalwriting.dev/2025/05/tasks/index.html>)

Published: 2025-05-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [technicalwriting.dev](<https://devfeed.tech/sources/technicalwriting-dev.md>)

Topics: [API](<https://devfeed.tech/topics/api.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [Retrieval Augmented Generation (RAG)](<https://devfeed.tech/topics/retrieval-augmented-generation-rag.md>), [genai](<https://devfeed.tech/topics/genai.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [enum](<https://devfeed.tech/tags/enum.md>), [fact-verification](<https://devfeed.tech/tags/fact-verification.md>), [rag](<https://devfeed.tech/tags/rag.md>)

### AI overview

This article examines the taskType parameter supported by the Gemini Embedding API's models.embedContent method. It reviews the documented task types, their use in retrieval-augmented generation, and how task-specific embeddings are described in the Gemini Embedding paper and Python client source.

### Source excerpt

Should I care about the taskType parameter of the models.embedContent method?

## 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.

## Blog: Falco Weekly 4 - 2024

DevFeed: [Blog: Falco Weekly 4 - 2024](<https://devfeed.tech/articles/blog-falco-weekly-4-2024-32508.md>)

Original publisher: [Read original article](<https://falco.org/blog/falco-w-4-2024-weekly-recap/>)

Published: 2024-01-26T00:00:00Z

Content type: article

Language: en

Sources: [Falco - Falco](<https://devfeed.tech/sources/falco-falco.md>), [Falco - The Falco blog](<https://devfeed.tech/sources/falco-the-falco-blog.md>)

Topics: [Falco](<https://devfeed.tech/topics/falco.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [eBPF](<https://devfeed.tech/topics/ebpf.md>), [CMake](<https://devfeed.tech/topics/cmake.md>), [Gke](<https://devfeed.tech/topics/gke.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [cmake](<https://devfeed.tech/tags/cmake.md>), [deadlock](<https://devfeed.tech/tags/deadlock.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [ebpf](<https://devfeed.tech/tags/ebpf.md>), [enum](<https://devfeed.tech/tags/enum.md>), [falco](<https://devfeed.tech/tags/falco.md>), [gke](<https://devfeed.tech/tags/gke.md>), [process](<https://devfeed.tech/tags/process.md>), [release](<https://devfeed.tech/tags/release.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This weekly Falco recap covers changes across the falcosecurity repositories, including the Falco 0.37.0-rc2 release, a performance-driven reversion to the older sorcery implementation, library fixes, driver and logger improvements, and updates to falcoctl and rules. It also notes experimental plugin and engine features and invites community feedback.

### Source excerpt

What happened in Falco this week? Let's go through the major changes that happened in various repositories under the falcosecurity organization. Libs Libs will need a 0.14.2 tag for the Falco 0.37.0 release, with the revert of https://github.com/falcosecurity/libs/pull/1533 PR. During our release process, we found out that the new std::filesystem based implementaton was up to 8x time slower than the old ones; that's because it supports much more cases and does many more checks. Therefore, in https://github.com/falcosecurity/libs/pull/1645, we revert to the old sorcery implementation, plus some minor improvements and added tests. Moreover, many more changes landed in libs, that won't be part of the upcoming Falco 0.37.0 release: Modernized C++ struct/enum/union declarations: https://github.com/falcosecurity/libs/pull/1588 Added support for newfstatat syscall: https://github.com/falcosecurity/libs/pull/1628 Fixed a potential deadlock for kmod: https://github.com/falcosecurity/libs/pull/1629 Big effort by our hero, Jason, to cleanup some stale macros: https://github.com/falcosecurity/libs/pull/1633,https://github.com/falcosecurity/libs/pull/1634,https://github.com/falcosecurity/libs/pull/1635,https://github.com/falcosecurity/libs/pull/1637,https://github.com/falcosecurity/libs/pull/1638 A small fix for old ebpf driver to support some GKE envs: https://github.com/falcosecurity/libs/pull/1642 Solved a data race and segfault in logger: https://github.com/falcosecurity/libs/pull/1643 Allow to selectively disable bpf and kmod engines from cmake: https://github.com/falcosecurity/libs/pull/1644 Falco Falco tag 0.37.0-rc2 is out! Try it! Moreover: syscall_event_drops was soft-deprecated to get ready for Falco 0.38.0 upcoming cleanups: https://github.com/falcosecurity/falco/pull/3015 Avoid storing escaped strings in engine: https://github.com/falcosecurity/falco/pull/3028 Bumped falcoctl to v0.7.1 and rules to 3.0.0: https://github.com/falcosecurity/falco/pull/3030,https://gith

## Sealed Types

DevFeed: [Sealed Types](<https://devfeed.tech/articles/sealed-types-25064.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-sealed-types/>)

Author: author@typealias.com (Dave Leeds)

Published: 2024-01-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

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

Tags: [classes](<https://devfeed.tech/tags/classes.md>), [enum](<https://devfeed.tech/tags/enum.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [exhaustive-matching](<https://devfeed.tech/tags/exhaustive-matching.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [sealed](<https://devfeed.tech/tags/sealed.md>), [sealed-class](<https://devfeed.tech/tags/sealed-class.md>), [sealed-interface](<https://devfeed.tech/tags/sealed-interface.md>), [subtype](<https://devfeed.tech/tags/subtype.md>), [types](<https://devfeed.tech/tags/types.md>), [when-conditional](<https://devfeed.tech/tags/when-conditional.md>), [when-expression](<https://devfeed.tech/tags/when-expression.md>)

### AI overview

A tutorial chapter explains how Kotlin sealed interfaces and classes restrict the set of possible types, helping ensure that all possibilities are handled in a when expression.

### Source excerpt

In Chapter 5, we saw how limiting our options can be a good thing. In that chapter, we used enum classes to limit our values, which allows Kotlin to ensure that we account for all possibilities in a when expression. We can get a similar benefit for our types by using sealed interfaces and classes. In this chapter, we'll visit Cecil's Ice Shop to learn all about sealed types. Let's get started!

## Interfaces 101 : Go's Logging Interface Ep. 4

DevFeed: [Interfaces 101 : Go's Logging Interface Ep. 4](<https://devfeed.tech/articles/interfaces-101-go-s-logging-interface-ep-4-22214.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/02/interfaces-101-go-logging-interface.html>)

Published: 2023-02-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Logging](<https://devfeed.tech/topics/logging.md>)

Tags: [enum](<https://devfeed.tech/tags/enum.md>), [enumerators](<https://devfeed.tech/tags/enumerators.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [function](<https://devfeed.tech/tags/function.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [log-interface](<https://devfeed.tech/tags/log-interface.md>), [pretty-printing](<https://devfeed.tech/tags/pretty-printing.md>), [server-logs](<https://devfeed.tech/tags/server-logs.md>)

### AI overview

This video tutorial explains Go interfaces through error-interface nil behavior and custom string formatting. It covers defining an enumerated type, implementing the required interface method, and controlling how values are represented and printed.

### Source excerpt

Introduction In episode 3, Miki implemented a type that satisfied Go's error interface. The odd thing about his type was it would be considered not-nil although no value was set for it. To get a better understanding of the situation, Miki gives a brief explanation of how Go determines if an error value is nil, and in this case, Miki specified the type of the variable returned to be a pointer of his custom error type which blindsided Go's mechanism to determine a nil value. Miki chose this example because it demonstrated the importance of declaring an error with its type set as the error interface.

## Enum classes in Kotlin

DevFeed: [Enum classes in Kotlin](<https://devfeed.tech/articles/enum-classes-in-kotlin-39330.md>)

Original publisher: [Read original article](<https://kt.academy/article/kfde-enum>)

Published: 2023-02-01T00:01:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

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

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [enums](<https://devfeed.tech/tags/enums.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [property](<https://devfeed.tech/tags/property.md>), [superclass](<https://devfeed.tech/tags/superclass.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin tutorial explains how to define and use enum classes to represent finite sets of values. It covers enum values and their order, companion object utilities, exhaustive when conditions, stored state, and custom methods.

### Source excerpt

What are enum classes in Kotlin and how do we use them.

## Understanding the GraphQL Type System

DevFeed: [Understanding the GraphQL Type System](<https://devfeed.tech/articles/understanding-the-graphql-type-system-37592.md>)

Original publisher: [Read original article](<https://www.taniarascia.com/graphql-type-system/>)

Author: hello@taniarascia.com

Published: 2023-01-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tania Rascia](<https://devfeed.tech/sources/tania-rascia.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [API](<https://devfeed.tech/topics/api.md>), [Front end](<https://devfeed.tech/topics/frontend.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [type-system](<https://devfeed.tech/tags/type-system.md>), [union-types](<https://devfeed.tech/tags/union-types.md>)

### AI overview

This tutorial explains the GraphQL type system and how its types are used to build a GraphQL schema. It covers scalar types, Enums, List and Non-Null wrapping types, Object types, Interfaces, and Unions, with examples.

### Source excerpt

GraphQL is a modern solution for facilitating the communication between a front end and a data source. All of the details and capabilities...

## 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:

## Gson failure in end-to-end tests

DevFeed: [Gson failure in end-to-end tests](<https://devfeed.tech/articles/gson-failure-in-end-to-end-tests-27330.md>)

Original publisher: [Read original article](<https://blog.pchudzik.com/202201/gson-fail/>)

Published: 2022-01-23T00:00:00Z

Content type: article

Language: en

Sources: [Paweł Chudzik](<https://devfeed.tech/sources/pawe-chudzik.md>)

Topics: [Gson](<https://devfeed.tech/topics/gson.md>), [Java](<https://devfeed.tech/topics/java.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Jackson](<https://devfeed.tech/topics/jackson.md>)

Tags: [e2e](<https://devfeed.tech/tags/e2e.md>), [enum](<https://devfeed.tech/tags/enum.md>), [gson](<https://devfeed.tech/tags/gson.md>), [jackson](<https://devfeed.tech/tags/jackson.md>), [java](<https://devfeed.tech/tags/java.md>), [json](<https://devfeed.tech/tags/json.md>), [tests](<https://devfeed.tech/tags/tests.md>), [work](<https://devfeed.tech/tags/work.md>)

### AI overview

This article explains that Gson can silently ignore JSON deserialization problems, such as an unknown enum value, allowing end-to-end tests to pass even when an API contract is broken. It contrasts this behavior with Jackson and describes migrating tests from Gson to Jackson.

### Source excerpt

Using Gson in your e2e tests might result in tests passing even when contract is broken. Gson is quite imprecise when it comes to deserializing objects from json. Is there any difference between an enum and a string? Is there any difference between s string and a number? Using Java you might answer: sure there is. Even when talking about JSON you'll answer: yeah there is a difference. But for GSON? Meh whatever. Read more

## 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

## Sealed interfaces in Kotlin

DevFeed: [Sealed interfaces in Kotlin](<https://devfeed.tech/articles/sealed-interfaces-in-kotlin-27470.md>)

Original publisher: [Read original article](<https://jorgecastilloprz.github.io/sealed-interfaces-kotlin>)

Author: Jorge Castillo

Published: 2021-03-06T10:00:00Z

Content type: tutorial

Language: en

Sources: [👨💻 Jorge Castillo](<https://devfeed.tech/sources/jorge-castillo.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Library](<https://devfeed.tech/topics/library.md>), [enum](<https://devfeed.tech/topics/enum.md>)

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

### AI overview

An overview of experimental sealed interfaces planned for Kotlin 1.5. The article explains relaxed subclass-location restrictions, allowing implementations in different files within the same module, and discusses why sealed interfaces can cover cases that sealed classes cannot, including enums implementing interfaces and types belonging to multiple sealed hierarchies.

### Source excerpt

Short overview of the sealed interfaces coming up in Kotlin 1.5.

## 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.

## Enum Classes in Kotlin

DevFeed: [Enum Classes in Kotlin](<https://devfeed.tech/articles/enum-classes-in-kotlin-25054.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-enum-classes/>)

Author: author@typealias.com (Dave Leeds)

Published: 2020-10-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

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

Tags: [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [enumeration](<https://devfeed.tech/tags/enumeration.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

A Kotlin tutorial chapter introduces enum classes as a special kind of class for representing a limited number of values.

### Source excerpt

In the last chapter, we created our very own type, called Circle, using a feature in Kotlin called a class. In this chapter, we're going to look at a special kind of class--an enum class--which is particularly useful when we want to represent a limited number of values. I hope you like Schnauzers, because this chapter is full of them! Limiting the Values Schnauzers are amazing dogs--they're smart, they're loyal to their owners, and they seem to have an opinion about everything!

## R8 Optimization: Enum Ordinals and Names

DevFeed: [R8 Optimization: Enum Ordinals and Names](<https://devfeed.tech/articles/r8-optimization-enum-ordinals-and-names-20957.md>)

Original publisher: [Read original article](<https://jakewharton.com/r8-optimization-enum-ordinals-and-names/>)

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

Content type: article

Language: en

Sources: [Jake Wharton](<https://devfeed.tech/sources/jake-wharton.md>)

Topics: [Optimization](<https://devfeed.tech/topics/optimization.md>), [R8](<https://devfeed.tech/topics/r8.md>), [Java](<https://devfeed.tech/topics/java.md>), [Android](<https://devfeed.tech/topics/android.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [display](<https://devfeed.tech/tags/display.md>), [enum](<https://devfeed.tech/tags/enum.md>), [java](<https://devfeed.tech/tags/java.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [r8](<https://devfeed.tech/tags/r8.md>), [serialization](<https://devfeed.tech/tags/serialization.md>)

### AI overview

This article explains how R8 optimizes Java enums in Android applications. It focuses on replacing compile-time-known enum ordinal lookups with integer values, enabling switch-branch elimination, and inlining enum name access when appropriate.

### Source excerpt

Note: This post is part of a series on D8 and R8, Android's new dexer and optimizer, respectively. For an intro to D8 read "Android's Java 8 support". For an intro to R8 read "R8 Optimization: Staticization". Enums are (and have always been!) a recommended way to model a fixed set of constants. Most commonly an enum only provides a set of possible constants and nothing more. But being full classes, enums can also carry helper methods and fields (both instance and static) or even implement interfaces. A common optimization for enums in tools that perform whole-program optimization is to replace simple occurrences (i.e., those which don't have fields, methods, or interfaces) with integer values. However, there are other optimizations which are applicable to all enums that are still available. Ordinal Each enum constant has an ordinal() which returns its position in the list of all constants. Since the ordinal range is always [0, N), it can be used for indexing into other zero-based data structures such as arrays or even bits. The most common usage is actually by the Java compiler itself for switch statements over enums. enum Greeting { FORMAL { @Override String greet(String name) { return "Hello, " + name; } }, INFORMAL { @Override String greet(String name) { return "Hey " + name + '!'; } }; abstract String greet(String name); static String type(Greeting greeting) { switch (greeting) { case FORMAL: return "formal"; case INFORMAL: return "informal"; default: throw new AssertionError(); } } } The compiled bytecode reveals the hidden call to ordinal(). [000a34] Greeting.type:(LGreeting;)Ljava/lang/String; 0000: invoke-virtual {v1}, LGreeting;.ordinal:()I 0003: move-result v1 ⋮ If we call this method with one of the constants, an opportunity for optimization presents itself. public static void main(String... args) { System.out.println(Greeting.type(Greeting.INFORMAL)); } As this is the only usage of type in our whole application, R8 inlines the method. [000b60] Greeter.ma

## 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.

## Modeling for Concurrency

DevFeed: [Modeling for Concurrency](<https://devfeed.tech/articles/modeling-for-concurrency-34602.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2018/07/modeling-for-concurrency/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2018-07-10T08:26:47Z

Content type: article

Language: en

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

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [SQL](<https://devfeed.tech/topics/sql.md>)

Tags: [concurrency](<https://devfeed.tech/tags/concurrency.md>), [database](<https://devfeed.tech/tags/database.md>), [enum](<https://devfeed.tech/tags/enum.md>), [locking](<https://devfeed.tech/tags/locking.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

This article explains how to model tweet likes and retweets in PostgreSQL for concurrent workloads. It replaces counters that require concurrent updates with activity records, then derives counts from those records and uses inserts for new actions.

### Source excerpt

Let's continue to dive in PostgreSQL Concurrency. Last week's article PostgreSQL Concurrency: Isolation and Locking was a primer on PostgreSQL isolation and locking properties and behaviors. Today's article takes us a step further and builds on what we did last week, in particular the database modeling for a tweet like application. After having had all the characters from Shakespeare's A Midsummer Night's Dream tweet their own lines in our database in PostgreSQL Concurrency: Data Modification Language, it's time for them to do some actions on the tweets: likes and retweet. Of course, we're going to put concurrency to the test, so we're going to have to handle very very popular tweets from the play!

## 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

[Next page](<https://devfeed.tech/tags/enum.md?cursor=WyIyMDE4LTA1LTE0VDE4OjQ5OjM1KzAwOjAwIiwgIjZiODJkY2UzLTQ2YmMtNGY5Yi04YmI2LWI1NDYyOTIzM2JlMCJd>)