SlideShare a Scribd company logo
a first look at
Strings in Pharo
Damien Pollet — Inria Lille
International Workshop on Smalltalk Technology — ESUG 2015, Brescia
A First Analysis of String APIs:
the Case of Pharo
Damien Pollet Stéphane Ducasse
RMoD — Inria & Université Lille 1
damien.pollet@inria.fr
Abstract
Most programming languages natively provide an abstraction
of character strings. However, it is difficult to assess the de-
sign or the API of a string library. There is no comprehensive
analysis of the needed operations and their different varia-
tions. There are no real guidelines about the different forces
in presence and how they structure the design space of string
manipulation. In this article, we harvest and structure a set of
criteria to describe a string API. We propose an analysis of
the Pharo 4 String library as a first experience on the topic.
Keywords Strings, API, Library, Design, Style
case of strings, however, these characteristics are particularly
hard to reach, due to the following design constraints.
For a single data type, strings tend to have a large API:
in Ruby, the String class provides more than 100 methods,
in Java more than 60, and Python’s str around 40. In Pharo1
,
the String class alone understands 319 distinct messages, not
counting inherited methods. While a large API is not al-
ways a problem per se, it shows that strings have many use
cases, from concatenation and printing to search-and-replace,
parsing, natural or domain-specific languages. Unfortunately,
strings are often abused to eschew proper modeling of struc-
tured data, resulting in inadequate serialized representations
?Using strings feels

T E D I O U S…
Why?
Not enough methods, maybe?
Objective C
Java
Ruby
Python
Haskell
Pharo 319
4
40
100
60
85
Concatenation
Objective C [@"Hello" stringByAppendingString: @"_world"]
Java "Hello" + "_world"
Ruby "Hello" + "_world"
Pharo 'Hello' , '_world'
Objective C…
stringByAddingPercentEncodingWithAllowedCharacters:
(yes, this is a single-keyword message)
amicallyTypedObjectOrientedProgrammingLanguage
just to pick on
Extraction
Objective C [@"abcdef" substringWithRange: NSMakeRange(2, 4)]
Java "abcdef".substring(2, 4)
Ruby "abcdef"[2, 4]
Pharo 'abcdef' copyFrom: 3 to: 5
http://www.confidentruby.com
?well, aren't strings just…
objects?
strings
domain

objects
parsing
serialization
?well, aren't strings just…
collections?
Feature overlap
Locating & Extracting
what: characters, substrings?
how: index, range, pattern?
Splitting & Merging
separator?
Substituting
one occurrence, or all?
eagerly or lazily?



Testing & Matching
Converting
to other strings
to other types
Iterating
byte ≠ codepoint ≠ character
More than indices
Ruby's indexing operator (square brackets):
my_string
[index]
[from, length]
[from..to]
[/reg(exp)+/]
[-index]
['substring']
Idioms
that I expected to find in…
Layers of convenience
trimLeft:right:
trimBoth:
trimLeft: trimRight:
trimBoth
trimLeft trimRight
trim, trimmed
canonical: both sides explicit
one explicit predicate block,
one implicit (same or no trim)
both sides implicit
(trim whitespace)
concise, fluent name
canonical (both sides specified)
one side specified
both sides implicit
concise name




QUIZZ!



what's the difference?
Sentinel values
Sentinel index
zero?

length + 1
Depends on use-case…
raise exception, return null object, maybe?
Pluggable sentinel case
indexOf:aCharacter startingAt:index ifAbsent: aBlock
Smells
Imperative style
indices everywhere — copyReplaceFrom:to:with:
Ad-hoc behavior
stemAndNumericSuffix — endsWithDigit
Redundancies
findAnySubStr:startingAt: — findDelimiters:startingAt:
Conversion
asSymbol, asInteger, asDate — asLowercase, asHTMLString
Mutability
Let's talk about literals:
Where to go from here?
Idioms more general than strings
how to document & ensure completeness?

lint rules? pragmas? method protocols? —if only they worked like tags…
Improving composability
indices everywhere! imperative style!

iterators, transducers? — rethink collections as well?
Mutability vs sharing
slices / views, ropes
A First Analysis of String APIs:
the Case of Pharo
Damien Pollet Stéphane Ducasse
RMoD — Inria & Université Lille 1
damien.pollet@inria.fr
Abstract
Most programming languages natively provide an abstraction
of character strings. However, it is difficult to assess the de-
sign or the API of a string library. There is no comprehensive
analysis of the needed operations and their different varia-
tions. There are no real guidelines about the different forces
in presence and how they structure the design space of string
manipulation. In this article, we harvest and structure a set of
criteria to describe a string API. We propose an analysis of
the Pharo 4 String library as a first experience on the topic.
case of strings, however, these characteristics are particularly
hard to reach, due to the following design constraints.
For a single data type, strings tend to have a large API:
in Ruby, the String class provides more than 100 methods,
in Java more than 60, and Python’s str around 40. In Pharo1
,
the String class alone understands 319 distinct messages, not
counting inherited methods. While a large API is not al-
ways a problem per se, it shows that strings have many use
cases, from concatenation and printing to search-and-replace,
parsing, natural or domain-specific languages. Unfortunately,
strings are often abused to eschew proper modeling of struc-
READ ME!

More Related Content

What's hot

SPARQL Query Verbalization for Explaining Semantic Search Engine Queries
SPARQL Query Verbalization for Explaining Semantic Search Engine QueriesSPARQL Query Verbalization for Explaining Semantic Search Engine Queries
SPARQL Query Verbalization for Explaining Semantic Search Engine Queries
Basil Ell
 
Encoding and Designing for the Swift Poems Project
Encoding and Designing for the Swift Poems ProjectEncoding and Designing for the Swift Poems Project
Encoding and Designing for the Swift Poems Project
James Griffin
 
Delving (Smalltalk) Source Code
Delving (Smalltalk) Source CodeDelving (Smalltalk) Source Code
Delving (Smalltalk) Source Code
ESUG
 
Lecture 04 syntax analysis
Lecture 04 syntax analysisLecture 04 syntax analysis
Lecture 04 syntax analysis
Iffat Anjum
 
Ontology engineering
Ontology engineering Ontology engineering
Ontology engineering
Aliabbas Petiwala
 
Ontology languages and OWL
Ontology languages and OWLOntology languages and OWL
Ontology languages and OWL
Fulvio Corno
 
Requirements Engineering: focus on Natural Language Processing, Lecture 2
Requirements Engineering: focus on Natural Language Processing, Lecture 2Requirements Engineering: focus on Natural Language Processing, Lecture 2
Requirements Engineering: focus on Natural Language Processing, Lecture 2
alessio_ferrari
 
Unit1 pps
Unit1 ppsUnit1 pps
Unit1 pps
deeparengade31
 
Introduction of Python
Introduction of PythonIntroduction of Python
Introduction of Python
ZENUS INFOTECH INDIA PVT. LTD.
 
Compier Design_Unit I_SRM.ppt
Compier Design_Unit I_SRM.pptCompier Design_Unit I_SRM.ppt
Compier Design_Unit I_SRM.ppt
Apoorv Diwan
 
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Joxean Koret
 
LREC 2010 presentation
LREC 2010 presentationLREC 2010 presentation
LREC 2010 presentation
Stefania Spina
 

What's hot (12)

SPARQL Query Verbalization for Explaining Semantic Search Engine Queries
SPARQL Query Verbalization for Explaining Semantic Search Engine QueriesSPARQL Query Verbalization for Explaining Semantic Search Engine Queries
SPARQL Query Verbalization for Explaining Semantic Search Engine Queries
 
Encoding and Designing for the Swift Poems Project
Encoding and Designing for the Swift Poems ProjectEncoding and Designing for the Swift Poems Project
Encoding and Designing for the Swift Poems Project
 
Delving (Smalltalk) Source Code
Delving (Smalltalk) Source CodeDelving (Smalltalk) Source Code
Delving (Smalltalk) Source Code
 
Lecture 04 syntax analysis
Lecture 04 syntax analysisLecture 04 syntax analysis
Lecture 04 syntax analysis
 
Ontology engineering
Ontology engineering Ontology engineering
Ontology engineering
 
Ontology languages and OWL
Ontology languages and OWLOntology languages and OWL
Ontology languages and OWL
 
