SlideShare a Scribd company logo
1 of 44
Download to read offline
Apache
                Commons

Torsten Curdt

                don’t re-invent the wheel
Why are you a
 Developer?
Creating & Building
That is a problem!
The journey
is the goal.
Use vs Build
A Story of Re-use
•Faster
•Better designed
•Less time
•Smaller team
Original




Re-Impl




           0   5,000   10,000   15,000   20,000   25,000
                            hours
20,000 hours
7x
5x
How did we do it?
Re-use to Excel
Know your libraries!
Heritage
Charter
“Creation of small re-useable
components that can be used across
projects. They are supposed to have as
few dependencies as possible, meant
to be well tested and compatible with
the current de-facto standard version of
the JDK”
Growth

Sandbox




Proper    Dormant
Project Stats
60
                         Dormant
                         Proper
      37                 Sandbox
45




30              37

15
      18
 0

     Active   Inactive
Proper
Collections
Map map = new CaseInsensitiveMap();
map.put(quot;Onequot;, quot;Onequot;);
map.get(quot;ONEquot;);

Map colorMap = MapUtils.toMap(new String[][] {{
 {quot;redquot;,   quot;#FF0000quot;},
 {quot;greenquot;, quot;#00FF00quot;},
 {quot;bluequot;, quot;#0000FFquot;}
});
Primitives

ArrayByteList list = new ArrayByteList();

list.add(byte);
list.removeElementAt(index);

byte[] bytes = list.toArray();
IO

InputStream in;
OutputStream out;

IOUtils.copy(in, out);

...

byte[] data = IOUtils.toByteArray(in);
Lang

String s = “Apache Jakarta Commons”;
StringUtils.right(s, 7); // “Commons”

String n = “0”;
StringUtils.leftPad(s, 4, ‘0’); // “0000”
Logging

public class C {
  private Log log = LogFactory.getLog(C.class);
  ...
      if (log.isDebugEnabled()) {
        log.debug(quot;log messagequot;);
      }
CLI
Options options = new Options();
options.addOption(quot;hquot;, false, quot;display usagequot;);

CommandLine line = parser.parse(options, args);
if(line.hasOption(quot;hquot;)) {
  HelpFormatter f = new HelpFormatter();
  f.printHelp(quot;myprogramquot;, options);
  ...
Email

SimpleEmail email = new SimpleEmail();
email.setHostName(quot;mail.myserver.comquot;);
email.addTo(quot;jdoe@somewhere.orgquot;, quot;John Doequot;);
email.setFrom(quot;me@apache.orgquot;, quot;Mequot;);
email.setSubject(quot;Test messagequot;);
email.setMsg(quot;A simple test of commons-emailquot;);
email.send();
Net

NNTPClient client = new NNTPClient();
client.connect(quot;news.server.netquot;);

NewsgroupInfo[] = client.listNewsgroups();

client.disconnect();
JXPath

XPathContext context =
  JXPathContext.newContext(dom);

String value = (String)
  context.getValue(quot;/my/xpath/to/valuequot;);
VFS

FileSystemManager fs = VFS.getManager();
FileObject jar = fs.resolveFile(
  quot;jar:lib/aJarFile.jarquot; );

FileObject[] childs = jar.getChildren();
for (int i=0; i < childs.length; i++ ) {
  ...
JCI
JavaCompiler compiler =
  new EclipseJavaCompiler();
ResourceStore store =
  new MemoryResourceStore();

CompilationResult result = compiler.compile(
 new String[] { quot;org/MyClass.javaquot; },
 new FileResourceReader(directory),
 store );
Exec

OutputStream out;
OutputStream error;

CommandLine cl = new CommandLineImpl();
cl.setExecutable(quot;path/to/exequot;);
cl.addArgument(quot;argquot;);
exec.execute(cl, out, error);
Proxy
o = (MyObject) new CglibProxyFactory()
    .createInterceptorProxy(
       new MyObjectImpl(),
       new LoggingInterceptor(log),
       new Class[]{ MyObject.class });
o.test(”test”);

[DEBUG]   - BEGIN test(test)
[DEBUG]   - END test()
Overview
attributes, beanutils, betwixt, chain,
cli, codec, collections, configuration,
daemon, dbcp, dbutils, digester,
discovery, el, email, fileupload,
httpclient, io, jci, jelly, jexl, jxpath,
lang, launcher, logging, math,
modeler, net, pool, primitives,
proxy, scxml, transaction, validator,
vfs
Sandbox
CSV

String[][] data = CSVParser.parse(string);

CSVParser parser = new CSVParser(reader,’;’);
String[][] data = parser.getAllValues();
Javaflow
class MyRunnable implements Runnable {
  public void run() {
    for(int i=0; i<10; i++ )
      Continuation.suspend();
  }}
Continuation c = Continuation.startWith(
                      new MyRunnable());
Continuation d = Continuation.continueWith(c);
...
OpenPGP
keyRing = new BouncyCastleKeyRing(
                 secret, public, password);
signer = new BouncyCastleOpenPgpSigner();
signer.detachedSign(
  fileInputStream
  signatureOutputStream,
  keyId,
  keyRing,
  true );
Overview
compress, csv, expression,
finder, flatfile, functor, i18n,
id, javaflow, jnet, js2j, me,
monitoring, nabla, openpgp,
performance, pipeline,
validator2
Dormant
Overview
benchmark, cache, clazz, codec-
mulipart, combo, contract, events,
feedparser, filters, functor, grant,
graph2, http, jex, jjar, jpath, jrcs, jux,
latka, mapper, messenger, pattern,
periodicity, reflect, resources, rupert,
scaffold, services, servlet,
simplestore, tbm, test, threading,
threadpool, workflow, xmlio, xmlunit,
xo
direct dependency
            no dependency




      20%




80%
We need you!


dev@commons.apache.org
Thanks!
  http://vafer.org/blog
http://twitter.com/tcurdt

More Related Content

What's hot

Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
Soumya Behera
 

What's hot (20)

Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6
 
Easy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVEEasy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVE
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
 
Planet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance EnhancementPlanet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance Enhancement
 
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
 
Groovy 1.8の新機能について
Groovy 1.8の新機能についてGroovy 1.8の新機能について
Groovy 1.8の新機能について
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
Initial Java Core Concept
Initial Java Core ConceptInitial Java Core Concept
Initial Java Core Concept
 
Introduction to JQ
Introduction to JQIntroduction to JQ
Introduction to JQ
 
jq: JSON - Like a Boss
jq: JSON - Like a Bossjq: JSON - Like a Boss
jq: JSON - Like a Boss
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Beyond Java: 자바 8을 중심으로 본 자바의 혁신
Beyond Java: 자바 8을 중심으로 본 자바의 혁신Beyond Java: 자바 8을 중심으로 본 자바의 혁신
Beyond Java: 자바 8을 중심으로 본 자바의 혁신
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
 

Similar to Apache Commons - Don\'t re-invent the wheel

Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
Abed Bukhari
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 

Similar to Apache Commons - Don\'t re-invent the wheel (20)

Jakarta Commons - Don't re-invent the wheel
Jakarta Commons - Don't re-invent the wheelJakarta Commons - Don't re-invent the wheel
Jakarta Commons - Don't re-invent the wheel
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Java best practices
Java best practicesJava best practices
Java best practices
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customization
 
Modern technologies in data science
Modern technologies in data science Modern technologies in data science
Modern technologies in data science
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing Speed
 
Cascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGCascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUG
 
JavaScript 2016 for C# Developers
JavaScript 2016 for C# DevelopersJavaScript 2016 for C# Developers
JavaScript 2016 for C# Developers
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
Marat-Slides
Marat-SlidesMarat-Slides
Marat-Slides
 
3
33
3
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Apache Commons - Don\'t re-invent the wheel