<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">Decomposition Without Regret (Poster)</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Weixin</forename><surname>Zhang</surname></persName>
							<email>weixin.zhang@bristol.ac.uk</email>
							<affiliation key="aff0">
								<orgName type="institution">University of Bristol</orgName>
								<address>
									<country key="GB">United Kingdom</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Cristina</forename><surname>David</surname></persName>
							<email>cristina.david@bristol.ac.uk</email>
							<affiliation key="aff0">
								<orgName type="institution">University of Bristol</orgName>
								<address>
									<country key="GB">United Kingdom</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Meng</forename><surname>Wang</surname></persName>
							<email>meng.wang@bristol.ac.uk</email>
							<affiliation key="aff0">
								<orgName type="institution">University of Bristol</orgName>
								<address>
									<country key="GB">United Kingdom</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">Decomposition Without Regret (Poster)</title>
					</analytic>
					<monogr>
						<idno type="ISSN">1613-0073</idno>
					</monogr>
					<idno type="MD5">FAC787BE144CFD3E88EA0A9B3027185D</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-24T23:24+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<textClass>
				<keywords>
					<term>Bidirectional program transformation</term>
					<term>Functional decomposition</term>
					<term>Object-oriented decomposition</term>
				</keywords>
			</textClass>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Programming languages are embracing both functional and object-oriented paradigms. A key difference between the two paradigms is the way of achieving data abstraction. That is, how to organize data with associated operations. There are essential tradeoffs between functional and object-oriented decomposition regarding extensibility and expressiveness. Unfortunately, programmers are usually forced to select a particular decomposition style in the early stage of programming. Once the wrong design decision has been made, the price for switching to the other decomposition style could be rather high since pervasive manual refactoring is often needed.</p><p>In this talk, we show a bidirectional transformation system between functional and object-oriented decomposition. We formalize the core of the system in the FOOD calculus, which captures the essence of functional and object-oriented decomposition. We prove that the transformation preserves the type and semantics of the original program. We further implement FOOD in Scala as a translation tool called Cook and conduct several case studies to demonstrate the applicability and effectiveness of Cook.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Programming languages are embracing multiple paradigms, in particular functional and object-oriented paradigms. Modern languages are designed to support multi-paradigms. Wellknown examples include OCaml, Swift, Rust, TypeScript, Scala, F#, and Kotlin. Meanwhile, mainstream object-oriented languages such as C++ and Java are gradually extended to support functional paradigms. When multiple paradigms are available within one programming language, a natural question arises: which paradigm to choose when designing programs?</p><p>A fundamental difference between functional and object-oriented paradigms is the way of achieving data abstraction <ref type="bibr" target="#b0">[1,</ref><ref type="bibr" target="#b1">2]</ref>. That is, how to organize data with associated operations. If we view a program as a matrix, data variants and operations are then the rows and columns of that matrix respectively. Object-oriented programming decomposes the program by row and is operation first: we first declare an interface that describes the operations supported by the data and then implement that interface with some classes. Conversely, functional programming decomposes the program by column and is data first: we first represent the data using an algebraic datatype and then define operations by pattern matching on that algebraic datatype.</p><p>There are important tradeoffs between functional and object-oriented decompositions in terms of extensibility and expressiveness. As acknowledged by the notorious Expression Problem <ref type="bibr" target="#b0">[1,</ref><ref type="bibr" target="#b2">3,</ref><ref type="bibr" target="#b3">4]</ref>, these two decomposition styles are complementary in terms of extensibility. Object-oriented decomposition makes it easy to extend data variants through defining new classes. On the other hand, functional decomposition makes it easy to add new operations on expressions. Besides extensibility, object-oriented and functional decomposition have different expressive power. Object-oriented decomposition facilitates code reuse through inheritance and enables interoperability between different implementations of the same interface whereas functional decomposition allows inspection on the internal representation of data through (nested) pattern matching, simplifying abstract syntax tree transformations.</p><p>Unfortunately, programmers are forced to decide a decomposition style in the early stage of programming. A proper choice, however, requires predictions on the extensibility dimension and kinds of operations to model, which may not be feasible in practice. Once the wrong design decision was made, the price for switching to the other decomposition style could be rather high since pervasive manual refactoring is often needed.</p><p>A better way, however, allows programmers to choose a decomposition style for prototyping without regret. When the design choice becomes inappropriate, a tool automatically transforms their code into another style without affecting the semantics. Even at later stages, such a automatic translation tool could be used to make extensions of data variants or operations easier by momentarily switching the decomposition, adding the extension, and then transforming the program back to the original decomposition. Furthermore, studying the transformation between the two styles can provide a theoretical foundation for compiling multi-paradigm languages into single-paradigm ones. From an educational perspective, the tool can help novice programmers to understand both decomposition styles better.</p><p>To address this issue, we propose a bidirectional transformation between functional and object-oriented decomposition based on the observation that restricted forms of functional and object-oriented decomposition are symmetric. We formalize an automatic, type-directed transformation in the core calculus FOOD, which captures the essence of Functional and Object-Oriented Decomposition. We prove that the transformation preserves the type and semantics of the original program. We further implement FOOD in Scala as a translation tool called Cook and conduct several case studies to demonstrate the applicability of Cook. Interested readers may want to consult the full paper for more details <ref type="bibr" target="#b4">[5]</ref>.</p></div>		</body>
		<back>
			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">User defined types and procedural data structures as complementary approaches to data abstraction</title>
		<author>
			<persName><forename type="first">J</forename><forename type="middle">C</forename><surname>Reynolds</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Programming Methodology, A Collection of Articles by IFIP WG2</title>
				<editor>
			<persName><forename type="first">S</forename><forename type="middle">A</forename><surname>Reprinted</surname></persName>
		</editor>
		<editor>
			<persName><surname>Schuman</surname></persName>
		</editor>
		<meeting><address><addrLine>New York</addrLine></address></meeting>
		<imprint>
			<publisher>Rocquencourt</publisher>
			<date type="published" when="1975">1978. 1975</date>
			<biblScope unit="volume">3</biblScope>
			<biblScope unit="page" from="157" to="168" />
		</imprint>
	</monogr>
	<note>New Advances in Algorithmic Languages 1975. Also in taoop</note>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">On Understanding Data Abstraction, Revisited</title>
		<author>
			<persName><forename type="first">W</forename><forename type="middle">R</forename><surname>Cook</surname></persName>
		</author>
		<idno type="DOI">10.1145/1639949.1640133</idno>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 24th ACM SIGPLAN Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA &apos;09</title>
				<meeting>the 24th ACM SIGPLAN Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA &apos;09</meeting>
		<imprint>
			<date type="published" when="2009">2009</date>
			<biblScope unit="page" from="557" to="572" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">Object-oriented programming versus abstract data types</title>
		<author>
			<persName><forename type="first">W</forename><forename type="middle">R</forename><surname>Cook</surname></persName>
		</author>
		<idno type="DOI">10.1007/BFb0019443</idno>
	</analytic>
	<monogr>
		<title level="m">Foundations of Object-Oriented Languages</title>
				<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="1991">1991</date>
			<biblScope unit="page" from="151" to="178" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">The Expression Problem</title>
		<author>
			<persName><forename type="first">P</forename><surname>Wadler</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Note to Java Genericity mailing list</title>
				<imprint>
			<date type="published" when="1998">1998</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<monogr>
		<title level="m" type="main">Decomposition without regret</title>
		<author>
			<persName><forename type="first">W</forename><surname>Zhang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">C</forename><surname>David</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Wang</surname></persName>
		</author>
		<idno type="DOI">10.48550/ARXIV.2204.10411</idno>
		<ptr target="https://arxiv.org/abs/2204.10411.doi:10.48550/ARXIV.2204.10411" />
		<imprint>
			<date type="published" when="2022">2022</date>
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