Requirements Engineering: focus on Natural Language Processing, Lecture 2
Requirements Engineering: focus on Natural Language Processing, Lecture 2Requirements Engineering: focus on Natural Language Processing, Lecture 2
Requirements Engineering: focus on Natural Language Processing, Lecture 2
 
Unit1 pps
Unit1 ppsUnit1 pps
Unit1 pps
 
Introduction of Python
Introduction of PythonIntroduction of Python
Introduction of Python
 
Compier Design_Unit I_SRM.ppt
Compier Design_Unit I_SRM.pptCompier Design_Unit I_SRM.ppt
Compier Design_Unit I_SRM.ppt
 
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
Pigaios: A Tool for Diffing Source Codes against Binaries (Hacktivity 2018)
 
LREC 2010 presentation
LREC 2010 presentationLREC 2010 presentation
LREC 2010 presentation
 

Viewers also liked

SciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilitySciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with Agility
ESUG
 
Garage RDBMS
Garage RDBMSGarage RDBMS
Garage RDBMS
ESUG
 
Toward a Platform for Visual Debugging
Toward a Platform for Visual DebuggingToward a Platform for Visual Debugging
Toward a Platform for Visual Debugging
ESUG
 
[TUTORIAL] PetitParser
[TUTORIAL] PetitParser[TUTORIAL] PetitParser
[TUTORIAL] PetitParser
ESUG
 
Bloc: a Modern Core for Highly Dynamic Graphics
Bloc: a Modern Core for Highly Dynamic Graphics Bloc: a Modern Core for Highly Dynamic Graphics
Bloc: a Modern Core for Highly Dynamic Graphics
ESUG
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
Nikolay Vasilev
 
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web DevelopmentMocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
ESUG
 
The Glamorous Toolkit: Towards a novel live IDE
The Glamorous Toolkit: Towards a novel live IDEThe Glamorous Toolkit: Towards a novel live IDE
The Glamorous Toolkit: Towards a novel live IDE
ESUG
 
A tour on Spur for non-VM experts
A tour on Spur for non-VM expertsA tour on Spur for non-VM experts
A tour on Spur for non-VM experts
ESUG
 
MVC Revivial on the Web
MVC Revivial on the WebMVC Revivial on the Web
MVC Revivial on the Web
ESUG
 
The Cog VM evolution
The Cog VM evolutionThe Cog VM evolution
The Cog VM evolution
ESUG
 
Pragmas: Literal Messages as Powerful Method Annotations
Pragmas: Literal Messages as Powerful Method AnnotationsPragmas: Literal Messages as Powerful Method Annotations
Pragmas: Literal Messages as Powerful Method Annotations
ESUG
 

Viewers also liked (12)

SciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilitySciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with Agility
 
Garage RDBMS
Garage RDBMSGarage RDBMS
Garage RDBMS
 
Toward a Platform for Visual Debugging
Toward a Platform for Visual DebuggingToward a Platform for Visual Debugging
Toward a Platform for Visual Debugging
 
[TUTORIAL] PetitParser
[TUTORIAL] PetitParser[TUTORIAL] PetitParser
[TUTORIAL] PetitParser
 
Bloc: a Modern Core for Highly Dynamic Graphics
Bloc: a Modern Core for Highly Dynamic Graphics Bloc: a Modern Core for Highly Dynamic Graphics
Bloc: a Modern Core for Highly Dynamic Graphics
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web DevelopmentMocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
 
The Glamorous Toolkit: Towards a novel live IDE
The Glamorous Toolkit: Towards a novel live IDEThe Glamorous Toolkit: Towards a novel live IDE
The Glamorous Toolkit: Towards a novel live IDE
 
A tour on Spur for non-VM experts
A tour on Spur for non-VM expertsA tour on Spur for non-VM experts
A tour on Spur for non-VM experts
 
MVC Revivial on the Web
MVC Revivial on the WebMVC Revivial on the Web
MVC Revivial on the Web
 
The Cog VM evolution
The Cog VM evolutionThe Cog VM evolution
The Cog VM evolution
 
Pragmas: Literal Messages as Powerful Method Annotations
Pragmas: Literal Messages as Powerful Method AnnotationsPragmas: Literal Messages as Powerful Method Annotations
Pragmas: Literal Messages as Powerful Method Annotations
 

Similar to A First Analysis of String APIs: the Case of Pharo

Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
Jim Jones
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
webuploader
 
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Coen De Roover
 
Summer Training Project On Python Programming
Summer Training Project On Python ProgrammingSummer Training Project On Python Programming
Summer Training Project On Python Programming
KAUSHAL KUMAR JHA
 
Java basics
Java basicsJava basics
Java basics
Jitender Jain
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
ansariparveen06
 
Perl Reference.ppt
Perl Reference.pptPerl Reference.ppt
Perl Reference.ppt
AshleshaKulkarni4
 
Diving into Functional Programming
Diving into Functional ProgrammingDiving into Functional Programming
Diving into Functional Programming
Lev Walkin
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET Framework
Adriana Ivanciu
 
Лев Валкин — Программируем функционально
Лев Валкин — Программируем функциональноЛев Валкин — Программируем функционально
Лев Валкин — Программируем функционально
Daria Oreshkina
 
.Net and Rdf APIs
.Net and Rdf APIs.Net and Rdf APIs
.Net and Rdf APIs
Recean Denis
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Synesso
 
Stringing Things Along
Stringing Things AlongStringing Things Along
Stringing Things Along
Kevlin Henney
 
F# Intro for Scala Developers
F# Intro for Scala DevelopersF# Intro for Scala Developers
F# Intro for Scala Developers
fsug
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
tswr
 
Avro
AvroAvro
A Comparison Between Python APIs For RDF Processing
A Comparison Between Python APIs For RDF ProcessingA Comparison Between Python APIs For RDF Processing
A Comparison Between Python APIs For RDF Processing
lucianb
 
Ruby
RubyRuby
220 runtime environments
220 runtime environments220 runtime environments
220 runtime environments
J'tong Atong
 
Dealing with Markup Semantics
Dealing with Markup SemanticsDealing with Markup Semantics
Dealing with Markup Semantics
University of Bologna
 

Similar to A First Analysis of String APIs: the Case of Pharo (20)

Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
 
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
 
Summer Training Project On Python Programming
Summer Training Project On Python ProgrammingSummer Training Project On Python Programming
Summer Training Project On Python Programming
 
Java basics
Java basicsJava basics
Java basics
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Perl Reference.ppt
Perl Reference.pptPerl Reference.ppt
Perl Reference.ppt
 
Diving into Functional Programming
Diving into Functional ProgrammingDiving into Functional Programming
Diving into Functional Programming
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET Framework
 
Лев Валкин — Программируем функционально
Лев Валкин — Программируем функциональноЛев Валкин — Программируем функционально
Лев Валкин — Программируем функционально
 
.Net and Rdf APIs
.Net and Rdf APIs.Net and Rdf APIs
.Net and Rdf APIs
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Stringing Things Along
Stringing Things AlongStringing Things Along
Stringing Things Along
 
F# Intro for Scala Developers
F# Intro for Scala DevelopersF# Intro for Scala Developers
F# Intro for Scala Developers
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Avro
AvroAvro
Avro
 
A Comparison Between Python APIs For RDF Processing
A Comparison Between Python APIs For RDF ProcessingA Comparison Between Python APIs For RDF Processing
A Comparison Between Python APIs For RDF Processing
 
Ruby
RubyRuby
Ruby
 
220 runtime environments
220 runtime environments220 runtime environments
220 runtime environments
 
Dealing with Markup Semantics
Dealing with Markup SemanticsDealing with Markup Semantics
Dealing with Markup Semantics
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
ESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
ESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
ESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 

Recently uploaded (20)

OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 

