# subclass

Published articles for subclass.

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

## On Formal Counterfactual Explanations

DevFeed: [On Formal Counterfactual Explanations](<https://devfeed.tech/articles/on-formal-counterfactual-explanations-139945.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.22010>)

Author: Alexey Ignatiev, Peter J. Stuckey, Joao Marques-Silva

Published: 2026-11-18T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>)

Tags: [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [changes](<https://devfeed.tech/tags/changes.md>), [conditionals](<https://devfeed.tech/tags/conditionals.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-lo](<https://devfeed.tech/tags/cs-lo.md>), [duality](<https://devfeed.tech/tags/duality.md>), [experiments](<https://devfeed.tech/tags/experiments.md>), [features](<https://devfeed.tech/tags/features.md>), [formal](<https://devfeed.tech/tags/formal.md>), [literals](<https://devfeed.tech/tags/literals.md>), [minimal](<https://devfeed.tech/tags/minimal.md>), [modular](<https://devfeed.tech/tags/modular.md>), [networks](<https://devfeed.tech/tags/networks.md>), [neural](<https://devfeed.tech/tags/neural.md>), [neural-networks](<https://devfeed.tech/tags/neural-networks.md>), [prediction](<https://devfeed.tech/tags/prediction.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [using](<https://devfeed.tech/tags/using.md>), [xai](<https://devfeed.tech/tags/xai.md>)

### AI overview

The paper introduces conjunctive counterfactual explanations (CFXps): conjunctions of feature literals that guarantee a prediction change. It characterizes closest-world counterfactual explanations as a disjunctive normal form over all minimally distant counterexamples, then connects CFXps to abductive (AXp) and contrastive (CXp) explanations: each CXp induces an AXp for its witness, and pairing a CXp with a witness AXp yields a CFXp whose support is determined by that AXp. This structure supports modular CFXp computation using existing AXp/CXp methods. Experiments on benchmarks with tree ensembles and neural networks report practically efficient extraction. Compared with popular point-based explainers, CFXps generally require no more feature changes and can guarantee the changed prediction beyond a single instance.

### Source excerpt

arXiv:2611.22010v1 Announce Type: new Abstract: Counterfactual explanations are often seen as counterfactual conditionals under closest-world semantics, requiring one to reason over all minimally distant counterexamples. In contrast, formal XAI typically relies on feature-based abductive explanations (AXps) and contrastive explanations (CXps), which admit efficient computation and a minimal hitting-set duality. This paper bridges these perspectives by (i) characterizing closest-world counterfactual explanations explicitly as a disjunctive normal form over all minimally distant counterexample instances, and (ii) introducing conjunctive counterfactual explanations (CFXps), a subclass of counterfactual antecedents restricted to conjunctions of feature literals that guarantee prediction change. The paper establishes structural results connecting CXps, AXps and CFXps: every CXp induces an AXp for its witness instance, and every CXp together with a witness AXp induces a CFXp whose support is precisely determined by that AXp. These theoretical results yield a modular approach for computing CFXps using existing AXp/CXp machinery. Experiments on a representative set of benchmarks using tree ensembles and neural networks show that CFXp extraction is practically efficient. Compared with popular point-based counterfactual explainers, CFXps generally require no more feature changes and can guarantee the counterfactual prediction beyond a single instance.

## Concordat: Typed Sessions for LLM Agents

DevFeed: [Concordat: Typed Sessions for LLM Agents](<https://devfeed.tech/articles/concordat-typed-sessions-for-llm-agents-103274.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2610.37461>)

Author: Milad Sikaroudi

Published: 2026-10-28T04:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [Agent Harness](<https://devfeed.tech/topics/agent-harness.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Finite-state machine](<https://devfeed.tech/topics/finite-state-machine.md>), [LLM security](<https://devfeed.tech/topics/llm-security.md>)

Tags: [actions](<https://devfeed.tech/tags/actions.md>), [agent](<https://devfeed.tech/tags/agent.md>), [agents](<https://devfeed.tech/tags/agents.md>), [airline](<https://devfeed.tech/tags/airline.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-ma](<https://devfeed.tech/tags/cs-ma.md>), [large-language-models](<https://devfeed.tech/tags/large-language-models.md>), [library](<https://devfeed.tech/tags/library.md>), [llm](<https://devfeed.tech/tags/llm.md>), [llm-agents](<https://devfeed.tech/tags/llm-agents.md>), [model](<https://devfeed.tech/tags/model.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [prompt](<https://devfeed.tech/tags/prompt.md>), [protocol](<https://devfeed.tech/tags/protocol.md>), [protocols](<https://devfeed.tech/tags/protocols.md>), [python](<https://devfeed.tech/tags/python.md>), [sessions](<https://devfeed.tech/tags/sessions.md>), [split](<https://devfeed.tech/tags/split.md>), [state](<https://devfeed.tech/tags/state.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [token](<https://devfeed.tech/tags/token.md>), [tools](<https://devfeed.tech/tags/tools.md>)

### AI overview

Concordat enforces agent action rules at runtime through finite-state protocols: each turn exposes only currently legal tools, rejects out-of-protocol calls before side effects, reserves human decisions for requests, and accounts for token and tool-call budgets across handoffs. Protocols are checked at definition, and subclasses that could bypass a parent protocol are rejected. In a tau-bench airline evaluation with simulated pressure to skip confirmation, standard agents changed bookings without the required "yes" in 13 of 50 tasks with gpt-4.1 and 29 of 128 task-runs with Claude Haiku 5.5; Concordat agents did so zero times, with no significant task-success difference. The benchmark reward missed most violations. The evidence provided is an abstract/excerpt.

### Source excerpt

arXiv:2610.37461v1 Announce Type: new Abstract: Agents built on large language models are increasingly allowed to take consequential actions: cancelling bookings, issuing refunds, changing accounts. The rules that govern those actions, such as "obtain the customer's explicit confirmation before changing anything", are usually stated in the prompt and followed only as reliably as the model chooses to follow them. We present Concordat, a Python library that treats an agent as an object whose interface is a finite-state protocol, in the spirit of typestate and session types, and enforces that protocol on the model at run time. On every turn the model is offered only the tools that are legal in the current protocol state, calls outside that set are rejected before they have side effects, decisions reserved for humans can only be requested, and token and tool-call budgets are charged and split linearly across handoffs. Protocols are checked when they are defined, and a subclass of an agent is rejected if it could bypass its parent's protocol, a behavioural form of Liskov substitution. We evaluate a Concordat agent against the standard agent of tau-bench on its 50 airline tasks, adding simulated customers who pressure the agent to skip confirmation. The standard agent made changes without the required "yes" in 13 of 50 tasks with gpt-4.1 and in 29 of 128 task-runs with Claude Haiku 5.5; the Concordat agent made none, with no significant difference in task success. tau-bench's own reward did not detect most of these violations. Concordat is open source.

## Benchmarks Are Free Now

DevFeed: [Benchmarks Are Free Now](<https://devfeed.tech/articles/benchmarks-are-free-now-20533.md>)

Original publisher: [Read original article](<https://code.dblock.org/2026/08/15/benchmarks-are-free-now.html>)

Author: Daniel Doubrovkine (dblock@dblock.org)

Published: 2026-08-15T00:00:00Z

Content type: opinion

Language: en

Sources: [Daniel Doubrovkine](<https://devfeed.tech/sources/daniel-doubrovkine.md>)

Topics: [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [subclass](<https://devfeed.tech/topics/subclass.md>), [superclass](<https://devfeed.tech/topics/superclass.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [GitHub Copilot Profiler Agent](<https://devfeed.tech/topics/github-copilot-profiler-agent.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [ai](<https://devfeed.tech/tags/ai.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [caching](<https://devfeed.tech/tags/caching.md>), [class](<https://devfeed.tech/tags/class.md>), [copilot](<https://devfeed.tech/tags/copilot.md>), [cost](<https://devfeed.tech/tags/cost.md>), [dispatch](<https://devfeed.tech/tags/dispatch.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [fast](<https://devfeed.tech/tags/fast.md>), [free](<https://devfeed.tech/tags/free.md>), [hash](<https://devfeed.tech/tags/hash.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [performance](<https://devfeed.tech/tags/performance.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [script](<https://devfeed.tech/tags/script.md>), [speed](<https://devfeed.tech/tags/speed.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [test](<https://devfeed.tech/tags/test.md>), [tests](<https://devfeed.tech/tags/tests.md>), [time](<https://devfeed.tech/tags/time.md>)

### AI overview

A benchmark generated with Copilot CLI exposed a performance regression in ruby-enum's inheritance fix: subclass lookups repeatedly rebuilt merged enum hashes, making a one-level subclass's calls roughly 5x slower than base-class calls, with deeper inheritance slower still. Tests had caught no issue because they checked correctness, not speed. The author says fix #60 memoized the merged hash and invalidated the cache when a new entry was added; afterward, subclass lookups were indistinguishable from base-class lookups regardless of depth. Further benchmarks found constant access as fast as plain Ruby, hash-backed lookups about 3-5x slower than direct calls, and the exhaustive matcher 50-100x slower than a native statement. The excerpt says these measurements were added to the README's Performance section.

### Source excerpt

My previous post walked through four bugs in ruby-enum, a gem I maintain, all stemming from the fact that class-level instance variables aren't inherited by subclasses. The third fix, #59, made keys, key?, value?, key, value, to_h, parse and each walk up superclass and merge in a parent's enums, so a subclass would see everything its ancestors defined. It was correct, fully tested, and shipped. It also made every one of those methods roughly 5x slower on any subclass. def _enum_hash if superclass < Ruby::Enum superclass.send(:_enum_hash).merge(_own_enum_hash) else _own_enum_hash end end This recomputes the merged hash, walking the entire ancestor chain, on every single call. There's no caching. A one-level subclass calling .value pays for building a brand new hash, on top of the superclass doing the same, every time. The test suite didn't notice because tests check correctness, not speed, and correctness was fine. I only found this because I asked Copilot CLI to add a benchmark script comparing lookups at different inheritance depths, mostly out of curiosity about how the "Benchmarks" section of the README would read next to the new feature. It took one prompt and about a minute to get a working script: class Colors include Ruby::Enum define :RED, 'red' define :GREEN, 'green' end class SubColors < Colors define :BLUE, 'blue' end class SubSubColors < SubColors define :YELLOW, 'yellow' end benchmark('base class (no inheritance)', n) { Colors.value(:RED) } benchmark('subclass (1 level)', n) { SubColors.value(:RED) } benchmark('sub-subclass (2 levels)', n) { SubSubColors.value(:RED) } The first run told the story immediately: a 1-level subclass's .value calls took roughly 5x as long as the base class, and a 2-level subclass was worse still. Nobody had written this benchmark before merging #59 because writing a throwaway benchmark script used to feel like more ceremony than it was worth for a one-off performance check. Now it's a single sentence to an agent, and the scri

## Ruby Instance Variables Are Not Inherited (and Why That Breaks Your DSL)

DevFeed: [Ruby Instance Variables Are Not Inherited (and Why That Breaks Your DSL)](<https://devfeed.tech/articles/ruby-instance-variables-are-not-inherited-and-why-that-breaks-your-dsl-20532.md>)

Original publisher: [Read original article](<https://code.dblock.org/2026/08/14/instance-variables-are-not-inherited-and-why-that-breaks-your-dsl.html>)

Author: Daniel Doubrovkine (dblock@dblock.org)

Published: 2026-08-14T00:00:00Z

Content type: article

Language: en

Sources: [Daniel Doubrovkine](<https://devfeed.tech/sources/daniel-doubrovkine.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [subclass](<https://devfeed.tech/topics/subclass.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [pull-requests](<https://devfeed.tech/tags/pull-requests.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [variables](<https://devfeed.tech/tags/variables.md>)

### AI overview

Four ruby-enum fixes in version 1.2.0 address class-level instance variables that Ruby subclasses do not inherit. Re-including the module could either retain stale enum keys after a class reload or erase a parent's enums; resetting state fixes the reload case but must avoid wiping inherited data. A subclass that defines no enums also had methods that crashed because its own enum hash was unset. The fixes first added a lazy reader defaulting to an empty hash, then updated eight methods to walk ancestors and merge inherited enums, with subclass definitions taking precedence. The excerpt ends while explaining this approach.

### Source excerpt

The ruby-enum gem is a small library I maintain that adds enum-like behavior to a class via include Ruby::Enum and define :KEY, value. Four pull requests landed against it recently, each fixing a different symptom, and all four turned out to be the same underlying bug: class-level instance variables set in a module's included hook are not inherited by subclasses the way you might expect. All of these fixes shipped in ruby-enum 1.2.0. Ruby::Enum stores its keys and values in instance variables on the class itself, set up when the module is included. def self.included(base) base.extend ClassMethods base.instance_variable_set(:@_enum_hash, {}) base.instance_variable_set(:@_enums_by_value, {}) end This works fine for a single class. It gets interesting the moment subclasses or class reloading show up. A user opened #56, reporting DuplicateKeyError from a Rails console after a class that had already defined its enums got reloaded. It reproduces without Rails. class_body = proc do include Ruby::Enum define :RED, 'red' end Colors = Class.new(&class_body) Colors.class_eval(&class_body) # raises DuplicateKeyError Rails' development-mode autoloader re-evaluates a class body, and the second define :RED sees @_enum_hash still holding RED from the first load, so the duplicate-key check fires. The fix clears the hash whenever Ruby::Enum is included, rather than assuming it's always a fresh class. The contributor that reported the problem and submitted the fix also caught a sneakier variant: a subclass that redundantly re-includes Ruby::Enum (include is supposed to be idempotent, right?) was wiping out enums inherited from its parent, because included unconditionally reset the instance variables: class OtherSecondSubclass < FirstSubclass include Ruby::Enum # redundant, but shouldn't lose FirstSubclass's enums define :MAGENTA, 'magenta' end Thanks, Nazar, for tracking both of these down with tests. Months later, #49 surfaced a related crash: a subclass that never calls define itsel

## Deriving Type Erasure

DevFeed: [Deriving Type Erasure](<https://devfeed.tech/articles/deriving-type-erasure-60973.md>)

Original publisher: [Read original article](<https://david.alvarezrosa.com/posts/deriving-type-erasure/>)

Author: David Álvarez Rosa

Published: 2026-03-10T09:46:00Z

Content type: tutorial

Language: en

Sources: [David Álvarez Rosa](<https://devfeed.tech/sources/david-alvarez-rosa.md>)

Topics: [union types](<https://devfeed.tech/topics/union-types.md>), [Polymorphism](<https://devfeed.tech/topics/polymorphism.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [cpp](<https://devfeed.tech/tags/cpp.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [polymorphism](<https://devfeed.tech/tags/polymorphism.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

The tutorial explains type erasure in C++ by comparing interface-based polymorphism with templates. It introduces wrappers that can provide a shared interface for concrete types that do not share a base class, deriving a minimal std::any implementation.

### Source excerpt

Ever looked at std::any and wondered what's going on behind the scenes? Beneath the intimidating interface is a classic technique called type erasure: concrete types hidden behind a small, uniform wrapper. Starting from familiar tools like virtual functions and templates, we'll build a minimal std::any. By the end, you'll have a clear understanding of how type erasure works under the hood. Polymorphism with interfaces § The typical way to achieve polymorphism is to define an interface consisting of pure-virtual methods you want to be able to call. Then, for each implementation that you want to use polymorphically, you create a subclass that inherits from the base class and implement those methods. As an example, let's implement shape classes that have an area() method. We start with an interface1 class class Shape { public: virtual ~Shape() = default; virtual auto area() const noexcept -> double = 0; }; And add a couple of concrete implementations for Square and Circle class Square : public Shape { int side_; public: explicit Square(int side) noexcept : side_{side} {} auto area() const noexcept -> double override { return side_ * side_; } }; class Circle : public Shape { int radius_; public: explicit Circle(int radius) noexcept : radius_{radius} {} auto area() const noexcept -> double override { return std::numbers::pi * radius_ * radius_; } }; Now, we can use these implementations generically, by coding against the interface auto printArea(const Shape& shape) -> void { std::println("Area is {:.2f}", shape.area()); } Simple enough, right? Polymorphism with templates § Inheritance is a good solution to problems that require polymorphism, but sometimes the concrete types you want to handle polymorphically cannot share a common base class.2 In that case, if the types provide the same interface, you can use a template to get polymorphism instead auto printArea(const auto& shape) -> void { std::println("Area is {:.2f}", shape.area()); } You can use this method with Squar

## Effective Class Delegation

DevFeed: [Effective Class Delegation](<https://devfeed.tech/articles/effective-class-delegation-27061.md>)

Original publisher: [Read original article](<https://zsmb.co/effective-class-delegation/>)

Author: Márton Braun

Published: 2020-09-29T20:00:00Z

Content type: tutorial

Language: en

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

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Inheritance](<https://devfeed.tech/topics/inheritance.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bytecode](<https://devfeed.tech/tags/bytecode.md>), [delegation](<https://devfeed.tech/tags/delegation.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [interface](<https://devfeed.tech/tags/interface.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [marton-braun](<https://devfeed.tech/tags/marton-braun.md>), [override](<https://devfeed.tech/tags/override.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [superclass](<https://devfeed.tech/tags/superclass.md>), [zsmb](<https://devfeed.tech/tags/zsmb.md>), [zsmb-co](<https://devfeed.tech/tags/zsmb-co.md>), [zsmb13](<https://devfeed.tech/tags/zsmb13.md>), [zsmbco](<https://devfeed.tech/tags/zsmbco.md>)

### AI overview

This tutorial explains how Kotlin class delegation can implement an interface by forwarding calls to a contained object. It contrasts this concise approach with Java solutions motivated by Effective Java's recommendation to favor composition over inheritance.

### Source excerpt

One of the most significant items of the Effective Java book is Item 18: Favor composition over inheritance. Let's see how Kotlin promotes this with class delegation.

## Remind iOS: Present All the Things!

DevFeed: [Remind iOS: Present All the Things!](<https://devfeed.tech/articles/remind-ios-present-all-the-things-31930.md>)

Original publisher: [Read original article](<http://engineering.remind.com/ios-presentation/>)

Author: Remind

Published: 2019-05-28T00:00:00Z

Content type: article

Language: en

Sources: [Remind](<https://devfeed.tech/sources/remind.md>)

Topics: [User interface design](<https://devfeed.tech/topics/ui-design.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [MVVM](<https://devfeed.tech/topics/mvvm.md>), [mvc](<https://devfeed.tech/topics/mvc.md>), [Design system](<https://devfeed.tech/topics/design-system.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>)

Tags: [ios](<https://devfeed.tech/tags/ios.md>), [layout](<https://devfeed.tech/tags/layout.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [subclass](<https://devfeed.tech/tags/subclass.md>)

### AI overview

The excerpt describes Remind's MVVM-oriented iOS practices for building reusable UI components. The team uses programmatic layout with SnapKit, citing easier code review and parallel work as reasons for leaving xibs, while acknowledging teams may choose differently. It recommends encapsulating related controls in UIView subclasses, keeping internal primitives private, and exposing data through a present(...) method or limited properties. View models adapt domain objects into presentation data, while closures with action enums report user actions. Reusable design components get their own files; feature-specific views stay private alongside their view controller. The author also recommends separating UI management from navigation sequence so view controllers handle fewer responsibilities.

### Source excerpt

For the past couple years we've been implementing new features with an MVVM-driven approach. Over that time, we've settled into a couple of good (I think) patterns for implementing UIView subclasses, composing them in various view hierarchies, and handling the interactions between them. Ultimately, the goal of any iOS application is to get data presented onto the screen, so I thought I'd share what's been working well for us in that department. Layout In Code It's a debate where every team eventually has to pick a side: Do we use storyboards and xibs, or do we write all of our layout in code? To make a long story short, our team started with Interface Builder, but we abandoned xibs a few years ago and have gone to fully programmatic layout code using SnapKit as our DSL of choice. Every team's needs will be different, but we think it's important that we can effectively code-review each other's layout implementations and potentially have multiple people working on the same screen, neither of which are really practical with xibs. I'll leave it at that -- you do you. Use UIView Subclasses Liberally Nothing clutters the actual logic of a UIViewController like big blocks of view construction code. Whenever you have a logical grouping UI primitives (UILabel, UIImageView, UIButton, etc), make a UIView subclass that encapsulates all of the relative layout inside that view container. This allows you to build the view hierarchy for your view controller in simpler, larger, more logical chunks of UI. One of the more complex UI layouts we have in our application is the settings screen for a class the user owns. Let's look at the layout and focus on the CLASS SETTINGS section, which contains two items, each consisting of two labels and a switch. On our first iteration, our view controller maintained property accessors for each of those primitives: class ClassSettingsViewController: UIViewController { ... private let isPublicTitleLabel = UILabel() private let isPublicMessageLabel =

## TIP: Adapting to Tablets

DevFeed: [TIP: Adapting to Tablets](<https://devfeed.tech/articles/tip-adapting-to-tablets-19561.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/tip-adapting-to-tablets/>)

Author: Shai Almog

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

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [App](<https://devfeed.tech/topics/app.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [app-development](<https://devfeed.tech/tags/app-development.md>), [classes](<https://devfeed.tech/tags/classes.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [development](<https://devfeed.tech/tags/development.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [phone-app](<https://devfeed.tech/tags/phone-app.md>), [phones](<https://devfeed.tech/tags/phones.md>), [subclass](<https://devfeed.tech/tags/subclass.md>)

### AI overview

This tutorial presents a "phone first" approach for adapting Codename One applications to tablets. It describes building the phone version first, then restructuring forms and subclasses to support a tablet layout with a permanent side menu and replaceable content. The author notes that generalizing the approach into a standardized API has been difficult.

### Source excerpt

A while back someone asked on stackoverflow how to adapt a Codename One app to tablets. I provided quite a few references in the answer and following discussion but I think a better approach is to explain what we did with the recent Codename One Build app because that's what I've been doing in all recent apps I worked on. I call this approach the "phone first" approach for universal app development. It starts by forgetting about the tablet and focusing on building a good looking phone app. In this app I usually subclass Form for all the classes which instantly creates an app that's very suitable for phones.

## Build an AngrDBG frontend for your debugger

DevFeed: [Build an AngrDBG frontend for your debugger](<https://devfeed.tech/articles/build-an-angrdbg-frontend-for-your-debugger-41512.md>)

Original publisher: [Read original article](<https://andreafioraldi.github.io/articles/2018/09/22/angrdbg-frontend.html>)

Author: malweisse's corruptions

Published: 2018-09-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [The blog of malweisse's corruptions](<https://devfeed.tech/sources/the-blog-of-malweisse-s-corruptions.md>)

Topics: [synchronization](<https://devfeed.tech/topics/synchronization.md>), [gdb](<https://devfeed.tech/topics/gdb.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Process](<https://devfeed.tech/topics/process.md>)

Tags: [debugger](<https://devfeed.tech/tags/debugger.md>), [gdb](<https://devfeed.tech/tags/gdb.md>), [process](<https://devfeed.tech/tags/process.md>), [python](<https://devfeed.tech/tags/python.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>)

### AI overview

This tutorial explains how to build a frontend for a debugger using AngrDBG. It describes the subclass and registration required to synchronize a concrete process state with an angr state, along with methods for process control, memory and register access, executable metadata, and symbol resolution.

### Source excerpt

AngrDBG is the library that I developed to synchronize a concrete process state with an angr state. The library is debugger agnostic. A frontend library that integrates AngrDBG with a specific debugger must implements a subclass of angrdbg.Debugger and register an istance of that class as source of data using angrdbg.register_debugger. The methods that must be implemented are the following: before_stateshot(self) An event handler triggered before the synchronization setup in StateShot, just after the empty state creation after_stateshot(self, state) An event handler triggered before the StateShot return is_active(self) Return True if the debugger is running the target process input_file(self) Return a python file-like object of the target executable image_base(self) Return the process base address get_<byte|word|dword|qword>(self, addr) Read an byte|word|dword|qword from the memory as a python int (4 distinct methods) get_bytes(self, addr, size) Read a string from the memory put_<byte|word|dword|qword>(self, addr, value) Write a python in as a byte|word|dword|qword to the memory (4 distinct methods) put_bytes(self, addr, value) Write a string to the memory get_reg(self, name) Get a register value set_reg(self, name, value) Set a register value step_into(self) Call the debugger step into command run(self) Run the process inside the debugger wait_ready(self) Wait until the debugged process is ready to be inspected refresh_memory(self) Refresh the memory API of the debugger seg_by_name(self, name) Get a Segment object by the name seg_by_addr(self, name) Get a Segment object by the address get_got(self) Get a tuple (start address, end address) related to the GOT section get_plt(self) Get a tuple (start address, end address) related to the PLT section resolve_name(self, name) Resolve a symbol to its address using the name You can find here the GDBDebugger class used in the GDB frontend.

## Custom Errors in TypeScript 2.1

DevFeed: [Custom Errors in TypeScript 2.1](<https://devfeed.tech/articles/custom-errors-in-typescript-2-1-31839.md>)

Original publisher: [Read original article](<https://www.metachris.dev/2017/01/custom-errors-in-typescript-2.1/>)

Author: Chris Hager

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

Content type: tutorial

Language: en

Sources: [Chris Hager](<https://devfeed.tech/sources/chris-hager.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [custom](<https://devfeed.tech/tags/custom.md>), [errors](<https://devfeed.tech/tags/errors.md>), [native](<https://devfeed.tech/tags/native.md>), [prototype](<https://devfeed.tech/tags/prototype.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

A tutorial on handling custom Error subclasses in TypeScript 2.1, where extending built-in types such as Error may leave subclass methods undefined and cause instanceof checks to fail. It presents a solution that reliably works, including with native and Bluebird promises.

### Source excerpt

TypeScript 2.1 introduced a number of breaking changes, among them that "Extending built-ins like Error, Array, and Map may no longer work". For a subclass like the following: class FooError extends Error { constructor(m: string) { super(m); } sayHello() { return "hello " + this.message; } } methods may be undefined on objects returned by constructing these subclasses, so calling sayHello will result in an error. instanceof will be broken between instances of the subclass and their instances, so (new FooError()) instanceof FooError will return false.

## A Modern Network Operation

DevFeed: [A Modern Network Operation](<https://devfeed.tech/articles/a-modern-network-operation-37510.md>)

Original publisher: [Read original article](<https://www.cimgf.com/2016/01/28/a-modern-network-operation/>)

Author: Marcus Zarra

Published: 2016-01-28T20:12:28Z

Content type: article

Language: en

Sources: [Cocoa Is My Girlfriend](<https://devfeed.tech/sources/cocoa-is-my-girlfriend.md>)

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

Tags: [api](<https://devfeed.tech/tags/api.md>), [apple](<https://devfeed.tech/tags/apple.md>), [developers](<https://devfeed.tech/tags/developers.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [network](<https://devfeed.tech/tags/network.md>), [nsoperation](<https://devfeed.tech/tags/nsoperation.md>), [objective-c](<https://devfeed.tech/tags/objective-c.md>), [structure](<https://devfeed.tech/tags/structure.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This article discusses designing network operations around Apple's NSURLSession API. It argues that block-based network calls can encourage poor structure and describes a design using subclasses, lifecycle control, implementation changes, and supporting properties for network data and tasks, with Swift-specific differences from Objective-C.

### Source excerpt

When Apple introduced the NSURLSession API, the landscape of network operations changed. In some ways, the new API made things worse as the block API that was added tempts developers to become very sloppy with network calls. The block API makes it trivial to add network calls anywhere in an application. Very little thought or [...]

## Custom Drawables

DevFeed: [Custom Drawables](<https://devfeed.tech/articles/custom-drawables-30577.md>)

Original publisher: [Read original article](<https://ryanharter.com/blog/2015/04/custom-drawables/>)

Published: 2015-04-03T07:00:00Z

Content type: tutorial

Language: en

Sources: [Blogs on Ryan Harter](<https://devfeed.tech/sources/blogs-on-ryan-harter.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Code](<https://devfeed.tech/topics/code.md>), [Canvas](<https://devfeed.tech/topics/canvas.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [canvas](<https://devfeed.tech/tags/canvas.md>), [code](<https://devfeed.tech/tags/code.md>), [source](<https://devfeed.tech/tags/source.md>), [subclass](<https://devfeed.tech/tags/subclass.md>)

### AI overview

This tutorial explains how to use custom Android Drawables to encapsulate application logic and create a reveal transition between selected and unselected icons in a horizontally scrolling selection view. It describes subclassing Drawable, using setLevel(int) to represent selection progress, and clipping the canvas during drawing.

### Source excerpt

We've all seen posts about why you should use custom views when applicable and how it can help you properly encapsulate your application code. What we don't see quite as much is how this type of thinking can be translated to other, non-View related, portions of our apps. In my app, Fragment, there are a few places where I make use of custom Drawables to encapsulate my logic just like you would for a custom View.

## Getting the current filename with Spark and HDFS

DevFeed: [Getting the current filename with Spark and HDFS](<https://devfeed.tech/articles/getting-the-current-filename-with-spark-and-hdfs-20849.md>)

Original publisher: [Read original article](<http://themodernlife.net/scala/spark/hadoop/hdfs/2014/09/28/spark-input-filename/>)

Published: 2014-09-28T11:50:13Z

Content type: tutorial

Language: en

Sources: [Ian Hummel](<https://devfeed.tech/sources/ian-hummel.md>)

Topics: [Apache Spark](<https://devfeed.tech/topics/spark.md>), [Hadoop](<https://devfeed.tech/topics/hadoop.md>)

Tags: [apache-spark](<https://devfeed.tech/tags/apache-spark.md>), [foreach](<https://devfeed.tech/tags/foreach.md>), [hadoop](<https://devfeed.tech/tags/hadoop.md>), [hdfs](<https://devfeed.tech/tags/hdfs.md>), [map](<https://devfeed.tech/tags/map.md>), [reduce](<https://devfeed.tech/tags/reduce.md>), [scala](<https://devfeed.tech/tags/scala.md>), [spark](<https://devfeed.tech/tags/spark.md>), [subclass](<https://devfeed.tech/tags/subclass.md>)

### AI overview

A tutorial shows how to obtain the filename being processed in a Spark map/reduce job. It uses Spark 1.1.0's HadoopRDD.mapPartitionsWithInputSplit with FileSplit, and notes that the approach requires an InputFormat subclass of FileInputFormat.

### Source excerpt

It's occasionally useful when writing map/reduce jobs to get a hold of the current filename that's being processed. There's a few ways to do this, depending on the version of Spark that you're using. Spark 1.1.0 introduced a new method on HadoopRDD that makes this super easy: import org.apache.hadoop.io.LongWritable import org.apache.hadoop.io.Text import org.apache.hadoop.mapred.{FileSplit, TextInputFormat} import org.apache.spark.rdd.HadoopRDD // Create the text file val text = sc.hadoopFile("file:///tmp/files", classOf[TextInputFormat], classOf[LongWritable], classOf[Text], sc.defaultMinPartitions) // text: org.apache.spark.rdd.RDD[(org.apache.hadoop.io.LongWritable, org.apache.hadoop.io.Text)] = file:///tmp/files HadoopRDD[2] at hadoopFile at <console>:16 // Cast to a HadoopRDD val hadoopRdd = text.asInstanceOf[HadoopRDD[LongWritable, Text]] // hadoopRdd: org.apache.spark.rdd.HadoopRDD[org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text] = file:///tmp/files HadoopRDD[2] at hadoopFile at <console>:16 val fileAndLine = hadoopRdd.mapPartitionsWithInputSplit { (inputSplit, iterator) ⇒ val file = inputSplit.asInstanceOf[FileSplit] iterator.map { tpl ⇒ (file.getPath, tpl._2) } } fileAndLine.foreach(println) // prints lines like (file:/tmp/files/part-00000,line1...), (file:/tmp/files/part-00000,line2...), ... There are a few things to note: - You can't simply use sc.textFile because under the hood, the textFile method actually maps the resulting HadoopRDD, returning a MappedRDD which is not what we want - This will only work if your InputFormat is a subclass of FileInputFormat - mapPartitionsWithInputSplit returns a new iterator, in this case we simply map over it (which is done lazily!) to include the split's filename

## Building Dynamic Custom Views

DevFeed: [Building Dynamic Custom Views](<https://devfeed.tech/articles/building-dynamic-custom-views-30572.md>)

Original publisher: [Read original article](<https://ryanharter.com/blog/2014/08/building-dynamic-custom-views/>)

Published: 2014-08-29T07:00:00Z

Content type: tutorial

Language: en

Sources: [Blogs on Ryan Harter](<https://devfeed.tech/sources/blogs-on-ryan-harter.md>)

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

Tags: [android](<https://devfeed.tech/tags/android.md>), [padding](<https://devfeed.tech/tags/padding.md>), [screen](<https://devfeed.tech/tags/screen.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [view](<https://devfeed.tech/tags/view.md>)

### AI overview

A tutorial on building a custom Android view that lets users scroll content so any item can align with the center of the screen. It discusses using a HorizontalScrollView, adding scroll-position observation through subclassing, and handling side padding for different screen sizes.

### Source excerpt

Last week I released Fragment for Android. Fragment is made up of all sorts of custom Views, which I think sets it apart from many apps in the Play Store. Some of these views have a similar pattern to views I've had to create for other apps, in which a scroll view has padding such that every item within it can be scrolled to the center of the view. On it's surface this doesn't seem complex, but when you consider the massive difference in screen sizes available on Android, things get a little more complicated.

## NSTableView vim keys

DevFeed: [NSTableView vim keys](<https://devfeed.tech/articles/nstableview-vim-keys-25382.md>)

Original publisher: [Read original article](<https://smileykeith.com/2013/01/08/nstableview-vim-keys/>)

Author: Keith Smiley

Published: 2013-01-09T00:19:00Z

Content type: tutorial

Language: en

Sources: [Keith Smiley](<https://devfeed.tech/sources/keith-smiley.md>)

Topics: [Vim](<https://devfeed.tech/topics/vim.md>)

Tags: [apis](<https://devfeed.tech/tags/apis.md>), [application](<https://devfeed.tech/tags/application.md>), [arrow](<https://devfeed.tech/tags/arrow.md>), [behavior](<https://devfeed.tech/tags/behavior.md>), [core-data](<https://devfeed.tech/tags/core-data.md>), [data](<https://devfeed.tech/tags/data.md>), [event](<https://devfeed.tech/tags/event.md>), [found](<https://devfeed.tech/tags/found.md>), [functionality](<https://devfeed.tech/tags/functionality.md>), [gtd](<https://devfeed.tech/tags/gtd.md>), [implement](<https://devfeed.tech/tags/implement.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [j](<https://devfeed.tech/tags/j.md>), [keys](<https://devfeed.tech/tags/keys.md>), [os](<https://devfeed.tech/tags/os.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [table](<https://devfeed.tech/tags/table.md>), [testing](<https://devfeed.tech/tags/testing.md>), [vim](<https://devfeed.tech/tags/vim.md>), [with](<https://devfeed.tech/tags/with.md>)

### AI overview

The excerpt describes adding vim-style `j` and `k` navigation to an `NSTableView` subclass. Manually changing selected row indexes proved difficult because it did not reproduce the table view's pivot-based selection behavior when extending and reversing a selection. Emitting replacement arrow-key events through Quartz Event Services worked initially, but failed in the author's sandboxed setup. The author then found that `NSUpArrowFunctionKey` could supply the arrow key character needed to create an `NSEvent`; this approach reportedly worked in the subclass and under sandboxing. The excerpt omits the final code, so it does not provide enough detail to reproduce that implementation.

### Source excerpt

I'm currently working on a OS X application that uses a few different NSTableViews to display user data. I was testing them out a bit to make sure multiple deletions worked correctly from my database and I found myself pressing 'j' and 'k' to try and move down and up. I decided it would be pretty cool to implement those two vim shortcuts into my table view just in case anyone else thinks like me. This functionality already exists in The Hit List an awesome GTD app that has a lot of baggage with me, and I'm sure it exists in other applications as well. In my NSTableView subclass' keyDown: method I tried a few things. Attempt 1: First I tried to re implement the functionality myself. In retrospect this doesn't make any sense but at first it was pretty simple. It looked something like this. NSUInteger flags = [theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask; NSNumber *shiftPressed = (flags & NSShiftKeyMask); if ([theEvent keyCode] == 38) { // j NSUInteger index = [[self selectedRowIndexes] lastIndex] + 1; if ([shiftPressed boolValue]) { [self selectRowIndexes:[NSIndexSet indexSetWithIndex:index] byExtendingSelection:YES]; } else { [self selectRowIndexes:[NSIndexSet indexSetWithIndex:index] byExtendingSelection:NO]; } } else if ([theEvent keyCode] == 40) { // k NSUInteger index = [[self selectedRowIndexes] lastIndex] - 1; if ([shiftPressed boolValue]) { [self selectRowIndexes:[NSIndexSet indexSetWithIndex:index] byExtendingSelection:YES]; } else { [self selectRowIndexes:[NSIndexSet indexSetWithIndex:index] byExtendingSelection:NO]; } } The issue with this is the way NSTableView typically expands it's selection. I think of it as a pivot point where you start. Then you go up and down relative to that point. So if you start at index 2 and go down till index 4, you should have 2 rows selected. Then when you go back up you should deselect the rows and indexes 3 and 4 and select the rows and index 1 and 0. At this point I realized it was more difficult than I r

## Liskov Substitution Principle

DevFeed: [Liskov Substitution Principle](<https://devfeed.tech/articles/liskov-substitution-principle-40710.md>)

Original publisher: [Read original article](<https://radek.io/posts/liskov-substitution-principle/>)

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

Content type: tutorial

Language: en

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

Topics: [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [subclass](<https://devfeed.tech/topics/subclass.md>), [subtype](<https://devfeed.tech/topics/subtype.md>)

Tags: [hierarchy](<https://devfeed.tech/tags/hierarchy.md>), [object-oriented](<https://devfeed.tech/tags/object-oriented.md>), [software-design](<https://devfeed.tech/tags/software-design.md>), [solid](<https://devfeed.tech/tags/solid.md>), [subclass](<https://devfeed.tech/tags/subclass.md>), [subtype](<https://devfeed.tech/tags/subtype.md>)

### AI overview

This article explains the Liskov Substitution Principle, the L in SOLID object-oriented design. It presents definitions from Barbara Liskov and Jeannette Wing, a formulation by Robert C. Martin, and a Square-Rectangle hierarchy example showing how subtype behavior can violate substitutability.

### Source excerpt

SOLID Object-Oriented Design

## Private, protected and public in Python

DevFeed: [Private, protected and public in Python](<https://devfeed.tech/articles/private-protected-and-public-in-python-40732.md>)

Original publisher: [Read original article](<https://radek.io/posts/private-protected-and-public-in-python/>)

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

Content type: tutorial

Language: en

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

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [class](<https://devfeed.tech/topics/class.md>), [subclass](<https://devfeed.tech/topics/subclass.md>), [object](<https://devfeed.tech/topics/object.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [object](<https://devfeed.tech/tags/object.md>), [programming](<https://devfeed.tech/tags/programming.md>), [pull-request](<https://devfeed.tech/tags/pull-request.md>), [python](<https://devfeed.tech/tags/python.md>), [subclass](<https://devfeed.tech/tags/subclass.md>)

### AI overview

This tutorial explains how Python handles public, protected, and private members through defaults, naming conventions, and name mangling rather than strict access modifiers. It also discusses how these conventions apply to subclasses and code reviews.

### Source excerpt

How does encapsulation (not) work in Python.