Design Pattern for Reusing Immutable Methods in Object-Oriented Languages. Flageol, W., Gu�h�neuc, Y., Badri, M., & Monnier, S. In Proceedings of the 28<sup>th</sup> European Conference on Pattern Languages of Programs (EuroPLoP), pages 1–9, July, 2023. ACM Press. 9 pages.
Paper abstract bibtex \textbfContext. Features and styles inspired by functional programming have grown in popularity in the world of object-oriented programming. Immutability is a core concept of functional programming, which brings advantages to software development. However, introducing immutability in object-oriented programming presents some challenges. \textbfProblem. One of these challenges is method overriding. When inheriting non-destructive mutators (methods used on immutable objects which return a new object instead of modifying the receiver), a naive approach generates code duplication and has scalability issues. \textbfContribution. We analyse an example of this overriding problem and propose a solution in a new design pattern based on the factory method pattern. We also discuss the advantages and limitations of this pattern, as well as implementations in Clojure, Java, and Kotlin. We also identify and discuss the language features that mostly affect the implementation of this pattern. \textbfConclusion. Our proposed design pattern helps mitigate some of the code duplication and scalability problems of a naive approach. However, the inclusion of a functional updating language feature is required to completely remove the scalability issues.
@INPROCEEDINGS{Flageol23-EuroPLoP-APsforMLS,
AUTHOR = {William Flageol and Yann-Ga�l Gu�h�neuc and Mourad Badri and
Stefan Monnier},
BOOKTITLE = {Proceedings of the 28<sup>th</sup> European Conference on Pattern Languages of Programs (EuroPLoP)},
TITLE = {Design Pattern for Reusing Immutable Methods in
Object-Oriented Languages},
YEAR = {2023},
OPTADDRESS = {},
OPTCROSSREF = {},
EDITOR = {Cesare Pautasso},
MONTH = {July},
NOTE = {9 pages.},
OPTNUMBER = {},
OPTORGANIZATION = {},
PAGES = {1--9},
PUBLISHER = {ACM Press},
OPTSERIES = {},
OPTVOLUME = {},
KEYWORDS = {Topic: <b>Design patterns</b>, Venue: <c>PLoP</c>},
URL = {http://www.ptidej.net/publications/documents/EuroPLoP23.doc.pdf},
ABSTRACT = {\textbf{Context.} Features and styles inspired by
functional programming have grown in popularity in the world of
object-oriented programming. Immutability is a core concept of
functional programming, which brings advantages to software
development. However, introducing immutability in object-oriented
programming presents some challenges. \textbf{Problem.} One of these
challenges is method overriding. When inheriting non-destructive
mutators (methods used on immutable objects which return a new object
instead of modifying the receiver), a naive approach generates code
duplication and has scalability issues. \textbf{Contribution.} We
analyse an example of this overriding problem and propose a solution
in a new design pattern based on the factory method pattern. We also
discuss the advantages and limitations of this pattern, as well as
implementations in Clojure, Java, and Kotlin. We also identify and
discuss the language features that mostly affect the implementation
of this pattern. \textbf{Conclusion.} Our proposed design pattern
helps mitigate some of the code duplication and scalability problems
of a naive approach. However, the inclusion of a functional updating
language feature is required to completely remove the scalability
issues.}
}