A First Analysis of String APIs: the Case of Pharo

  • 1. a first look at Strings in Pharo Damien Pollet — Inria Lille International Workshop on Smalltalk Technology — ESUG 2015, Brescia
  • 2. A First Analysis of String APIs: the Case of Pharo Damien Pollet Stéphane Ducasse RMoD — Inria & Université Lille 1 damien.pollet@inria.fr Abstract Most programming languages natively provide an abstraction of character strings. However, it is difficult to assess the de- sign or the API of a string library. There is no comprehensive analysis of the needed operations and their different varia- tions. There are no real guidelines about the different forces in presence and how they structure the design space of string manipulation. In this article, we harvest and structure a set of criteria to describe a string API. We propose an analysis of the Pharo 4 String library as a first experience on the topic. Keywords Strings, API, Library, Design, Style case of strings, however, these characteristics are particularly hard to reach, due to the following design constraints. For a single data type, strings tend to have a large API: in Ruby, the String class provides more than 100 methods, in Java more than 60, and Python’s str around 40. In Pharo1 , the String class alone understands 319 distinct messages, not counting inherited methods. While a large API is not al- ways a problem per se, it shows that strings have many use cases, from concatenation and printing to search-and-replace, parsing, natural or domain-specific languages. Unfortunately, strings are often abused to eschew proper modeling of struc- tured data, resulting in inadequate serialized representations
  • 4. Not enough methods, maybe? Objective C Java Ruby Python Haskell Pharo 319 4 40 100 60 85
  • 5. Concatenation Objective C [@"Hello" stringByAppendingString: @"_world"] Java "Hello" + "_world" Ruby "Hello" + "_world" Pharo 'Hello' , '_world'
  • 6. Objective C… stringByAddingPercentEncodingWithAllowedCharacters: (yes, this is a single-keyword message) amicallyTypedObjectOrientedProgrammingLanguage just to pick on
  • 7. Extraction Objective C [@"abcdef" substringWithRange: NSMakeRange(2, 4)] Java "abcdef".substring(2, 4) Ruby "abcdef"[2, 4] Pharo 'abcdef' copyFrom: 3 to: 5
  • 9. ?well, aren't strings just… objects?
  • 11. ?well, aren't strings just… collections?
  • 12. Feature overlap Locating & Extracting what: characters, substrings? how: index, range, pattern? Splitting & Merging separator? Substituting one occurrence, or all? eagerly or lazily?
 
 Testing & Matching Converting to other strings to other types Iterating byte ≠ codepoint ≠ character
  • 13. More than indices Ruby's indexing operator (square brackets): my_string [index] [from, length] [from..to] [/reg(exp)+/] [-index] ['substring']
  • 14. Idioms that I expected to find in…
  • 15. Layers of convenience trimLeft:right: trimBoth: trimLeft: trimRight: trimBoth trimLeft trimRight trim, trimmed canonical: both sides explicit one explicit predicate block, one implicit (same or no trim) both sides implicit (trim whitespace) concise, fluent name canonical (both sides specified) one side specified both sides implicit concise name 
 
 QUIZZ!
 
 what's the difference?
  • 16. Sentinel values Sentinel index zero?
 length + 1 Depends on use-case… raise exception, return null object, maybe? Pluggable sentinel case indexOf:aCharacter startingAt:index ifAbsent: aBlock
  • 17.
  • 18. Smells Imperative style indices everywhere — copyReplaceFrom:to:with: Ad-hoc behavior stemAndNumericSuffix — endsWithDigit Redundancies findAnySubStr:startingAt: — findDelimiters:startingAt: Conversion asSymbol, asInteger, asDate — asLowercase, asHTMLString
  • 20. Where to go from here? Idioms more general than strings how to document & ensure completeness?
 lint rules? pragmas? method protocols? —if only they worked like tags… Improving composability indices everywhere! imperative style!
 iterators, transducers? — rethink collections as well? Mutability vs sharing slices / views, ropes
  • 21. A First Analysis of String APIs: the Case of Pharo Damien Pollet Stéphane Ducasse RMoD — Inria & Université Lille 1 damien.pollet@inria.fr Abstract Most programming languages natively provide an abstraction of character strings. However, it is difficult to assess the de- sign or the API of a string library. There is no comprehensive analysis of the needed operations and their different varia- tions. There are no real guidelines about the different forces in presence and how they structure the design space of string manipulation. In this article, we harvest and structure a set of criteria to describe a string API. We propose an analysis of the Pharo 4 String library as a first experience on the topic. case of strings, however, these characteristics are particularly hard to reach, due to the following design constraints. For a single data type, strings tend to have a large API: in Ruby, the String class provides more than 100 methods, in Java more than 60, and Python’s str around 40. In Pharo1 , the String class alone understands 319 distinct messages, not counting inherited methods. While a large API is not al- ways a problem per se, it shows that strings have many use cases, from concatenation and printing to search-and-replace, parsing, natural or domain-specific languages. Unfortunately, strings are often abused to eschew proper modeling of struc- READ ME!