Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Ingy's "Swiss Army Light Sabre" - or, "how do you design your APIs?"

by stvn (Monsignor)
on Mar 23, 2004 at 16:01 UTC ( #339055=note: print w/ replies, xml ) Need Help??


in reply to Ingy's "Swiss Army Light Sabre" - or, "how do you design your APIs?"

There are already some really excellent comments here. I agree very much with flyingmoose that an ideal would be that if you only knew the method names, you would still understand the API/class. Personally, I think this is something every API designer should strive for, but few ever actually reach. I also agree with dragonchild that an obsessive drive for simplicity and domain experience are two characteristic likely to be found in all good API desingers. (Although on occasion, a fresh perspective is good, not that this is mutually exclusive with domain experience, but sometimes good abstraction requires a distancing of ones self from the details of the domain.)

To these points I would like to add consistency. To me, this is an equally important element of a good API and one I strive to instill in every one I design. Consistent handling in method/function/variable naming conventions as well as in argument names and argument ordering (something I think is key to perl since it lacks named parameters). An obsessive drive to organize (a place for everything and everything in its place) is also something I think most good API/library designers have, a disorganized API can kill other positive aspects very quickly.

If you are instested in further study of API design, I would like to recommend this book. Reusable Software - The Base Object-Oriented Compontent Libraries by Bertrand Meyer, it is heavy on Eiffel (whose base libraries it is talking about), but really really insightful and smart. I believe that Eiffel actually begun not as a language, but as an attempt to "understand the fundemental structures and paradigms of software development". This book is basically about that process. It is one of the only books I have found that actually discusses the principles of good library construction in detail, including class names, proper use of inheritance, ideal class size, etc. etc. I actually keep it on my "within-arms-reach" shelf, next to the O'Reilly Perl catalog and my favorite Addison Wesley titles (Refactoring, Design Patterns, Pragmatic Programmers, etc).

-stvn


Comment on Re: Ingy's "Swiss Army Light Sabre" - or, "how do you design your APIs?"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://339055]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-07-29 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls