MessiandNeymar

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, December 27, 2012

Scalable Component Abstractions

Posted on 9:04 AM by Unknown

The German computer scientist Martin Odersky is world-famous for his work in programming language theory.

Recently, he has become particularly famous for the invention of the programming language Scala.

At this point, Scala has matured significantly; there is a lot of documentation, and plenty of books, examples, etc.

But for the underlying theory behind Scala, it is valuable to go back to some of Odersky's original papers, including this one by Odersky and Zenger in 2005: Scalable Component Abstractions.

We identify three programming language abstractions for the construction of re-usable components: abstract type members, explicit selftypes and symmetric mixin composition. Together, these abstractions enable us to transform an arbitrary assembly of static program parts with hard references between them into a system of re-usable components.

Designing a programming language that successfully provides for reusable components is one of the holy grails of computing; theorists have been working on this for decades, slowly making progress. Reusable components, if implemented well, enable large teams of people to work together on the construction of large systems.

Scalable Component Abstractions describes the theoretical underpinnings of Scala's approach to componentization. Papers in programming language theory can often be dense and abstract, but Scalable Component Abstractions is clearly written with well-chosen examples.

More importantly, after developing the theory of abstract type members, explicit selftypes and symmetric mixin composition, they demonstrate how these tools were successfully used in a real system; for example, they modify the existing Scala compiler to add trace-logging functionality:

The crucial point is that we want to extend an existing compiler with logging functionality. To do this, we do not want to modify the compiler’s source code. Neither do we want to require of the compiler writer to have pre-planned the logging extension by providing hooks. Such hooks tend to impair the clarity of the code since they mix separate concerns in one class. Instead, we use subclassing to add logging functionality to existing classes.

As they observe, it is interesting to compare this to one of the major alternate techniques for solving this problem, Aspect-Oriented Programming:

our architecture can handle all before, after, and around advice on method reception pointcut designators. These represent only one instance of the pointcut designators provided by languages such as AspectJ. Therefore,general AOP is clearly more powerful than our scheme. On the other hand, our scheme has the advantage that it is statically typed, and that scope and order of advice can be precisely controlled using the semantics of mixin composition.

I've tried AOP a few times, and while it works, I've found it awkward to deploy, and rather fragile. So I'd be willing to give up some of its power in return for a simpler, more transparent, and more reliable solution.

I haven't yet done any serious programming in Scala, but I've been following the language's development for several years now, and it's becoming increasingly common to see major systems implemented in Scala (for example, the Twitter team use Scala extensively, as I mentioned earlier this week), so I suspect it won't be too long before I find myself working on projects where Scala is a significant part of the solution.

If you haven't been paying attention to Scala, you might find it interesting to explore; I think it's powerful and well-designed, and has a bright future ahead.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Shelter
    I meant to post this as part of my article on Watership Down , but then totally forgot: Shelter In Shelter you experience the wild as a moth...
  • Parbuckling
    The enormous project to right and remove the remains of the Costa Concordia is now well underway. There's some nice reporting on the NP...
  • The Legend of 1900: a very short review
    Fifteen years late, we stumbled across The Legend of 1900 . I suspect that 1900 is the sort of movie that many people despise, and a few peo...
  • A Very Short Review of The Hangman's Daughter
    By way of the quite-nice Kindle Owners Lending Library , I recently read Oliver Potzsch's The Hangman's Daughter . At least part of ...
  • Jones v Anand
    If you think grandmaster chess is boring, with lots of positional strategic maneuvering, you owe it to yourself to play through the game bet...
  • A Glorious Defeat: a very short review
    Somewhat unexpectedly, Timothy Henderson's A Glorious Defeat: Mexico and Its War with the United States found its way to my nightstand....
  • Unbroken: a very short review
    Laura Hillenbrand's Seabiscuit: Three Men and a Racehorse was a massive worldwide hit, and became a movie hit as well. It took her seve...
  • One Day: a very short review
    I'm about two years late (typical), but I finally got around to David Nicholls's One Day . The book's concept is to tell a story...
  • Rim fire winding down
    I hadn't been over to Inciweb's Rim Fire status page in a while, so I dropped in to see how the progress goes. This is the long, sl...
  • XCOM Enemy Unknown
    I don't have much time to play video games, so I tend to go many months between games, looking for just the right one. I've been pla...

Blog Archive

  • ►  2013 (165)
    • ►  September (14)
    • ►  August (19)
    • ►  July (16)
    • ►  June (17)
    • ►  May (17)
    • ►  April (18)
    • ►  March (24)
    • ►  February (19)
    • ►  January (21)
  • ▼  2012 (335)
    • ▼  December (23)
      • A New Year's reading list
      • Old Man's War: a very short review
      • Scalable Component Abstractions
      • Some nice networking papers
      • Looking back at what was
      • One Day: a very short review
      • Database map from the 451 Group
      • Exactly
      • Real-world security topics
      • Stuff I'm reading on my "vacation"
      • Greedy algorithms and dynamic programming
      • This just in...
      • The Physician: a very short review
      • USS Alcatraz: A very very short review
      • Enterprise admins: here's how to help your softwar...
      • Stuff to read
      • Simplifying macroeconomics
      • Some pre-holidays stuff I'm reading
      • PrairyErth: a very short review
      • The Right Stuff
      • Jones v Anand
      • Switching off the net
      • Here comes Naka!
    • ►  November (30)
    • ►  October (33)
    • ►  September (34)
    • ►  August (29)
    • ►  July (39)
    • ►  June (27)
    • ►  May (48)
    • ►  April (32)
    • ►  March (30)
    • ►  February (10)
Powered by Blogger.

About Me

Unknown
View my complete profile