# abstract class

Published articles for abstract class.

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

## Abstract and Open Classes

DevFeed: [Abstract and Open Classes](<https://devfeed.tech/articles/abstract-and-open-classes-25047.md>)

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

Author: author@typealias.com (Dave Leeds)

Published: 2023-08-21T00: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: [Code](<https://devfeed.tech/topics/code.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [compare](<https://devfeed.tech/tags/compare.md>), [delegation](<https://devfeed.tech/tags/delegation.md>), [extend](<https://devfeed.tech/tags/extend.md>), [function](<https://devfeed.tech/tags/function.md>), [implement](<https://devfeed.tech/tags/implement.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [interface](<https://devfeed.tech/tags/interface.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>), [open-class](<https://devfeed.tech/tags/open-class.md>), [polymorphism](<https://devfeed.tech/tags/polymorphism.md>), [programming](<https://devfeed.tech/tags/programming.md>), [retro](<https://devfeed.tech/tags/retro.md>), [speed](<https://devfeed.tech/tags/speed.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [superclass](<https://devfeed.tech/tags/superclass.md>)

### AI overview

A tutorial chapter explaining how to extend open and abstract classes to create subtypes and share general code. It compares this approach with interfaces and delegation, highlighting that each has advantages and disadvantages.

### Source excerpt

In Chapter 12, we saw how we could use interfaces to create subtypes, and in the last chapter, we saw how we could use delegation with interfaces in order to share general code among specific classes. In this chapter, we'll learn how we can extend open and abstract classes to accomplish these same things with a different approach. Each approach has its advantages and disadvantages, so we'll also look at how they compare to one another.

## Class Modifiers in Dart: Sealed, Interface, Base

DevFeed: [Class Modifiers in Dart: Sealed, Interface, Base](<https://devfeed.tech/articles/class-modifiers-in-dart-sealed-interface-base-23989.md>)

Original publisher: [Read original article](<https://quickbirdstudios.com/blog/flutter-dart-class-modifiers/>)

Author: Marvin März

Published: 2023-06-23T11:29:43Z

Content type: tutorial

Language: en

Sources: [QuickBird Studios Blog](<https://devfeed.tech/sources/quickbird-studios-blog.md>)

Topics: [Dart](<https://devfeed.tech/topics/dart.md>), [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [dart](<https://devfeed.tech/tags/dart.md>), [flutter](<https://devfeed.tech/tags/flutter.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [oop](<https://devfeed.tech/tags/oop.md>), [pattern-matching](<https://devfeed.tech/tags/pattern-matching.md>), [post](<https://devfeed.tech/tags/post.md>), [sealed](<https://devfeed.tech/tags/sealed.md>), [sealed-interface](<https://devfeed.tech/tags/sealed-interface.md>)

### AI overview

This tutorial explains Dart 3 class modifiers, including the newly introduced sealed, interface, final, and base modifiers and changes to existing modifiers. It describes how modifiers control whether classes can be extended, mixed in, constructed, or implemented, and discusses their practical use cases.

### Source excerpt

With Dart 3 the class modifiers sealed, interface, final and base were introduced into the Dart language. They also updated how existing ones work. In this article, we show you why this change was made and how those new modifiers work. The post Class Modifiers in Dart: Sealed, Interface, Base appeared first on QuickBird Studios.

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

## Avoid backing properties for LiveData and StateFlow

DevFeed: [Avoid backing properties for LiveData and StateFlow](<https://devfeed.tech/articles/avoid-backing-properties-for-livedata-and-stateflow-25886.md>)

Original publisher: [Read original article](<https://medium.com/google-developer-experts/avoid-backing-properties-for-livedata-and-stateflow-706006c9867e?source=rss-1331e67af4e1------2>)

Author: Danny Preussler

Published: 2021-01-12T14:03:52Z

Content type: tutorial

Language: en

Sources: [Stories by Danny Preussler on Medium](<https://devfeed.tech/sources/stories-by-danny-preussler-on-medium.md>)

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

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [android](<https://devfeed.tech/tags/android.md>), [class](<https://devfeed.tech/tags/class.md>), [clean-code](<https://devfeed.tech/tags/clean-code.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [livedata](<https://devfeed.tech/tags/livedata.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>), [val](<https://devfeed.tech/tags/val.md>), [var](<https://devfeed.tech/tags/var.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

This Kotlin article argues that developers can avoid duplicated backing properties when exposing LiveData and StateFlow. It proposes separating the public API from the implementation with interfaces or an abstract class, including in ViewModels.

### Source excerpt

https://unsplash.com/photos/OopPIi_A428 If you have ever worked with LiveData you probably have written code similar to this: class MyViewModel: ViewModel() { val loading: LiveData<Boolean> get() = _loading private val _loading = MutableLiveData<Boolean>()} This seems nowadays the typical way developers would expose some immutable LiveData, while being able to have a mutable version inside the implementation we would write data into. Every time I saw, or even had to write, this kind of code something cringed inside me. As I quoted in one of my talks this feeling in our brain is for real: social missteps activate regions in the brain, [..] that have been previously associated with physical pain. As developers, we know something is wrong with this code, right? It also feels like we are writing manual getters and setters here. What's wrong? We could start with the prefix we use for the backing field, although we fought hard for a long time to get rid of prefixes, we accept it here! It is even made it into the official coding conventions. But even if we rename it, it still cringes: class MyViewModel: ViewModel() { val loading: LiveData<Boolean> get() = mutableLoading private val mutableLoading = MutableLiveData<Boolean>()} This duplication feels unneeded! Especially if you write something like a ViewModel that exposed many of these, you get lost in reading the code just by all these duplications. But it's just LiveData? You might think it's just a specialty of LiveData and the future of that construct might be a more limited one. And you would not have this issue with primitives. The language supports this out of the box with a private setter: var secret: String = "Secret" private set But there is a new kid in town: StateFlow needs the same thing! Look at this snippet from the official Jetbrains blog: class DownloadingModel { private val _state = MutableStateFlow<DownloadStatus>(DownloadStatus.NOT_REQUESTED) val state: StateFlow<DownloadStatus> get() = _state This probl

## ViewModel. How it works.

DevFeed: [ViewModel. How it works.](<https://devfeed.tech/articles/viewmodel-how-it-works-26015.md>)

Original publisher: [Read original article](<https://unbreakable-titan.medium.com/viewmodel-how-it-works-434282649286?source=rss-e32583ce94d4------2>)

Author: Vladislav Puryev

Published: 2020-01-18T15:40:09Z

Content type: tutorial

Language: en

Sources: [Stories by Vladislav Puryev on Medium](<https://devfeed.tech/sources/stories-by-vladislav-puryev-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Code](<https://devfeed.tech/topics/code.md>), [Framework](<https://devfeed.tech/topics/framework.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Google](<https://devfeed.tech/topics/google.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [android](<https://devfeed.tech/tags/android.md>), [android-framework](<https://devfeed.tech/tags/android-framework.md>), [code](<https://devfeed.tech/tags/code.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [evolution](<https://devfeed.tech/tags/evolution.md>), [java](<https://devfeed.tech/tags/java.md>), [screen](<https://devfeed.tech/tags/screen.md>), [state](<https://devfeed.tech/tags/state.md>), [technical](<https://devfeed.tech/tags/technical.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

This technical tutorial examines how Android ViewModel works internally and how it helps preserve screen state across configuration changes. It explains that ViewModel itself is a simple abstract class and that state retention results from processes within the Android framework, with correct initialization and factories required for dependencies.

### Source excerpt

Android ViewModel. How it works. Hello everybody. This post will be about popular solution from Google for Android developers -- ViewModel (if you are not familiar with it yet -- get started from official documentation). The main goal of article -- show you how viewModel works, how this tool helps us to save state of our screens. First of all it is better to note that viewModel -- is just java code inside Android framework and there is no any magic... almost. This mechanism was improved something about three times from its origin (2017) till the present day. Let's take a look at "Evolution of anatomy". WARNING! This article contains a lot of technical content and internals of Android framework. And please pay attention -- all demonstrated code you can find in your Android Framework using middle-click or ctrl + left-click. There is no any of self-made code -- all is inside Android framework. Attention again -- most of code will be provided in shortened form. Only necessary details. Full versions you can find in Android Framework source codes straight inside your IDE. ViewModel 2017 Honestly, this part (I mean exactly ViewModel's version of 2017) can be unnecessary, because Medium has several articles, that describes viewModel saving state mechanism in first version. I like this one. But I suggest you more code than there. First of all let's take a look at ViewModel class itself. According to official documentation: The ViewModel class allows data to survive configuration changes such as screen rotations. It can lead to research this class. https://medium.com/media/3966f6a014283670bd0d0430100902cd/href It is just simple abstract class. Without any secrets. With one empty method. Can documentation be wrong (or obsolete) so long time? This question is not so obvious. From one side, if you will create your child viewModel and initialize it using constructor, in this case saving states mechanism will not work. But if you are doing everything in the right way (using special initial

## Why a library developer should use abstract class instead of interface

DevFeed: [Why a library developer should use abstract class instead of interface](<https://devfeed.tech/articles/why-a-library-developer-should-use-abstract-class-instead-of-interface-25450.md>)

Original publisher: [Read original article](<https://hannesdorfmann.com/android/library-abstract-class/>)

Author: Hannes Dorfmann

Published: 2016-10-13T09:00:00Z

Content type: opinion

Language: en

Sources: [Hannes Dorfmann](<https://devfeed.tech/sources/hannes-dorfmann.md>)

Topics: [Library](<https://devfeed.tech/topics/library.md>), [Development](<https://devfeed.tech/topics/development.md>), [Java](<https://devfeed.tech/topics/java.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [android](<https://devfeed.tech/tags/android.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [interface](<https://devfeed.tech/tags/interface.md>), [java](<https://devfeed.tech/tags/java.md>), [library](<https://devfeed.tech/tags/library.md>)

### AI overview

The article explains why the author switched AdapterDelegates 3.0 from an interface to an abstract base class in an Android library. It compares interfaces and abstract classes, focusing on flexibility, shared behavior, state, and inheritance risks.

### Source excerpt

Use interfaces for java development they said. It will be more flexible they said. Well, that all might be true but for library projects that doesn't necessarily has to be true as well. In this post I will explain you why I have switched from interface to an abstract class as base class in one of my library projects called AdapterDelegates 3.

## Code generating beans - mutable and immutable

DevFeed: [Code generating beans - mutable and immutable](<https://devfeed.tech/articles/code-generating-beans-mutable-and-immutable-21991.md>)

Original publisher: [Read original article](<http://blog.joda.org/2016/09/code-generating-beans.html>)

Author: Stephen Colebourne (noreply@blogger.com)

Published: 2016-09-26T01:36:00Z

Content type: opinion

Language: en

Sources: [Stephen Colebourne](<https://devfeed.tech/sources/stephen-colebourne.md>)

Topics: [Code generation](<https://devfeed.tech/topics/code-generation.md>), [Java](<https://devfeed.tech/topics/java.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Code](<https://devfeed.tech/topics/code.md>), [ide](<https://devfeed.tech/topics/ide.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [code](<https://devfeed.tech/tags/code.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [hashcode](<https://devfeed.tech/tags/hashcode.md>), [interface](<https://devfeed.tech/tags/interface.md>), [java](<https://devfeed.tech/tags/java.md>), [javaone](<https://devfeed.tech/tags/javaone.md>), [jodabeans](<https://devfeed.tech/tags/jodabeans.md>), [properties](<https://devfeed.tech/tags/properties.md>), [tostring](<https://devfeed.tech/tags/tostring.md>)

### AI overview

This article discusses Java bean code generation, arguing that immutable beans and data structures are preferable to mutable beans. It compares IDE generation with annotation processors such as AutoValue, Immutables, and VALJOGen, which generate implementations during compilation.

### Source excerpt

Java has long suffered from the pain of beans. To declare a simple data class takes far too much code. At JavaOne 2016, I talked about code generation options - see the slides. Code generation of mutable and immutable beans The Java ecosystem is massive. So many libraries releasd as open source and beyond, which naturally leads to the question as to how those libraries communicate. And it is the basic concept of beans that is the essential glue, despite the ancient specification. How do ORMs (Hibernate etc.), Serialization (Jackson etc.) and Bean Mappers (Dozer etc.) communicate? Via getters and setters. The essential features of beans have moved beyond the JavaBeans spec, and are sometimes referred to as POJOs. The features are: Mutable No-args constructor Getters and Setters equals() / hashCode() / toString() But writing these manually is slow, tedious and error-prone. Code generation should be able to help us here. But should we be using mutable beans in 2016? No, no, no! It is time to be writing immutable data structure (immutable beans). But the only practical way to do so is code generation, especially if you want to have builders. In my talk at JavaOne 2016, I considered various code generation approaches: IDE code generation This is fine as far as it goes, but while the code is likely to be correct immediately after generation, there is still no guarantee that the generated code will stay correct as the class is maintained over time. AutoValue, Immutables and VALJOGen These three projects - AutoValue, Immutables, VALJOGen - use annotation processors to generate code during compilation. The idea is simple - the developer writes an abstract class or interface, and the tool code generates the implementation at compile time. However, these tool all focus on immutable beans, not mutable (Immutables can generate a modifiable bean, but it doesn't match the JavaBeans spec, so many tools will reject it). On the up side, there is no chance to mess up the equals / hash

## Design Patterns: Builder

DevFeed: [Design Patterns: Builder](<https://devfeed.tech/articles/design-patterns-builder-40673.md>)

Original publisher: [Read original article](<https://radek.io/posts/design-patterns-builder/>)

Published: 2011-08-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Radek Pazdera](<https://devfeed.tech/sources/radek-pazdera.md>)

Topics: [Architecture & Design](<https://devfeed.tech/topics/architecture-design.md>), [Software](<https://devfeed.tech/topics/software.md>), [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>), [abstract class](<https://devfeed.tech/topics/abstract-class.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [build](<https://devfeed.tech/tags/build.md>), [builder](<https://devfeed.tech/tags/builder.md>), [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [design-patterns](<https://devfeed.tech/tags/design-patterns.md>), [example](<https://devfeed.tech/tags/example.md>), [interface](<https://devfeed.tech/tags/interface.md>), [object](<https://devfeed.tech/tags/object.md>), [software-design](<https://devfeed.tech/tags/software-design.md>)

### AI overview

This tutorial explains the Builder design pattern as a creational pattern that moves complex object construction into a separate builder and director structure. It uses assembling different types of cars as an example.

### Source excerpt

Software design patterns by example

## Design Patterns: Abstract Factory

DevFeed: [Design Patterns: Abstract Factory](<https://devfeed.tech/articles/design-patterns-abstract-factory-40670.md>)

Original publisher: [Read original article](<https://radek.io/posts/design-patterns-abstract-factory/>)

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

Content type: tutorial

Language: en

Sources: [Radek Pazdera](<https://devfeed.tech/sources/radek-pazdera.md>)

Topics: [Architecture & Design](<https://devfeed.tech/topics/architecture-design.md>), [abstract class](<https://devfeed.tech/topics/abstract-class.md>), [Software](<https://devfeed.tech/topics/software.md>), [class](<https://devfeed.tech/topics/class.md>), [classes](<https://devfeed.tech/topics/classes.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Code](<https://devfeed.tech/topics/code.md>), [coding](<https://devfeed.tech/topics/coding.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Qt](<https://devfeed.tech/topics/qt.md>), [GTK](<https://devfeed.tech/topics/gtk.md>), [Windows](<https://devfeed.tech/topics/windows.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [code](<https://devfeed.tech/tags/code.md>), [components](<https://devfeed.tech/tags/components.md>), [design](<https://devfeed.tech/tags/design.md>), [design-patterns](<https://devfeed.tech/tags/design-patterns.md>), [desktop](<https://devfeed.tech/tags/desktop.md>), [example](<https://devfeed.tech/tags/example.md>), [gnome](<https://devfeed.tech/tags/gnome.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interface-design](<https://devfeed.tech/tags/interface-design.md>), [kde](<https://devfeed.tech/tags/kde.md>), [linux](<https://devfeed.tech/tags/linux.md>), [object](<https://devfeed.tech/tags/object.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [platform](<https://devfeed.tech/tags/platform.md>), [software](<https://devfeed.tech/tags/software.md>), [software-design](<https://devfeed.tech/tags/software-design.md>), [ui](<https://devfeed.tech/tags/ui.md>), [ui-components](<https://devfeed.tech/tags/ui-components.md>), [user-interface](<https://devfeed.tech/tags/user-interface.md>)

### AI overview

This tutorial explains the Abstract Factory design pattern, which encapsulates the creation of related families of objects without specifying their concrete classes. It uses a cross-platform user-interface example in which separate factories create components for KDE/Qt and GNOME/Gtk environments.

### Source excerpt

Software design patterns by example