Return to search

Generic programming in Scala

Generic programming is a programming methodology that aims at producing
reusable code, defined independently of the data types on which it is operating. To
achieve this goal, that particular code must rely on a set of requirements known
as concepts. The code is only functional for the set of data types that fulfill the
conditions established by its concepts. Generic programming can facilitate code reuse
and reduce testing.
Generic programming has been embraced mostly in the C++ community; major
parts of the C++ standard library have been developed following the paradigm. This
thesis is based on a study (by Garcia et al.) on generic programming applied to other
languages (C#, Eiffel, Haskell, Java and ML). That study demonstrated that those
languages are lacking in their support for generic programming, causing diffculties
to the programmer.
In this context, we investigate the new object-oriented language Scala. This
particular language appealed to our interest because it implements "member types"
which we conjecture to fix some of the problems of the languages surveyed in the
original study. Our research shows that Scala's member types are an expressive
language feature and solve some but not all of the problems identified in the original
study (by Garcia et al.).
Scala's members types did not resolve the problem of adding associated types to
the parameter list of generic methods. This issue led to repeated constraints, implicit instantiation failure and code verbosity increase. However, Scala's member types
enabled constraint propagation and type aliasing, two significantly useful generic
programming mechanisms.

Identiferoai:union.ndltd.org:tamu.edu/oai:repository.tamu.edu:1969.1/5008
Date25 April 2007
CreatorsN'guessan, Olayinka
ContributorsJarvi, Jaakko
PublisherTexas A&M University
Source SetsTexas A and M University
Languageen_US
Detected LanguageEnglish
TypeBook, Thesis, Electronic Thesis, text
Format259195 bytes, electronic, application/pdf, born digital

Page generated in 0.0019 seconds