160 likes | 287 Views
The Ecology and Biodiversity of Libraries. Chris Mueller Software Libraries Workshop Dagstuhl, Germany March 9, 2005. Ecosystems. (http://www.antelmann.com/holger/images/neworleans/jungle.jpg). (http://www.lanl.gov/news/photos/computing.shtml).
E N D
The Ecology and Biodiversity of Libraries Chris Mueller Software Libraries Workshop Dagstuhl, Germany March 9, 2005
Ecosystems (http://www.antelmann.com/holger/images/neworleans/jungle.jpg) (http://www.lanl.gov/news/photos/computing.shtml) Biologists gain knowledge by observing nature… Can we observe libraries in the wild? Chris Mueller Software Libraries Workshop, Dagstuhl Germany
An Expedition into the Strange World of Libraries… Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Network Library TCP/IP • Type • Language neutral, platform neutral protocol library • Usage • Communicated between applications • Components • System libraries, Vendor libraries • Users • Software developers #include "winsock2.h" void socket_connect(const char* host, const int port) { WSADATA wsaData; int iResult = WSAStartup( MAKEWORD(2,2), &wsaData ); if ( iResult != NO_ERROR ) // ignore; sockaddr_in clientService; clientService.sin_family = AF_INET; clientService.sin_addr.s_addr = inet_addr( host ); clientService.sin_port = htons( port ); if ( connect( m_socket, (SOCKADDR*) &clientService, sizeof(clientService) ) == SOCKET_ERROR) { WSACleanup(); return; } // ... } Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Plugin Library Apache Modules • Type • Application specific plugin library • Usage • Extend Apache's feature set • Components • System libraries • Language • C • Users • Software developers, Webmasters # From httpd.conf LoadModule rewrite_module libexec/httpd/mod_rewrite.so /* C Interface */ /* the main config structure */ module AP_MODULE_DECLARE_DATA rewrite_module = { STANDARD20_MODULE_STUFF, config_perdir_create, /* create per-dir config structures */ config_perdir_merge, /* merge per-dir config structures */ config_server_create, /* create per-server config structures */ config_server_merge, /* merge per-server config structures */ command_table, /* table of config commands */ register_hooks /* register hooks */ }; Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Language Platform J2SE • Type • Platform, library and runtime specifications, library collection • Usage • Application development • Components • System libraries • Language • Java, C • Users • Software developers import java.util.Date; class HelloWorld { public static void main(String args[]) { Date now = new Date(); System.out.println(now + "Hello world!"); } } --> Sat Mar 05 12:54:25 EST 2005: Hello world! Chris Mueller Software Libraries Workshop, Dagstuhl Germany
import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.Hashtable; class Lookup { Object Lookup(String name) { // Identify service provider to use Hashtable env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); Object result = null; try { Context ctx = new InitialContext(env); Object obj = ctx.lookup(name); ctx.close(); } catch (NamingException e) { } return result; } } (http://java.sun.com/products/jndi/tutorial/getStarted/examples/naming.html) Specifications J2EE • Type • Domain specific library specification • Usage • Enterprise application development, service and protocol abstraction • Components • J2SE, system libraries, vendor libraries • Language • Java • Users • Software developers JNDI • Type • Platform specific protocol abstraction • Usage • Directory lookup • Components • J2SE, J2EE, system libraries, vendor libraries • Users • Software developers Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Script Library Log Monitor • Type • System commands • Usage • System administration, monitoring, reporting • Components • System commands, language libraries • Language • Bash, csh, Perl, Python, etc… • Users • Sysadmins, software developers #!/bin/bash # Add the count of new log entries to the log stats file if [ -z "$1" ]; then echo usage: $0 log-file log-stats-file exit fi if [ -z "$2" ]; then echo usage: $0 log-file log-stats-file exit fi echo `date` `wc -l $1` >> $2 % log-counter library-examples.txt log.dat % cat log.dat Sat Mar 5 13:05:51 EST 2005 379 library-examples.txt Sat Mar 5 13:06:23 EST 2005 392 library-examples.txt Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Data Access Libraries Enterprise JavaBeans • Type • OO relational database abstraction • Usage • Access database tables • Components • J2SE, J2EE • Language • Java, SQL • Users • Software developers, UI designers package com.mail.ejb.eventlog; import java.util.*; import javax.ejb.*; import javax.naming.*; import java.rmi.RemoteException; // Table Abstraction public abstract class UserLogBean implements EntityBean { // Access methods for relationship fields public abstract Collection getReadEvents(); public abstract void setReadEvents(Collection events); // Business methods public void addReadEvent(int eventId) { try { Collection events = getReadEvents(); events.add(eventId); } catch (Exception ex) { throw new EJBException(ex.getMessage()); } } // ... } // Query Abstraction public class EventLogControllerBean implements SessionBean { private LocalLogHome logHome public void logUserReadMail(String userId, String messageId) { LocalUserLog log = logHome.findByPrimaryKey(userId); log.addMailReadEvent(messageId); } } ODBC • Type • Data source library and abstaction layer • Usage • Abstract vendor protocols and data sources • Components • Vendor libraries, language libraries • Language • Java, SQL • Users • Software developers, DBAs, DB developers Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Database Libraries Stored Procedures • Type • Procedural database access • Usage • Create SQL functions, database triggers • Components • SQL, DB libraries • Language • PL/SQL, Java, C/C++, Perl • Users • DBAs, DB developers -- Function that counts a users mail messages create or replace function count_messages ( user integer ) return integer as begin return select count(*) into temp_count from message where user_id = user; end; Database Cartridges/Packages • Type • Database extension libraries • Usage • Extend database operations • Components • DB libraries, language libraries • Language • C/C++, Java • Users • Software developers, DB developers -- Apply multidimensional scaling on to the data -- and return the result in a new temporary table select MDS(user, time, event, duration) from mail_events; ---------------- |Row | X | Y | ---------------- | 1 | .4 | .5 | | 2 | .2 | .9 | … /* Possible C signature */ db_table* MDS(db_table *queryResult, db_query_info *info) { ... } Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Application Frameworks and Business Libraries Servlet API package com.mail.applogic; import javax.servlet.*; import javax.servlet.http.*; import com.mail.businesslogic.*; // Process user mail requests class MailServlet extends HttpServlet { private String user; private String message; private int messageId; // ... public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.user = request.getParameter("user"); String event = request.getParameter("event"); if(event.equals("showMessage")) { this.messageId = request.getParameter("messageId"); this.handleShowMessage(); } // ... } void handleShowMessage() { Mailbox mb = Mailbox(this.user); this.message = mb.GetMessage(this.messageId); } } • Type • Application framework • Usage • Application logic for Web applications • Components • J2SE, J2EE, business libraries • Language • Java • Users • Software developers Mail Library • Type • Domain library • Usage • Abstract mail data types and operations • Components • J2SE, j2EE, business libraries • Language • C/C++, Java • Users • Software developers, DB developers Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Tag Libraries Mail Tag Library • Type • User interface, data access • Usage • Data layout, presentation • Components • J2EE, business libraries • Language • XML, Java (JSP) • Users • UI designers, software developers <@ taglib prefix="mailapp” uri="http://www.mail.com/tags/mail"> <app-data> <mailapp:message_from/> <mailapp:message_subject/> <mailapp:message_content lines="2"/> </app> <app-data> <mail:from>garcia@osl.iu.edu</mail:from> <mail:subject>Libraries</mail:subject> <mail:content> Libraries are so cool! I can't wait to go to Germany and talk about ... </mail:content> </app-data> Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Style Libraries Transformation Libraries • Type • Data structure manipulation • Usage • Transform data to other formats • Components • Language libraries • Language • XSLT, Perl, Python, Bash, csh • Users • UI designers, software developers, “branders”, translators Device Transform (mail-to-html.xsl) <html> <brand-header/> <b>From:</b> garcia@osl.iu.edu </br> <b>Subject:</b> Libraries </br> <p i18n="no"> Libraries are so cool! I can't wait to go to Germany ... <p> <brand-footer/> </html> Brand Transform (osl-brand.xsl) <html> <head><title>OSL Mail</title></head> <body> <b>From:</b> garcia@osl.iu.edu </br> <b>Subject:</b> Libraries </br> <p i18n="no"> Libraries are so cool! I can't wait to go to Germany ... <p> <font size="-10"> You will obey Andy </font> </body> </html> I18N Transform (translate.pl) <html> <head><title>OSL Post</title></head> <body> <b>Von:</b> garcia@osl.iu.edu </br> <b>Thema:</b> Libraries </br> <p> Libraries are so cool! I can't wait to go to Germany ... <p> <font size="-10"> Sie befolgen Andy </font> </body> </html> Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Component Libraries COM • Type • Language neutral software components, platform • Usage • Expose language-specific libraries to other languages and applications • Components • Language libraries • Language • All • Users • Everyone # COM in Python: from win32com.client import Dispatch xl = Dispatch("Excel.Application") xl.Visible = 1 xl.Workbooks.Add() xl.ActiveSheet.Cells(1,1).Value = ’Libraries rule!' xl.ActiveSheet.Cells(2,1).Value = ’Dagstuhl rules!' xl.ActiveWorkbook.Close(SaveChanges=0) xl.Quit() Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Types of Libraries Protocol libraries Plugin libraries Platforms Frameworks Specifications System commands Database libraries Style libraries Component libraries Users of Libraries Software developers DB developers System administrators UI designers DBAs End users Ways to Access Libraries Programming languages Shells Menus Config files Quick Observations Chris Mueller Software Libraries Workshop, Dagstuhl Germany
Library Research • Libraries are plentiful • Libraries can be observed in their natural habitat • Every library user has a story Library research should follow the traditional sciences and have a strong empirical component. Chris Mueller Software Libraries Workshop, Dagstuhl Germany