Api Design
by sartak
- 2,158 views
Too few projects demand good API design as a critical goal. A clean and...
Too few projects demand good API design as a critical goal. A clean and
extensible API will pay for itself many times over in fostering a community of
plugins. We certainly cannot anticipate the ways in which our users will bend
our modules, but designing an extensible system alleviates the pain. There are
many lessons to be learned from Moose, HTTP::Engine and IM::Engine,
Dist::Zilla, KiokuDB, Fey, and TAEB.
The most important lesson is to decouple the core functionality from the
"fluff" such as sugar and middleware. This forces you to have a solid API that
ordinary users can extend. This also lets users write their own sugar and
middleware. In a tightly-coupled system, there is little hope for
extensibility.
In this talk, you will learn how to make very productive use of Moose's roles
to form the foundation of a pluggable system. Roles provide excellent means of
code reuse and safe composition. I will also demonstrate how to use
Sub::Exporter to construct a more useful and flexible sugar layer.
Accessibility
Categories
Upload Details
Uploaded via SlideShare as Apple Keynote
Usage Rights
© All Rights Reserved
Statistics
- Likes
- 3
- Downloads
- 36
- Comments
- 0
- Embed Views
- Views on SlideShare
- 2,155
- Total Views
- 2,158
Tokyo Institute of Technology, Tokyo, Japan.
http://www.youtube.com/watch?v=aAb7hSCtvGw
http://www.flickr.com/photos/nuffin/179250512/
http://www.flickr.com/photos/nuffin/179250812/
http://weftsoar.net/~hdp/dzil/
http://www.flickr.com/photos/redune/6562798/
Make it painless for your users. Some of them might be using your module a lot. If it's tedious to use your module...
See my "Extending Moose for Applications" talk for a proper introduction to the metaobject protocol http://sartak.org/talks/yapc-na-2009/extending-moose/
This is its sugar layer. Like Moose, it has a clean, extensible API if you want the freedom to do unusual things.
http://sartak.org/talks/yapc-asia-2009/(parameterized)-roles/