# constructor

A constructor is a specialized function or class method that initializes and creates an object instance.

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

## In C++, = default and {} are not the same constructor

DevFeed: [In C++, = default and {} are not the same constructor](<https://devfeed.tech/articles/in-c-default-and-are-not-the-same-constructor-113364.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/11/02/default-and-braces-are-not-the-same-constructor/>)

Author: Daniel Lemire

Published: 2026-11-02T12:48:59Z

Content type: article

Language: en

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

Topics: [constructor](<https://devfeed.tech/topics/constructor.md>), [c/c++](<https://devfeed.tech/topics/c-c-plus-plus.md>), [clang](<https://devfeed.tech/topics/clang.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [intel-xeon](<https://devfeed.tech/tags/intel-xeon.md>), [november-2026](<https://devfeed.tech/tags/november-2026.md>), [performance](<https://devfeed.tech/tags/performance.md>), [spans](<https://devfeed.tech/tags/spans.md>), [struct](<https://devfeed.tech/tags/struct.md>)

### AI overview

An empty `span() = default` and `span() {}` can produce different performance because only the first is trivial: the explicitly defaulted constructor is trivial, while the empty body is user-provided. In the shown `box()` path, GCC 16 with `-O2 -march=x86-64` generates direct field stores for `span() {}`, but uses a temporary and copies 16 bytes for `span() = default`. The author reports that in timing tests of 100 million spans on one Intel Xeon Gold 6548N core, the `= default` version was over four times slower with both GCC 15 and GCC 16. The result is tied to the described code, compiler settings, and test setup.

### Source excerpt

You can write an empty default constructor as span() = default or as span() {}. It can have remarkable effects on performance. struct span { const char *p; int len; const char *end; span() = default; // or span() {} span(const char *s, int n) : p(s), len(n), end(s + n) {} }; The constructor ... Continue reading In C++, = default and {} are not the same constructor

## Object-Oriented Programming in Python vs Java

DevFeed: [Object-Oriented Programming in Python vs Java](<https://devfeed.tech/articles/object-oriented-programming-in-python-vs-java-110727.md>)

Original publisher: [Read original article](<https://realpython.com/oop-in-python-vs-java/>)

Author: Jon Fincher

Published: 2026-10-31T14:00:00Z

Content type: comparison

Language: en

Sources: [Real Python](<https://devfeed.tech/sources/real-python.md>)

Topics: [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>), [Java](<https://devfeed.tech/topics/java.md>), [Python](<https://devfeed.tech/topics/python.md>), [class](<https://devfeed.tech/topics/class.md>), [object](<https://devfeed.tech/topics/object.md>), [Inheritance](<https://devfeed.tech/topics/inheritance.md>), [Polymorphism](<https://devfeed.tech/topics/polymorphism.md>), [subclass](<https://devfeed.tech/topics/subclass.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [access-control](<https://devfeed.tech/tags/access-control.md>), [car](<https://devfeed.tech/tags/car.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [color](<https://devfeed.tech/tags/color.md>), [compare](<https://devfeed.tech/tags/compare.md>), [comparison](<https://devfeed.tech/tags/comparison.md>), [compilation-error](<https://devfeed.tech/tags/compilation-error.md>), [complete](<https://devfeed.tech/tags/complete.md>), [composition](<https://devfeed.tech/tags/composition.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [java](<https://devfeed.tech/tags/java.md>), [knowledge](<https://devfeed.tech/tags/knowledge.md>), [learn](<https://devfeed.tech/tags/learn.md>), [object](<https://devfeed.tech/tags/object.md>), [object-oriented](<https://devfeed.tech/tags/object-oriented.md>), [object-oriented-programming](<https://devfeed.tech/tags/object-oriented-programming.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [vs](<https://devfeed.tech/tags/vs.md>)

### AI overview

The article shows how Java OOP concepts translate into Python and where the languages differ. Java declares typed attributes in class bodies, commonly keeps them private behind getters and setters, and restricts classes to single inheritance while allowing shared behavior through interfaces. Python creates instance attributes with `self` in `__init__`, exposes them by default, and offers properties for controlled access; underscore naming conventions signal non-public attributes but do not provide Java-style access control. Python also supports multiple inheritance and duck typing, while Java uses interface types for polymorphic interchangeability. Both languages provide reflection and type checks, though the article describes Python's `dir()`, `getattr()`, and `callable()` workflow as simpler than Java's reflection APIs. Python dunder methods can customize representations and overload operators; the article notes Java has no comparable operator overloading. Examples use a `Car` class to illustrate these mechanisms and practical pitfalls, including class versus instance attributes.

### Source excerpt

Compare Python vs Java for object-oriented programming and learn how to apply your Java knowledge of classes and objects to Python in a Pythonic way.

## Python's Instance, Class, and Static Methods Demystified

DevFeed: [Python's Instance, Class, and Static Methods Demystified](<https://devfeed.tech/articles/python-s-instance-class-and-static-methods-demystified-89218.md>)

Original publisher: [Read original article](<https://realpython.com/instance-class-and-static-methods-demystified/>)

Author: Martin Breuss

Published: 2026-10-17T14:00:00Z

Content type: tutorial

Language: en

Sources: [Real Python](<https://devfeed.tech/sources/real-python.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [argument](<https://devfeed.tech/tags/argument.md>), [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [coding](<https://devfeed.tech/tags/coding.md>), [learn](<https://devfeed.tech/tags/learn.md>), [python](<https://devfeed.tech/tags/python.md>)

### AI overview

This tutorial explains how Python instance, class, and static methods differ and when to use each. It demonstrates instance methods for working with object state, class methods for class-level data and factory methods, and static methods for utilities that need no class or instance state.

### Source excerpt

Compare instance methods vs class methods vs static methods in Python, and learn when each one earns its place in your code.

## Quiz: Python's .\_\_call\_\_() Method: Creating Callable Instances

DevFeed: [Quiz: Python's .\_\_call\_\_() Method: Creating Callable Instances](<https://devfeed.tech/articles/quiz-python-s-call-method-creating-callable-instances-89220.md>)

Original publisher: [Read original article](<https://realpython.com/quizzes/python-callable-instances/>)

Author: Real Python

Published: 2026-10-17T12:00:00Z

Content type: tutorial

Language: en

Sources: [Real Python](<https://devfeed.tech/sources/real-python.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [examples](<https://devfeed.tech/tags/examples.md>), [functions](<https://devfeed.tech/tags/functions.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [pattern](<https://devfeed.tech/tags/pattern.md>), [python](<https://devfeed.tech/tags/python.md>)

### AI overview

This interactive quiz tests Python callable instances and the `.__call__()` method, including how it differs from `.__init__()` and how callable instances can support stateful behavior, caching, convenient APIs, class-based decorators, and the strategy pattern.

### Source excerpt

Test your understanding of Python callables and see how the .__call__() method lets you call class instances just like regular functions.

## EveryThing You Need To Know About Scala

DevFeed: [EveryThing You Need To Know About Scala](<https://devfeed.tech/articles/everything-you-need-to-know-about-scala-65415.md>)

Original publisher: [Read original article](<https://blog.devops.dev/everything-you-need-to-know-about-scala-c833fe885c44?source=rss----33f8b2d9a328---4>)

Author: Rahul Patidar

Published: 2026-10-06T13:04:28Z

Content type: article

Language: en

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

Topics: [Scala](<https://devfeed.tech/topics/scala.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [class](<https://devfeed.tech/topics/class.md>), [Closure](<https://devfeed.tech/topics/closure.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Learning](<https://devfeed.tech/topics/learning.md>), [superclass](<https://devfeed.tech/topics/superclass.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [block](<https://devfeed.tech/tags/block.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [closure](<https://devfeed.tech/tags/closure.md>), [design-patterns](<https://devfeed.tech/tags/design-patterns.md>), [exception](<https://devfeed.tech/tags/exception.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [factory](<https://devfeed.tech/tags/factory.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [function](<https://devfeed.tech/tags/function.md>), [functions](<https://devfeed.tech/tags/functions.md>), [monad](<https://devfeed.tech/tags/monad.md>), [none](<https://devfeed.tech/tags/none.md>), [nothing](<https://devfeed.tech/tags/nothing.md>), [null](<https://devfeed.tech/tags/null.md>), [packages](<https://devfeed.tech/tags/packages.md>), [recursion](<https://devfeed.tech/tags/recursion.md>), [scala](<https://devfeed.tech/tags/scala.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

The excerpt presents Scala interview topics through short explanations and code examples. It describes factory, singleton, and lazy initialization patterns; treating functions as values and higher-order functions; tail recursion, closures, placeholder syntax, partially applied functions, currying, purity, and anonymous functions. It also covers trait linearization in the diamond problem, monads, case class features, primary and auxiliary constructors, named Scala frameworks, exception handling without checked exceptions, BitSet, the App helper, package names, and Null, Nil, None, and Nothing. The supplied text ends mid-example in the factory pattern and is therefore an excerpt rather than evidence of the complete article.

### Source excerpt

Everyone who is a beginner in scala faces many problems and has many confusions while trying to understand important concepts in scala. In interviews, interviewers frequently ask about these concepts in Scala, and candidates are frequently unable to impress or explain these concepts to interviewers. So in today's post, I will be covering some important concepts in Scala, so whenever you go for your next interview, just read these concepts once and it will really help you to answer Scala Related Interview Questions. This post will cover the following topics: 1. Scala Design Patterns 2. First Class function 3. Higher-Order Functions 4. Tail Recursion in Scala. 5. Block of Code. 6. Closure 7. PlaceHolder Syntax: 8. Partially Applied Function: 9. Function Currying : 10. pure functions : 11. Anonymous Function: 12. Diamond Problem In scala: 13. traint in scala: 14. Monad in scala: 15. Case Classes In Scala. 16. constructors in Scala 17. Frameworks supported by Scala 18. Exception Handling in Scala 19. BitSet 20. app Class 21. Packages in Scala 22. Null, Nill, None, and Nothing in Scala Scala Design Patterns. Every time you develop some software, there are some common problems that everyone faces in his/her software engineering journey. To resolve these issues, we have some predefined general-purpose reusable solutions. These reusable solutions are nothing but design patterns. These are the types of templates that we can use as a solution whenever we encounter these issues. We have 3 kinds of design patterns in Scala. The factory design pattern: the main aim of the factory design pattern is to separate instance creation logic from the client. Here we implement instance creation logic in the factory class without exposing this logic to the client. It is used when we have multiple subclasses with one superclass and, based on the input, we need to return one of the inputs. Example trait Computer { def ram: String def hdd: String def cpu: String } case class PC(ram: String, h

## Opaque Types in Python

DevFeed: [Opaque Types in Python](<https://devfeed.tech/articles/opaque-types-in-python-49291.md>)

Original publisher: [Read original article](<https://blog.glyph.im/2026/05/opaque-types-in-python.html>)

Author: Glyph

Published: 2026-05-22T00:33:00Z

Content type: tutorial

Language: en

Sources: [Deciphering Glyph](<https://devfeed.tech/sources/deciphering-glyph.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [interface](<https://devfeed.tech/topics/interface.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [C](<https://devfeed.tech/topics/c.md>), [object](<https://devfeed.tech/topics/object.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [misc](<https://devfeed.tech/tags/misc.md>), [object](<https://devfeed.tech/tags/object.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>)

### AI overview

The article presents opaque data types as a design pattern for Python libraries. It focuses on keeping configuration objects' public interfaces minimal while allowing their internal state and implementation to evolve, and contrasts Python's limitations with opaque types commonly used in C.

### Source excerpt

A proposed technique for exposing an opaque data structure with idiomatic modern Python.

## Metro DI for Ktor Backend: From a God Object through manual DI to Constructor Injection

DevFeed: [Metro DI for Ktor Backend: From a God Object through manual DI to Constructor Injection](<https://devfeed.tech/articles/metro-di-for-ktor-backend-from-a-god-object-through-manual-di-to-constructor-injection-22966.md>)

Original publisher: [Read original article](<https://funkymuse.github.io/posts/metro-di-ktor-server/>)

Author: FunkyMuse

Published: 2026-05-15T15:35:00Z

Content type: article

Language: en

Sources: [FunkyMuse](<https://devfeed.tech/sources/funkymuse.md>)

Topics: [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [Ktor](<https://devfeed.tech/topics/ktor.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [koin](<https://devfeed.tech/topics/koin.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>)

Tags: [accessors](<https://devfeed.tech/tags/accessors.md>), [aggregation](<https://devfeed.tech/tags/aggregation.md>), [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [annotations](<https://devfeed.tech/tags/annotations.md>), [anvil](<https://devfeed.tech/tags/anvil.md>), [api](<https://devfeed.tech/tags/api.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [backend](<https://devfeed.tech/tags/backend.md>), [conf](<https://devfeed.tech/tags/conf.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [default-parameters](<https://devfeed.tech/tags/default-parameters.md>), [di](<https://devfeed.tech/tags/di.md>), [framework](<https://devfeed.tech/tags/framework.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [lazy](<https://devfeed.tech/tags/lazy.md>), [metro](<https://devfeed.tech/tags/metro.md>), [object](<https://devfeed.tech/tags/object.md>), [var](<https://devfeed.tech/tags/var.md>)

### AI overview

The author replaces a manually wired `BackendComponent`--whose default constructor parameters could silently pull real dependencies into tests--with Metro's compile-time constructor injection. A `BackendGraph` gathers `@ContributesTo` bindings and `@ContributesIntoSet` route and plugin registrars, so adding or removing them does not require editing a central registry; plugin installers retain an explicit order. Stateless injected classes get fresh instances, while `@SingleIn(AppScope::class)` is reserved for shared or costly objects. For integration tests, TestContainers provides PostgreSQL/PostGIS, Redis, and MinIO; tests start a real Ktor server and obtain its live Metro graph to inspect repository state. The author contrasts this with Metro's direct-construction-with-fakes approach for unit and component tests, which they do not use for this backend's integration coverage. They note that Metro's compile-time verification costs extra build time and say they miss Dagger's IDE dependency navigation. The supplied text describes a single Gradle backend module and a possible future split, not an implemented multi-module setup.

### Source excerpt

The Starting Point: a God Object When Rudio was a created a few months ago it used the simplest possible DI: one big object BackendComponent with everything wired manually via by lazy and lateinit var. No framework, no annotations, no ceremony, then i started adding things and manual DI became a tedious and tiring task because everywhere i used default parameters to achieve default constructor...

## San Diego C++ Meetup #85 - April 2026 Edition: Vector Pitfalls and Memory Management

DevFeed: [San Diego C++ Meetup #85 - April 2026 Edition: Vector Pitfalls and Memory Management](<https://devfeed.tech/articles/san-diego-c-meetup-85-april-2026-edition-vector-pitfalls-and-memory-management-51146.md>)

Original publisher: [Read original article](<https://vorbrodt.blog/2026/04/19/san-diego-c-meetup-85-april-2026-edition-vector-pitfalls-and-memory-management/>)

Author: Kobi

Published: 2026-04-20T00:54:50Z

Content type: article

Language: en

Sources: [Vorbrodt's C++ Blog](<https://devfeed.tech/sources/vorbrodt-s-c-blog.md>)

Topics: [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Memory Leaks](<https://devfeed.tech/topics/memory-leaks.md>), [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [container](<https://devfeed.tech/topics/container.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [copy](<https://devfeed.tech/topics/copy.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [Stateful](<https://devfeed.tech/topics/stateful.md>), [object](<https://devfeed.tech/topics/object.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [container](<https://devfeed.tech/tags/container.md>), [copy](<https://devfeed.tech/tags/copy.md>), [exception](<https://devfeed.tech/tags/exception.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [kobi](<https://devfeed.tech/tags/kobi.md>), [meetup](<https://devfeed.tech/tags/meetup.md>), [memory-leaks](<https://devfeed.tech/tags/memory-leaks.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [object](<https://devfeed.tech/tags/object.md>), [san-diego](<https://devfeed.tech/tags/san-diego.md>), [san-diego-c-plus-plus-meetup](<https://devfeed.tech/tags/san-diego-c-plus-plus-meetup.md>), [software](<https://devfeed.tech/tags/software.md>), [software-design](<https://devfeed.tech/tags/software-design.md>), [stateful](<https://devfeed.tech/tags/stateful.md>), [vector](<https://devfeed.tech/tags/vector.md>)

### AI overview

A report on the 85th San Diego C++ Meetup, covering C++23 quiz questions, std::vector initialization pitfalls, custom vector-like container implementation, raw memory allocation, the Rule of Five, stateful custom deleters, exception safety, and preventing double destruction and memory leaks.

### Source excerpt

Another fantastic month, another great San Diego C++ Meetup! On April 14th, 2026, we hosted our 85th session. We had an incredibly insightful meetup packed with brain-teasing code snippets, a serious deep dive into memory management, and lively discussions about the evolving tech landscape. If you missed the live session or want to revisit the [...]

## New without parentheses in PHP 8.4

DevFeed: [New without parentheses in PHP 8.4](<https://devfeed.tech/articles/new-without-parentheses-in-php-8-4-44180.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/new-with-parentheses-php-84>)

Author: Brent

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

Content type: tutorial

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [properties](<https://devfeed.tech/topics/properties.md>), [class](<https://devfeed.tech/topics/class.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [coding](<https://devfeed.tech/tags/coding.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [development](<https://devfeed.tech/tags/development.md>), [php](<https://devfeed.tech/tags/php.md>), [properties](<https://devfeed.tech/tags/properties.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

This article explains a PHP 8.4 syntax change that removes the need for parentheses around newly created objects when chaining methods and accessing methods, properties, static members, arrays, or callable objects. It also covers dynamic and anonymous classes, constructor-parentheses requirements, and parser ambiguity.

### Source excerpt

Read the full post on https://stitcher.io/blog/new-with-parentheses-php-84

## Clojure 1.12.0-alpha10

DevFeed: [Clojure 1.12.0-alpha10](<https://devfeed.tech/articles/clojure-1-12-0-alpha10-49676.md>)

Original publisher: [Read original article](<https://clojure.org/news/2024/04/28/clojure-1-12-alpha10>)

Published: 2024-04-28T00:00:00Z

Content type: release

Language: en

Sources: [Clojure News](<https://devfeed.tech/sources/clojure-news.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Java](<https://devfeed.tech/topics/java.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [function](<https://devfeed.tech/topics/function.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [class](<https://devfeed.tech/topics/class.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [Parameter](<https://devfeed.tech/topics/parameter.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [function](<https://devfeed.tech/tags/function.md>), [java](<https://devfeed.tech/tags/java.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [programming](<https://devfeed.tech/tags/programming.md>), [releases](<https://devfeed.tech/tags/releases.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

Clojure 1.12.0-alpha10 introduces qualified Java methods as ordinary function values. The compiler can generate wrapping functions and reflective calls for unresolved overloads, while :param-tags metadata can identify a desired method signature.

### Source excerpt

Clojure 1.12.0-alpha10 is now available! Find download and usage information on the Downloads page. Method values Clojure programmers often want to use Java methods in higher-order functions (e.g. passing a Java method to map). Until now, programmers have had to manually wrap methods in functions. This is verbose, and might require manual hinting for overload disambiguation, or incur incidental reflection or boxing. Programmers can now use Java qualified methods as ordinary functions in value contexts - the compiler will automatically generate the wrapping function. New in this release: the compiler will generate a reflective call when a qualified method does not resolve due to overloading. Developers can supply :param-tags metadata on qualified methods to specify the signature of a single desired method, 'resolving' it. New in this release: the compiler will generate a reflective call when param tags are not supplied on a qualified method that does not resolve due to overloading. See: CLJ-2793, CLJ-2844, CLJ-2835 Qualified methods - Class/method, Class/.method, and Class/new Java members inherently exist in a class. For methods as values we need a way to explicitly specify the class of an instance method because there is no possibility for inference. Qualified methods have value semantics when used in non-invocation positions: Classname/method - value is a Clojure function that invokes a static method Classname/.method - value is a Clojure function that invokes an instance method Classname/new - value is a Clojure function that invokes a constructor New in this release: developers must use Classname/method and Classname/.method syntax to differentiate between static and instance methods. Qualified method invocations with param-tags use only the tags to resolve the method. Without param-tags they behave like the equivalent dot syntax, except the qualifying class takes precedence over hints of the target object, and over its runtime type when invoked via reflection.

## Clojure 1.12.0-alpha8

DevFeed: [Clojure 1.12.0-alpha8](<https://devfeed.tech/articles/clojure-1-12-0-alpha8-49663.md>)

Original publisher: [Read original article](<https://clojure.org/news/2024/02/21/1-12-alpha8>)

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

Content type: release

Language: en

Sources: [Clojure News](<https://devfeed.tech/sources/clojure-news.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [deprecated](<https://devfeed.tech/topics/deprecated.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [error](<https://devfeed.tech/tags/error.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

Clojure 1.12.0-alpha8 is available with updates to clojure.walk/walk, replacement of deprecated URL constructor calls, and a reverted change to deref error messaging.

### Source excerpt

Clojure 1.12.0-alpha8 is now available! New: CLJ-2568 - clojure.walk/walk - preserve metadata on lists and seqs CLJ-2783 - replace calls to deprecated URL constructor Reverted: CLJ-1162 - deref - improve error message when called on non IDRef

## Clojure 1.12.0-alpha7

DevFeed: [Clojure 1.12.0-alpha7](<https://devfeed.tech/articles/clojure-1-12-0-alpha7-49660.md>)

Original publisher: [Read original article](<https://clojure.org/news/2024/02/08/1-12-alpha7>)

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

Content type: release

Language: en

Sources: [Clojure News](<https://devfeed.tech/sources/clojure-news.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [deprecated](<https://devfeed.tech/topics/deprecated.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [change](<https://devfeed.tech/tags/change.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [exception](<https://devfeed.tech/tags/exception.md>), [patch](<https://devfeed.tech/tags/patch.md>), [programming](<https://devfeed.tech/tags/programming.md>), [release](<https://devfeed.tech/tags/release.md>)

### AI overview

Clojure 1.12.0-alpha7 is available and reverts a patch from alpha6 that changed the exception type. The release also replaces calls to a deprecated URL constructor.

### Source excerpt

Clojure 1.12.0-alpha7 is now available! This release reverts the following patch from alpha6 which had a change in exception type: CLJ-2783 - replace calls to deprecated URL constructor

## Objects in Kotlin

DevFeed: [Objects in Kotlin](<https://devfeed.tech/articles/objects-in-kotlin-39337.md>)

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

Published: 2023-07-17T00:01:00Z

Content type: tutorial

Language: en

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

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [object](<https://devfeed.tech/topics/object.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [object](<https://devfeed.tech/tags/object.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin tutorial explains how to create objects with object expressions and object declarations. It covers anonymous objects, inheritance and interface implementation, object scope, singleton behavior, and practical uses such as listeners and synchronization locks.

### Source excerpt

What is object expression, object declaration and companion objects, and how we use them.

## Readonly classes in PHP 8.2

DevFeed: [Readonly classes in PHP 8.2](<https://devfeed.tech/articles/readonly-classes-in-php-8-2-44257.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/readonly-classes-in-php-82>)

Author: Brent

Published: 2022-10-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [class](<https://devfeed.tech/topics/class.md>), [properties](<https://devfeed.tech/topics/properties.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Inheritance](<https://devfeed.tech/topics/inheritance.md>)

Tags: [classes](<https://devfeed.tech/tags/classes.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [php](<https://devfeed.tech/tags/php.md>), [properties](<https://devfeed.tech/tags/properties.md>)

### AI overview

An explanation of readonly classes introduced in PHP 8.2. It describes how they make all class properties readonly and reviews the rules governing writes, typing, static properties, default values, inheritance, dynamic properties, and reflection.

### Source excerpt

Read the full post on https://stitcher.io/blog/readonly-classes-in-php-82

## Misunderstanding Python Class Attributes

DevFeed: [Misunderstanding Python Class Attributes](<https://devfeed.tech/articles/misunderstanding-python-class-attributes-32235.md>)

Original publisher: [Read original article](<https://bruceeckel.com/2022/05/11/misunderstanding-python-class-attributes/>)

Author: Bruce Eckel

Published: 2022-05-11T00:00:00Z

Content type: article

Language: en

Sources: [Bruce Eckel - Computing Thoughts](<https://devfeed.tech/sources/bruce-eckel-computing-thoughts.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [arguments](<https://devfeed.tech/tags/arguments.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [code-generation](<https://devfeed.tech/tags/code-generation.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [debugger](<https://devfeed.tech/tags/debugger.md>), [django](<https://devfeed.tech/tags/django.md>), [factory](<https://devfeed.tech/tags/factory.md>), [none](<https://devfeed.tech/tags/none.md>), [object](<https://devfeed.tech/tags/object.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [python](<https://devfeed.tech/tags/python.md>), [values](<https://devfeed.tech/tags/values.md>), [variables](<https://devfeed.tech/tags/variables.md>)

### AI overview

Python class attributes are shared bindings on the class, not per-instance defaults. Attribute lookup can make one appear to be a default: an instance with no matching attribute reads the class value, but assigning to that instance creates a separate value that shadows it. Changing the class attribute then affects instances that still rely on it, while instances with their own binding remain unchanged, which can produce surprising mixed behavior. The article recommends initializing per-instance values in a constructor with default arguments or using a dataclass, which generates a constructor from the declared fields. Class attributes also serve deliberately as templates in frameworks and code-generation patterns.

### Source excerpt

I was attempting to assist on an open-source project when I was stopped short by this (names have been changed): class DataPoint: measurement1 = None measurement2 = None measurement3 = None DataPoint was later used like this: d = DataPoint() d.measurement1 = 100 d.measurement2 = 200 d.measurement3 = 300 Why give names and initialization values to class attributes, then when you make an object, immediately create and initialize instance variables with the same names as the class attributes?

## PHP 8.1: new in initializers

DevFeed: [PHP 8.1: new in initializers](<https://devfeed.tech/articles/php-8-1-new-in-initializers-44207.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-81-new-in-initializers>)

Author: Brent

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

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Parameter](<https://devfeed.tech/topics/parameter.md>), [properties](<https://devfeed.tech/topics/properties.md>), [syntax](<https://devfeed.tech/topics/syntax.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [php](<https://devfeed.tech/tags/php.md>), [php-8-1](<https://devfeed.tech/tags/php-8-1.md>), [properties](<https://devfeed.tech/tags/properties.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [validation](<https://devfeed.tech/tags/validation.md>)

### AI overview

A tutorial explaining PHP 8.1's support for new expressions in initializers, including parameter default values, attribute arguments, static variable initializers, and global constant initializers. It also covers lazy construction, limitations in class properties, and promoted properties.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-81-new-in-initializers

## PHP 8.1: readonly properties

DevFeed: [PHP 8.1: readonly properties](<https://devfeed.tech/articles/php-8-1-readonly-properties-44209.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-81-readonly-properties>)

Author: Brent

Published: 2021-09-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [properties](<https://devfeed.tech/topics/properties.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [object](<https://devfeed.tech/topics/object.md>)

Tags: [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [object](<https://devfeed.tech/tags/object.md>), [php](<https://devfeed.tech/tags/php.md>), [php-8-1](<https://devfeed.tech/tags/php-8-1.md>), [properties](<https://devfeed.tech/tags/properties.md>)

### AI overview

This tutorial explains PHP 8.1 readonly properties, including their purpose, restrictions, use with typed and promoted properties, and implications for data transfer and value objects.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-81-readonly-properties

## Effective Kotlin Item 32: Consider factory functions instead of secondary constructors

DevFeed: [Effective Kotlin Item 32: Consider factory functions instead of secondary constructors](<https://devfeed.tech/articles/effective-kotlin-item-32-consider-factory-functions-instead-of-secondary-constructors-39279.md>)

Original publisher: [Read original article](<https://kt.academy/article/ek-factory-functions>)

Published: 2021-07-25T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [function](<https://devfeed.tech/topics/function.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [object](<https://devfeed.tech/topics/object.md>), [interface](<https://devfeed.tech/topics/interface.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>)

Tags: [constructor](<https://devfeed.tech/tags/constructor.md>), [functions](<https://devfeed.tech/tags/functions.md>), [interface](<https://devfeed.tech/tags/interface.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [object](<https://devfeed.tech/tags/object.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This article explains why Kotlin factory functions are often preferable to secondary constructors for complex object creation. It covers clearer naming, avoiding constructor conflicts, returning subtype implementations behind interfaces, and allowing platform-specific or optimized implementations.

### Source excerpt

What factory functions are and why they are so important patterns for object creation.

## Smaller debug info with constructor type homing

DevFeed: [Smaller debug info with constructor type homing](<https://devfeed.tech/articles/smaller-debug-info-with-constructor-type-homing-43079.md>)

Original publisher: [Read original article](<https://blog.llvm.org/posts/2021-04-05-constructor-homing-for-debug-info/>)

Author: Amy Huang

Published: 2021-04-05T00:00:00Z

Content type: article

Language: en

Sources: [LLVM Project](<https://devfeed.tech/sources/the-llvm-project-blog.md>)

Topics: [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [clang](<https://devfeed.tech/topics/clang.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [class](<https://devfeed.tech/topics/class.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [clang](<https://devfeed.tech/tags/clang.md>), [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [debug](<https://devfeed.tech/tags/debug.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [optimization](<https://devfeed.tech/tags/optimization.md>)

### AI overview

This article explains constructor type homing, a Clang optimization that reduces C++ debug information by emitting class type information where constructor definitions are emitted instead of in every compilation unit. It also describes the classes to which the optimization does not apply and how it can be enabled.

### Source excerpt

Constructor type homing for debug infoBackground Class type information is a large contributor to debug info size. Clang already has a few optimizations to reduce the size of class type information based on the assumption that debug info can be spread out over multiple compilation units. So, instead of emitting class type info in every compilation unit that references a class, we only really have to emit it in one place. (For all the other references, emitting the much smaller forward declaration of the class is sufficient.) As an example, one of the existing optimizations is vtable homing, where the type info for a dynamic C++ class is only emitted when its vtable is emitted. Constructor type homing Constructor homing is a similar optimization that applies to almost all classes with constructors. It emits type information for a class wherever its constructor definition is emitted. Unlike with vtable homing, the type info for a class could be emitted more than once, but it has a large impact on debug info because it applies to a large percentage of classes. If all of a class's constructors are defined out of line, the class type information will only be emitted once. If there are constructors defined inline, the inline constructors, and therefore class type information, will be emitted in every compilation unit that calls a constructor. Constructor homing assumes that if a user wants a class to have debug info, then that class was constructed somewhere in the program. This is a reasonable assumption to make, as classes viewed in the debugger probably exist in program memory, and any class that exists in memory must have been constructed. Even though all classes have constructors, there are some types of classes that constructor homing doesn't apply to: trivial classes, aggregate classes, and classes with constexpr constructors. It's possible to create instances of these classes without emitting a constructor, so we can't guarantee that the debug info will be emitted

## An opinionated guide on how to make your Kotlin code fun to read and joy to work with

DevFeed: [An opinionated guide on how to make your Kotlin code fun to read and joy to work with](<https://devfeed.tech/articles/an-opinionated-guide-on-how-to-make-your-kotlin-code-fun-to-read-and-joy-to-work-with-25931.md>)

Original publisher: [Read original article](<https://proandroiddev.com/an-opinionated-guide-on-how-to-make-your-kotlin-code-fun-to-read-and-joy-to-work-with-caa3a4036f9e?source=rss-7a8d96da8cb6------2>)

Author: Gabor Varadi

Published: 2021-02-15T06:16:05Z

Content type: tutorial

Language: en

Sources: [Gabor Varadi](<https://devfeed.tech/sources/stories-by-gabor-varadi-on-medium.md>)

Topics: [Code quality](<https://devfeed.tech/topics/code-quality.md>), [scope function](<https://devfeed.tech/topics/scope-function.md>), [Safe-Call Operator](<https://devfeed.tech/topics/safe-call-operator.md>), [conditionals](<https://devfeed.tech/topics/conditionals.md>), [if statement](<https://devfeed.tech/topics/if-statement.md>), [code beautification](<https://devfeed.tech/topics/code-beautification.md>), [pretty printing](<https://devfeed.tech/topics/pretty-printing.md>), [smart cast](<https://devfeed.tech/topics/smart-cast.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [code-style](<https://devfeed.tech/tags/code-style.md>), [guide](<https://devfeed.tech/tags/guide.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [style](<https://devfeed.tech/tags/style.md>)

### AI overview

The guide favors Kotlin code whose intent and types stay easy to read as code evolves. Put constructor properties on separate lines when there are multiple arguments, use named lambda parameters in multi-line or chained expressions, and name multiple callback lambdas. Reserve `let` for simple assignments or returns; avoid using it as general control flow or replacing `if`/`else` with `x?.let {} ?: run {}`. Prefer early returns with the Elvis operator when there is no alternate branch, explicit return types on public non-override functions, `val` where mutation is unnecessary, and non-null parameters when null is not meaningful. Use named data classes rather than positional decomposition or tuple return types when fields carry distinct meanings. The author also recommends read-only `List` types instead of exposing mutable list types, built-in collection operations instead of equivalent loops, and choosing function types, `fun interface`, or regular interfaces according to whether callbacks need a name or multiple methods. These are presented as style recommendations, with some preferences explicitly personal or situational.

### Source excerpt

I've been meaning to write this article in a while. Hopefully, the following tips and style recommendations (in no particular order) will help you write better Kotlin! Let's get on with it, shall we? For 2 or more constructor arguments, prefer not to keep the properties on the same line as the class name in the constructor definitionclass MyClass( val a: A, val b: B, ): MyParentClass(a, b), MyInterface { // ... } This format is preferable, because when adding the 3rd argument, important bits (such as a possible base class or interface) can appear too far on the right side of the screen. Listing them one after the other (including the trailing comma since 1.4.21+) allows for better readability and extensibility (reducing the chance of causing merge conflicts with future code changes, for example). Prefer to use the scoping function 'let' only in assignments or return statements, but NOT as general control flow, or a "quick rename to 'it'" Oftentimes, Kotlin code tends to do something like this: fun myMethod(nullableA: A?) { nullableA?.let { // no it.x() // no it.y() // no it.z() // no } } (Note: in a method like this, A? could be replaced with A to take advantage of typed nullability, this is just an example.) To allow better maintainability and readability, we should instead prefer to only use ?.let { in simple assignments, or return statements, but not as general control flow. For example, the following chain is easy to understand: val protoClass = savedInstanceState?.getByteArray("protoValue") ?.let { ProtoClass.parseFrom(it) } However, in this case, ?.let { is part of an assignment. Also, while ?.let { can be chained with a ?: to provide a default value (especially in combination with takeIf) it shouldn't be used to execute side-effects (also is more suitable for that). In fact, it needs to be said: x?.let {} ?: run {} is NOT a general purpose replacement for if-else statements and null-checks, and should never be used in this particular format for that purpose!

## PHP 8: before and after

DevFeed: [PHP 8: before and after](<https://devfeed.tech/articles/php-8-before-and-after-44198.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-8-before-and-after>)

Author: Brent

Published: 2020-07-20T00:00:00Z

Content type: comparison

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [enum](<https://devfeed.tech/topics/enum.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [union types](<https://devfeed.tech/topics/union-types.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [enums](<https://devfeed.tech/tags/enums.md>), [php](<https://devfeed.tech/tags/php.md>), [programming](<https://devfeed.tech/tags/programming.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [type-system](<https://devfeed.tech/tags/type-system.md>)

### AI overview

A comparison of PHP 8 and PHP 7.4 features, focusing on their practical effects on everyday code. It covers attributes for event listener configuration, static return types, constructor property promotion, named arguments, enums, and the match expression.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-8-before-and-after

## PHP 8: Constructor property promotion

DevFeed: [PHP 8: Constructor property promotion](<https://devfeed.tech/articles/php-8-constructor-property-promotion-44107.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/constructor-promotion-in-php-8>)

Author: Brent

Published: 2020-06-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [constructor](<https://devfeed.tech/topics/constructor.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [class](<https://devfeed.tech/topics/class.md>)

Tags: [boilerplate](<https://devfeed.tech/tags/boilerplate.md>), [code](<https://devfeed.tech/tags/code.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [php](<https://devfeed.tech/tags/php.md>), [programming](<https://devfeed.tech/tags/programming.md>), [property](<https://devfeed.tech/tags/property.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

This tutorial explains PHP 8 constructor property promotion, a syntax that combines class fields, constructor definitions, and variable assignments to reduce boilerplate when creating simple objects such as value objects and data transfer objects. It also discusses constraints and usage details, including constructor-only use, duplicate property names, typing, default values, mixing promoted and normal properties, and access from the constructor body.

### Source excerpt

Read the full post on https://stitcher.io/blog/constructor-promotion-in-php-8

## Refactoring to remove passthrough variables

DevFeed: [Refactoring to remove passthrough variables](<https://devfeed.tech/articles/refactoring-to-remove-passthrough-variables-52550.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/refactoring-to-remove-passthrough-variables/>)

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

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [class](<https://devfeed.tech/topics/class.md>), [constructor](<https://devfeed.tech/topics/constructor.md>)

Tags: [passthrough](<https://devfeed.tech/tags/passthrough.md>), [react](<https://devfeed.tech/tags/react.md>), [refactoring](<https://devfeed.tech/tags/refactoring.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

A passthrough variable travels through methods or classes before reaching the place that uses it. In the Puppeteer example, BrowserContext created a TaskQueue and passed it through Target to Page, although only Page needed it. Moving creation to Page removed the unnecessary instance variables and constructor arguments, reduced code, and limited which classes needed to know about TaskQueue. The author recommends this when the value can be created where it is used. Passthrough variables can still be the clearer choice when creation is constrained: alternatives such as global state or React Context add indirection, so the tradeoff depends on the case.

### Source excerpt

I've been working recently on Puppeteer and migrating it to TypeScript. This has presented the opportunity to do some refactoring and today I want to share a recent refactoring I did to remove passthrough variables. What is a passthrough variable? A passthrough variable is a variable that gets passed through multiple method calls before it gets given to the actual place in which it's used. Normally these happen either because: the object that needs the data is unable to create it the object that creates the data (in the above example, A), used to need it, but now doesn't due to a change in functionality or behaviour. Whilst we're not specifically talking about React in this post, you see this happen a lot with React props. This is known as "prop drilling" and is also something you should be wary of. Dealing with passthrough variables It's important to note that passthrough variables are not always avoidable, and often they are the preferred solution. The fix for passthrough variables can be simple - moving the creation of the value to the place where it's needed is the easiest fix - but if you're constrained often the explicitness of passthrough variables is preferable to any other solution. Whilst it makes you jump through a hoop or two, the below code is explicit and does tell the full story about what's happening: class A { constructor() { this.value = new SomeValue() this.b = new B(this.value) } } class B { constructor(value) { this.c = new C(value) } } class C { // somewhere in C we use the value } It's definitely not the nicest code you've ever seen but it can be methodically followed. Any solution that creates a method for C to access the variable without the explicitness of passing the values through will introduce some indirection for a developer to follow. For example, if you chose to put the value on the global scope (I do not recommend this, but it's a useful example!), you have to figure where that value comes from: class C { doSomething() { // woah, wh

## Time Travel with JVM

DevFeed: [Time Travel with JVM](<https://devfeed.tech/articles/time-travel-with-jvm-24838.md>)

Original publisher: [Read original article](<https://alidg.me/blog/2020/2/23/time-travel-jvm>)

Author: Alimate

Published: 2020-02-23T00:00:00Z

Content type: article

Language: en

Sources: [Ali Dehghan - Kemikit](<https://devfeed.tech/sources/ali-dehghan-kemikit.md>)

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

Tags: [bytecode](<https://devfeed.tech/tags/bytecode.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [object](<https://devfeed.tech/tags/object.md>)

### AI overview

The excerpt describes allocating a Java object without running its constructor. Normal `new` allocation first gives fields default values, then runs instance initializers and constructors; the example's constructor replaces a default value with the current epoch time. The described alternative bypasses the constructor, leaving the object with default-initialized fields. The excerpt warns that compiling code using this mechanism may produce a warning and advises staying away from it. Code and class names are omitted from the supplied text.

### Source excerpt

Let's allocate a Java object without calling its constructor!

[Next page](<https://devfeed.tech/topics/constructor.md?cursor=WyIyMDIwLTAyLTIzVDAwOjAwOjAwKzAwOjAwIiwgIjZiYTY0OWYwLTlmNDItNDgwZC05MDZkLWRhMTk1MDY1OTI4MSJd>)