# factory function

Published articles for factory function.

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

## Defining and Validating Blockchain Transactions in an In-Memory Accounting Database

DevFeed: [Defining and Validating Blockchain Transactions in an In-Memory Accounting Database](<https://devfeed.tech/articles/ultimate-go-advanced-engineering-episode-18-22207.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/01/ultimate-go-advanced-engineering-episode-18.html>)

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

Content type: tutorial

Language: en

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

Topics: [Blockchain](<https://devfeed.tech/topics/blockchain.md>), [Transactions](<https://devfeed.tech/topics/transactions.md>), [data](<https://devfeed.tech/topics/data.md>), [Ethereum](<https://devfeed.tech/topics/ethereum.md>)

Tags: [bitcoin](<https://devfeed.tech/tags/bitcoin.md>), [blockchain](<https://devfeed.tech/tags/blockchain.md>), [blockchain-transaction](<https://devfeed.tech/tags/blockchain-transaction.md>), [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [ethereum](<https://devfeed.tech/tags/ethereum.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [function](<https://devfeed.tech/tags/function.md>), [go-blockchain](<https://devfeed.tech/tags/go-blockchain.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [learn](<https://devfeed.tech/tags/learn.md>), [reference](<https://devfeed.tech/tags/reference.md>), [transactions](<https://devfeed.tech/tags/transactions.md>), [types](<https://devfeed.tech/tags/types.md>), [video](<https://devfeed.tech/tags/video.md>)

### AI overview

This video explains how to define and validate transaction types for a blockchain's in-memory accounting database. It covers the transaction data type, field design, validation methods, nonce tokens, and a transaction factory function, with concepts borrowed from Ethereum for reference.

### Source excerpt

Introduction In episode 17, Bill began to design an in-memory accounting database that will store the account balances on his blockchain. To build this database, Bill will add a memory pool on each node that stores a list of public addresses with their respective balances. The balances on these addresses are reconstructed by reading the previous transaction records found on his blockchain. In this video, Bill will define the types of transactions his blockchain will support. The first step Bill takes is to define the transaction data type and give a full walkthrough of the reasoning behind the fields he chose for this data type. Next, he'll define methods for this type that will validate a transaction. While writing this code, Bill will borrow a few concepts from Ethereum to build a reference implementation. Watch to learn how transactions are managed on the blockchain and how to define one on your blockchain.

## Ultimate Go: Advanced Engineering Episode 19 -- Defining a Blockchain Account Data Structure

DevFeed: [Ultimate Go: Advanced Engineering Episode 19 -- Defining a Blockchain Account Data Structure](<https://devfeed.tech/articles/ultimate-go-advanced-engineering-episode-19-22208.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/01/ultimate-go-advanced-engineering-episode-19.html>)

Published: 2023-01-24T00: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>), [Blockchain](<https://devfeed.tech/topics/blockchain.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Ethereum](<https://devfeed.tech/topics/ethereum.md>), [Transactions](<https://devfeed.tech/topics/transactions.md>)

Tags: [account](<https://devfeed.tech/tags/account.md>), [bitcoin](<https://devfeed.tech/tags/bitcoin.md>), [blockchain](<https://devfeed.tech/tags/blockchain.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [data-type](<https://devfeed.tech/tags/data-type.md>), [design](<https://devfeed.tech/tags/design.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [ethereum](<https://devfeed.tech/tags/ethereum.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [go](<https://devfeed.tech/tags/go.md>), [go-blockchain](<https://devfeed.tech/tags/go-blockchain.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [learn](<https://devfeed.tech/tags/learn.md>), [transactions](<https://devfeed.tech/tags/transactions.md>), [video](<https://devfeed.tech/tags/video.md>)

### AI overview

This video explains how to define a user account type for a blockchain in Go. It covers the account data structure, the design rationale, and a factory function for initializing an account.

### Source excerpt

Introduction In episode 18, Bill defined the Go type that will represent a transaction and implemented the methods to validate one. While developing the transaction type, Bill states that he'll be borrowing concepts from Ethereum to ensure that he's building a reference implementation. Bill's transaction type has a field named nonce, similar to Ethereum, that ensures transactions are executed in order. The nonce value of the last transaction is stored in his accounting database and later compared for additional verification.

## Composed modifiers in Jetpack Compose

DevFeed: [Composed modifiers in Jetpack Compose](<https://devfeed.tech/articles/composed-modifiers-in-jetpack-compose-27464.md>)

Original publisher: [Read original article](<https://jorgecastilloprz.github.io/composed-modifiers-in-jetpack-compose>)

Author: Jorge Castillo

Published: 2022-04-04T10:00:00Z

Content type: tutorial

Language: en

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

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [ui](<https://devfeed.tech/topics/ui.md>), [context](<https://devfeed.tech/topics/context.md>), [factory function](<https://devfeed.tech/topics/factory-function.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-ui](<https://devfeed.tech/tags/compose-ui.md>), [context](<https://devfeed.tech/tags/context.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [modifiers](<https://devfeed.tech/tags/modifiers.md>), [state](<https://devfeed.tech/tags/state.md>), [stateful](<https://devfeed.tech/tags/stateful.md>), [stateless](<https://devfeed.tech/tags/stateless.md>)

### AI overview

This tutorial explains the difference between standard and composed modifiers in Jetpack Compose. Standard modifiers use extension functions and are stateless, while composed modifiers support state and access to composition context by creating them within a Composition.

### Source excerpt

Learn about composed modifiers and compare those to standard ones.

## Kotlin Delegated Properties for Designing a Simple Android Library API

DevFeed: [Kotlin Delegated Properties for Designing a Simple Android Library API](<https://devfeed.tech/articles/delightful-delegate-design-27043.md>)

Original publisher: [Read original article](<https://web.archive.org/web/20200513142755/https://blog.autsoft.hu/delightful-delegate-design/>)

Author: Márton Braun

Published: 2019-04-11T19:00:00Z

Content type: tutorial

Language: en

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

Topics: [API](<https://devfeed.tech/topics/api.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Library](<https://devfeed.tech/topics/library.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Android](<https://devfeed.tech/topics/android.md>), [properties](<https://devfeed.tech/topics/properties.md>), [factory function](<https://devfeed.tech/topics/factory-function.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [api-design](<https://devfeed.tech/tags/api-design.md>), [delegates](<https://devfeed.tech/tags/delegates.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [library](<https://devfeed.tech/tags/library.md>), [properties](<https://devfeed.tech/tags/properties.md>)

### AI overview

This tutorial explains API design choices in the Krate Android SharedPreferences wrapper. It shows how Kotlin delegated properties can encapsulate reusable logic, persist values across application restarts, and hide concrete implementations behind a simple interface and factory function.

### Source excerpt

When developing a library, designing an easy to use API while hiding unnecessary implementation details from clients is fundamental. Let's look at some API design choices we've made for our library Krate, an Android SharedPreferences wrapper.

## Avoid Interface Pollution

DevFeed: [Avoid Interface Pollution](<https://devfeed.tech/articles/avoid-interface-pollution-22115.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2016/10/avoid-interface-pollution.html>)

Published: 2016-10-21T00:00:00Z

Content type: tutorial

Language: en

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

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

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [code-reviews](<https://devfeed.tech/tags/code-reviews.md>), [decoupling](<https://devfeed.tech/tags/decoupling.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

The article explains interface pollution: declaring interfaces unnecessarily, especially when an interface duplicates a concrete type's entire API. It identifies warning signs and recommends using interfaces when callers need to provide implementations, multiple internal implementations exist, or decoupling from identified changes is necessary.

### Source excerpt

Introduction Interfaces should only be used when their added value is clear. I see too many packages that declare interfaces unnecessarily, sometimes just for the sake of using interfaces. The use of interfaces when they are not necessary is called interface pollution. This is a practice I would like to see questioned and identified more in code reviews. Code Example Let's look at a code example that contains questionable design choices that raise flags for interface pollution.