SlideShare a Scribd company logo
Project Automation
                           Christian Plessl & Stefan Bleuler
                           Software Engineering Workshop,
                                  December 5-6, 2005




ETH Zürich, Institut TIK                                       December 5, 2005
Project Automation: Outline

            reasons     methods


    tools                             continuous
                                      integration

                         Project
                      Automation
      reproducible     principles
      research         and pitfalls


                                                    2
Why should we automate…
 …when doing the same thing multiple times?
   Example: in all html files: /home/ftp   /home/tikftp
   save time
   repetition is boring, no learning
   do the same thing: make the same mistake in all cases
   do it more frequently, e.g., update software
   do it on a schedule, e.g., backup

 …when doing the same thing once?
   Example: plot a figure in matlab
   reproducibility: “Do it again but change the labels!”
   documentation: “Which results did go into the figure?”

           Can you reproduce your results?
                                                            3
What should we automate?

 do not automate things you…
   …won’t do again.
   …don’t want to remember how you did them.
   …like doing multiple times.


 typical targets for automation
   repetitive shell tasks
   building and testing of software
   simulation runs and analysis of results




                                               4
Automation Languages
 plenty of languages
   general purpose “scripting” languages (Sh, Perl, Ruby)
   general purpose languages (C, Java)
   domain specific languages (Make, ant, XSLT, Matlab)


 you can do anything with any language, but…
   there is no “one size fits all” language
   use the right language for each task
   use the domain knowledge provided by domain specific
   languages
   make your job as easy as possible
    glue the best tools together, be creative

                                                            5
Automation of Shell Tasks

 examples
   rename all welcome.html files to index.html
   change all links pointing to /proj/* to point to /home/*


 benefits
   reduce errors
   make functionality available to others


 strategies
   1. level: use the power of the shell (oneliners)
   2. level: use scripts

                                                              6
The Power of the Shell
 example: create a zip file of my source files:
    command line: zip archive *.h *.c
    GUI:
     -   run WinZip of similar
     -   create new archive
     -   select source directory, add *.c filter, add *.h filter
     -   close archive and quit WinZip

 example: mass replace text in files
    find . -name “*.html” -exec perl -spi -e 's/string1/string2/g' {} ;

 concise and precise
    which options have be be set in GUI?
    likely to be valid for a long time (GUIs change a lot)
 room for further automation
    calling a sequence of scripts from a super-script
    create wrappers for frequently used commands

                                                                           7
Scripting Languages

 shell scripts (sh, tcsh, ksh)
    cumbersome syntax
    few libraries, rely on external tools (incompatibilities)
    manipulation of results difficult
    don’t use them, or only for simple sequences of commands


 general purpose script languages (Ruby, Perl, Python)
    real programming languages (procedural / object oriented)
    extensive libraries
    strong text manipulation capabilities
    very portable if built-in commands are used
    can do anything a shell script can do
    glue-logic between tools
    can use built-in commands and libraries and external commands

                                                                    8
Scripting Shell Tasks
 example
   generate PDFs from all ASCII handouts for this workshop
 benefits
   don’t forget anything
   do it triggered by changes
 method
    Trigger   perl                                     make
                                                                     ASCII
              for all subdirectories
                if filename ends in .txt                      redcloth
                   if filename contains searchstring                 HTML
                      make file.pdf
                      move file.pdf to public_html            html2ps
                   end                                               PS
                end                                            distill
              end
                                                                     PDF



                                                                             9
Example: Scripting Shell Tasks




                                 10
Example: Shell Task Scripting
use     strict;
use     File::Find;
use     File::Basename;
use     File::Spec;

my $path_to_scripts = dirname(__FILE__);
my $makefile = quot;$path_to_scripts/handout_makefilequot;;

my   $searchstr = $ARGV[0];
my   $outdir = $ARGV[1];
my   $abs_outdir = File::Spec->rel2abs($outdir);
my   @dir_list = '.'; # we start in the current directory

# find all files and for each call ’wanted’
find({wanted => &wanted, no_chdir => 1}, @dir_list);

sub wanted {
  my $name =     $File::Find::name;

    if (-f $_ && $name =~ m/^(.+).txt$/) { # is a file and name ends in .txt
      my $prefix = $1;

        if($name =~ m/$searchstr/) {
          system(quot;make -f $makefile REDCLOTH=$path_to_scripts/redcloth $prefix.pdfquot;);
          system(quot;cp $prefix.pdf $abs_outdirquot;);
        }
    }
}                                                                                  11
More Power: Domain Specific Languages

 general purpose scripting languages can do
 everything

 domain specific languages can do some things
 more efficiently
   they incorporate domain knowledge
   code is shorter, more expressive
   programs more efficient
   examples: XSLT, matlab, SQL, …




                                                12
Example: Domain Specific Languages
 XSLT
 XML to XML transformations
 declarative, template based
 <card type=quot;simplequot;>
           <name>John Doe</name>
           <email>doe@widget.com</email>
           <phone>(202) 456-1414</phone>
 </card>



 <?xml version=quot;1.0quot;?>
 <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;>
 <head>
     <title>business card</title>
 </head>
 <body>
     <h1>John Doe</h1>
     <p>email: <a href=quot;mailto:doe@widget.comquot;>
         doe@widget.com</a></p>
     <p>phone:(202) 456-1414</p>
 </body>
 </html>


                                                  13
Example: Domain Specific Languages
application specific XML                  XSL stylesheet
<card type=quot;simplequot;>                       <xsl:stylesheet version=quot;1.0quot;
  <name>John Doe</name>
  <email>doe@widget.com</email>            xmlns:xsl=quot;http://www.w3.org/1999/XSL/Transformquot;
  <phone>(202) 456-1414</phone>              xmlns=quot;http://www.w3.org/1999/xhtmlquot;>
</card>
                                             <xsl:template match=quot;card[@type='simple']quot;>
                                               <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;>
                                               <title>business card</title>
                                               <body>
              XML-to-XML                         <xsl:apply-templates select=quot;namequot;/>
                                                 <xsl:apply-templates select=quot;emailquot;/>
              transformation                     <xsl:apply-templates select=quot;phonequot;/>
                                               </body>
                                               </html>
                                             </xsl:template>
XHTML
<?xml version=quot;1.0quot;?>                        <xsl:template match=quot;card/namequot;>
<html                                          <h1><xsl:value-of select=quot;text()quot;/></h1>
  xmlns=quot;http://www.w3.org/1999/xhtmlquot;>      </xsl:template>
<head>
  <title>business card</title>               <xsl:template match=quot;emailquot;>
</head>                                        <p>email: <a href=quot;mailto:{text()}quot;>
<body>                                           <xsl:value-of select=quot;text()quot;/></a>
  <h1>John Doe</h1>                            </p>
  <p>email:                                  </xsl:template>
    <a href=quot;mailto:doe@widget.comquot;>
    doe@widget.com</a></p>                   <xsl:template match=quot;phonequot;>
  <p>phone:(202) 456-1414</p>                  <p>phone:<xsl:value-of select=quot;text()quot;/></p>
</body>                                      </xsl:template>
</html>                                    </xsl:stylesheet>
           example adapted from http://www.brics.dk/~amoeller/XML/xslt-4.1.html               14
Code Generation
 basic ideas
   DRY principle: keep information in one place only
   translate between representations of the same information
   simple to change
 active vs. passive code generators
   passive: generate code once (then modify manually)
   active: run each time the input data changes
 examples
   XML to XML transformations
   database and access functions: SQL tables and Java Code
 methods
   scripts
   domain specific languages …



                                                               15
Example: Code Generation




                           16
Building and Testing Software
 basic steps
                  compile           link           test


                            build
 strategy
   only do what is necessary (modification time)
   write down recipe in one place
   build tools (make, ant, ...)

 benefits
   incremental builds
   can be triggered by changes => continuous integration

 what about IDEs?
   can do the same with one click
   information distributed, not portable
   some IDEs can export build procedure as makefile
                                                           17
Build Languages
 make, ant, cmake, imake, rake
 domain knowledge
   hierarchy of build targets
   build rules (templates e.g. File.java   File.class)
   dependencies
   minimal incremental rebuilds
 general purpose or language specific
 example ant:
   knows about javac, jar, rmic, javah, javadoc, etc.
   tasks: archive, coverage, compile, deployment,
   execution, logging, scm, test, etc

 use for: automate build, test, packaging, deployment
                                                         18
Example: Build Language


           REDCLOTH = redcloth
           HTML2PS = html2ps
           PS2PDF = distill

           %.html : %.txt
                   $(REDCLOTH) $< > $@

           %.ps : %.html
                   $(HTML2PS) $< > $@

           %.pdf : %.ps
                   $(PS2PDF) $<

           %.clean : %.txt
                   rm -f $*.ps $*.html




                                         19
Continuous Integration
core idea: run build and test loop continuously
     watch repository for changes
     run build and tests
     publish status of the build and tests to developers
     build is successful if:
      - uses latest sources from version control
      - is built automatically
      - passes all unit tests and functional tests


  benefits
     detect errors early
     monitor code quality over time
     prevent integration problems




                                                           20
Contiuous Integration 2
 requires: automated building and testing
    use a single repository where anyone can get the current version of
    all sources (and all previous versions)
    automate the build process so that anyone can use a single
    command to build the system from the sources
    automate the testing so that you can run a good suite of tests on the
    system at any time with a single command

 tools
    CruiseControl
    CruiseControl.NET
    Tinderbox
    damagecontrol

 use established version-control, build and testing
 frameworks

                                                                            21
Continuous Integration: outline




                                  22
CruiseControl Case Study

 idea: automate validation and publishing of the
 workshop webpage

 basic steps
   validate XHTML
   validate CSS
   convert ASCII handouts to PDF
   publish on webserver


 main tool: CruiseControl
   ideal for java
   also other languages possible (as you will see)
                                                     23
Overview CruiseControl




                         24
Directory Layout

cruisecontrol/                                    myproj/
cc_builds/                                        build.xml     project ant build file
  config.xml         cc configuration             Makefile
  cc-build.xml       master build file -> trig.   LICENSE
checkouts/           co/myproj/build.xml          README
                                                  bin/          project-spec. autom. tools
  myproj/            checkout of myproj             bar.sh
    ...
    build/                                          foo.pl
logs/                                             build/        build results
  myproj/                                           prod/       production binaries
    status.txt        build status for myproj       test/       test/debug binaries
    log_buildno.xml build/test results for        doc/          documentation (non-generated)
artifacts/             buildno                    src/          sources
                                                    spam.java
  myproj/                                           ham.java
    buildno/                                      test/         unit tests and functional tests
       build archive                              vendor/lib    3rd party libraries

sample CruiseControl                              sample project directory layout
directory layout
                                                                                                  25
CruiseControl: Configuration (config.xml)
<cruisecontrol>
  <project name=quot;tecsw_workshopquot; buildafterfailed=quot;falsequot;>

    <modificationset quietperiod=quot;60quot; >
      <svn localWorkingCopy=quot;checkout/tecsw_workshopquot;/>
    </modificationset>

    <schedule interval=quot;120quot; >
      <ant buildfile=quot;cc-build.xmlquot; target=quot;buildquot;/>
   </schedule>

    <listeners>
      <currentbuildstatuslistener file=quot;logs/tecsw_workshop/status.txtquot;/>
    </listeners>

    <publishers>
      <artifactspublisher
        dir=quot;checkout/tecsw_workshop/buildquot;
        dest=quot;artifacts/tecsw_workshopquot;/>

       <htmlemail mailhost=quot;smtp.ee.ethz.chquot;
           returnaddress=quot;bleuler@tik.ee.ethz.chquot;
           buildresultsurl=quot;http://tik8.ee.ethz.ch:8080/cruisecontrol/buildresults/tecsw_workshopquot;
           logdir=quot;logs/tecsw_workshopquot;
           css=quot;webapps/cruisecontrol/css/cruisecontrol.cssquot;
           xsldir=quot;webapps/cruisecontrol/xslquot;>

            <always address=quot;bleulerquot;/>
              <failure address=quot;plesslquot; reportWhenFixed=quot;truequot; />
      </htmlemail>
    </publishers>

    <log dir=quot;logs/tecsw_workshopquot;>
      <merge dir=quot;checkout/tecsw_workshop/build/resultsquot;/>
    </log>

   </project>

</cruisecontrol>
                                                                                                     26
HTML validation report generation
   build rule in build.xml
   triggered whenever a modification to SVN repository occurs
   actual report is generated by validate_html.rb Ruby script
       validate_html calls W3C HTML validator (remote website)
       results are read, interpreted, and XML report is generated
<project name=quot;sssequot; default=quot;allquot; basedir=quot;.quot;>

  <property   name=quot;tools.dirquot;    location=quot;toolsquot;/>
  <property   name=quot;build.dirquot;          location=quot;buildquot;/>
  <property   name=quot;results.dirquot;        location=quot;${build.dir}/resultsquot;/>
  <property   name=quot;htmlpublish.dirquot;    location=quot;${build.dir}/public_htmlquot;/>
  <property   name=quot;htmlvalidation.dirquot; location=quot;${build.dir}/htmlvalidationquot;/>

  <target name=quot;validate_htmlquot; depends=quot;build_webpagequot; >
    <echo message = quot;Running the HTML validator on the websitequot; />
    <exec executable=quot;${tools.dir}/validate_html.rbquot;
      failonerror=quot;truequot; output=quot;${results.dir}/html_validation_results.xmlquot;>
      <arg line=quot;${htmlpublish.dir} ${htmlvalidation.dir}quot; />
    </exec>
  </target>

</project>
                                                                                   27
Build Results (log_buildno.xml)
excerpt:

<cruisecontrol>

  <modifications>                                                      subversion revision
    <modification type=quot;svnquot;>
      <file action=quot;addedquot;>                                            information
        <revision>66</revision>
        <filename>/talks/8_releasing_software/release.ppt</filename>
      </file>
      <date>11/29/2005 13:46:57</date>
      <user>kuenzli</user>
      <comment><![CDATA[initial slide template]]></comment>
      <revision>66</revision>
    </modification>
  </modifications>

  <htmlvalidate>
    <passed errors=quot;0quot; report=quot;htmlvalidation/index.htmlquot;              HTML validation
       file=quot;public_html/index.htmlquot; />
    <failed errors=quot;14quot; report=quot;htmlvalidation/ie7/test.htmlquot;
                                                                       report
       file=quot;public_html/ie7/test.htmlquot; />
  </htmlvalidate>

</cruisecontrol>




                                                                                             28
Publishing Process


                                                     all build and test results are
                             log_buildno.xml         stored in a single XML file



UnitTest        Commit log        Build     Coding style    HTML valid.      XSL stylesheets
  XSL              XSL            XSL           XSL           XSL            generate
                                                                             reports
                                                                             reports format
UnitTest        Commit log       Build      Coding style    HTML valid.      the build and
 report           report         report        report         report
                                                                             test results
                                                                             nicely

            HTML                 Email                 SMS
                                                                     various
           publisher            publisher            publisher       publishers send
                                                                     results to
                                                                     developers



                                                                                               29
Failed Build (HTML publisher)
                                build information
                                summary




                                build errors and
                                warnings


                                test reports


                                Subversion revision
                                logfile comments

                                HTML and CSS vali-
                                dation report
                                We have added this
                                information for our
                                case study
                                                      30
Successfull Build (HTML publisher)




                                     31
A Bug has been fixed (Email publisher)




     email to all who committed since last successful build
                                                              32
Simulation Runs and Analysis – An Example
 revision for a paper
 study comparing algorithms
 given
   algorithms in binaries and source
   synthetic data
   some scripts for converting output files (a few broken)
   multiple results directories per algorithm
   one parameter file per algorithm
   figures in the paper
 task: do exactly the same for another kind of
 synthetic data
 problems:
   what were the parameter settings for the different runs?
   which scripts were used for processing which results?
   which results did make it into the final figures?
                                                              33
Simulation Runs and Analysis II
 conclusions
   “normal” project
   “everything” was there
   it was mostly useless

          Too many things had been performed manually.



 advice
   do not underestimate the amount of information in a few
   commands entered by hand
   automation is the most accurate form of documentation


                                                             34
Reproducible Research - A Vision
     scientific experiments should be reproducible
     in computer science they really could be



  project.tar.gz
                                                   results
    README
                                                     figures
    data/
                           ./do_it_all.pl              tables
    code/
    do_it_all.pl




                   Can I reproduce your results?
                                                                35
Wrap up: Principles and Pitfalls of Project
automation
       don’t repeat yourself DRY
       single source principle
       prefer convention over configuration

+      prefer modularity over generalization
       choose right granularity (rule of thumb: isolate long running
       tasks)
       you will always have to adapt small things: reduce barrier for
       change
       use domain specific tools



       trying to solve all possible problems
       don’t know when to stop
 !     re-invent the wheel

                                                                        36
Advice
 do not try to automate everything
 be familiar with the automation possibilities and judge
 yourself
 everyone should be intimate with
    a scripting language
    a build tool (make, ant, etc.)
    the most important shell commands
    one editor
 define a good project layout
    remove burden from developer of deciding what files to put where
    defined directory layout enable automation, e.g. self-testing
    stick to the layout!
 exchange code and solutions


                                                                       37
Literature
 A. Hunt and D. Thomas, The Pragmatic Programmer, Addison Wesley, 2000

 D. Thomas et al., Programming Ruby, Pragmatic Bookshelf,
 L. Wall et al., Programming Perl, O’Reilly, 2000
 T. Christiansen and N. Torkington, Perl Cookbook, O’Reilly, 1998

 M. Clark, Pragmatic Project Automation, Pragmatic Bookshelf, 2004
 http://cruisecontrol.sourceforge.net

 extensive list of code generators: http://www.codegeneration.net




                                                                         38

More Related Content

What's hot

MG6088 SOFTWARE PROJECT MANAGEMENT
MG6088 SOFTWARE PROJECT MANAGEMENTMG6088 SOFTWARE PROJECT MANAGEMENT
MG6088 SOFTWARE PROJECT MANAGEMENT
Kathirvel Ayyaswamy
 
2.6 Empirical estimation models & The make-buy decision.ppt
2.6 Empirical estimation models & The make-buy decision.ppt2.6 Empirical estimation models & The make-buy decision.ppt
2.6 Empirical estimation models & The make-buy decision.ppt
THARUNS44
 
Hardware implementation of page table
Hardware implementation of page table Hardware implementation of page table
Hardware implementation of page table
Sukhraj Singh
 
Overview of project planning
Overview of project planningOverview of project planning
Overview of project planning
Nidhya Rangarajan
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
BetshaTizazu2
 
Decision making in software project management
Decision making in software project managementDecision making in software project management
Decision making in software project management
Priyadarshini Krishnaswamy
 
Draw and explain the architecture of general purpose microprocessor
Draw and explain the architecture of general purpose microprocessor Draw and explain the architecture of general purpose microprocessor
Draw and explain the architecture of general purpose microprocessor
Pundra university Science and technology
 
Managing people and organizing teams
Managing people and organizing teamsManaging people and organizing teams
Managing people and organizing teams
tumetr1
 
Spm project planning
Spm project planning Spm project planning
Spm project planning
Kanchana Devi
 

What's hot (9)

MG6088 SOFTWARE PROJECT MANAGEMENT
MG6088 SOFTWARE PROJECT MANAGEMENTMG6088 SOFTWARE PROJECT MANAGEMENT
MG6088 SOFTWARE PROJECT MANAGEMENT
 
2.6 Empirical estimation models & The make-buy decision.ppt
2.6 Empirical estimation models & The make-buy decision.ppt2.6 Empirical estimation models & The make-buy decision.ppt
2.6 Empirical estimation models & The make-buy decision.ppt
 
Hardware implementation of page table
Hardware implementation of page table Hardware implementation of page table
Hardware implementation of page table
 
Overview of project planning
Overview of project planningOverview of project planning
Overview of project planning
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
Decision making in software project management
Decision making in software project managementDecision making in software project management
Decision making in software project management
 
Draw and explain the architecture of general purpose microprocessor
Draw and explain the architecture of general purpose microprocessor Draw and explain the architecture of general purpose microprocessor
Draw and explain the architecture of general purpose microprocessor
 
Managing people and organizing teams
Managing people and organizing teamsManaging people and organizing teams
Managing people and organizing teams
 
Spm project planning
Spm project planning Spm project planning
Spm project planning
 

Similar to Project Automation

Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
Stephan Schmidt
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
Stephan Schmidt
 
AD215 - Practical Magic with DXL
AD215 - Practical Magic with DXLAD215 - Practical Magic with DXL
AD215 - Practical Magic with DXL
Stephan H. Wissel
 
Pmm05 16
Pmm05 16Pmm05 16
Pmm05 16
Rohit Luthra
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
BG Java EE Course
 
XML processing with perl
XML processing with perlXML processing with perl
XML processing with perlJoe Jiang
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handlingSuite Solutions
 
LocalizingStyleSheetsForHTMLOutputs
LocalizingStyleSheetsForHTMLOutputsLocalizingStyleSheetsForHTMLOutputs
LocalizingStyleSheetsForHTMLOutputsSuite Solutions
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xmlmussawir20
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Jussi Pohjolainen
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
Michiel Rook
 
Deploy Flex with Apache Ant
Deploy Flex with Apache AntDeploy Flex with Apache Ant
Deploy Flex with Apache Ant
dctrl — studio for creativ technology
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
brian_dailey
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
BG Java EE Course
 
Using Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsUsing Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee Applications
Rajesh Kumar
 
sphinx-i18n — The True Story
sphinx-i18n — The True Storysphinx-i18n — The True Story
sphinx-i18n — The True Story
Robert Lehmann
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
Andrew Savory
 

Similar to Project Automation (20)

Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
AD215 - Practical Magic with DXL
AD215 - Practical Magic with DXLAD215 - Practical Magic with DXL
AD215 - Practical Magic with DXL
 
Pmm05 16
Pmm05 16Pmm05 16
Pmm05 16
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
XML processing with perl
XML processing with perlXML processing with perl
XML processing with perl
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handling
 
PDF Localization
PDF  LocalizationPDF  Localization
PDF Localization
 
LocalizingStyleSheetsForHTMLOutputs
LocalizingStyleSheetsForHTMLOutputsLocalizingStyleSheetsForHTMLOutputs
LocalizingStyleSheetsForHTMLOutputs
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
 
Deploy Flex with Apache Ant
Deploy Flex with Apache AntDeploy Flex with Apache Ant
Deploy Flex with Apache Ant
 
lf-2003_01-0269
lf-2003_01-0269lf-2003_01-0269
lf-2003_01-0269
 
lf-2003_01-0269
lf-2003_01-0269lf-2003_01-0269
lf-2003_01-0269
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Using Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsUsing Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee Applications
 
sphinx-i18n — The True Story
sphinx-i18n — The True Storysphinx-i18n — The True Story
sphinx-i18n — The True Story
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
 

More from elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
elliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
elliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
elliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 

More from elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Recently uploaded

Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

Project Automation

  • 1. Project Automation Christian Plessl & Stefan Bleuler Software Engineering Workshop, December 5-6, 2005 ETH Zürich, Institut TIK December 5, 2005
  • 2. Project Automation: Outline reasons methods tools continuous integration Project Automation reproducible principles research and pitfalls 2
  • 3. Why should we automate… …when doing the same thing multiple times? Example: in all html files: /home/ftp /home/tikftp save time repetition is boring, no learning do the same thing: make the same mistake in all cases do it more frequently, e.g., update software do it on a schedule, e.g., backup …when doing the same thing once? Example: plot a figure in matlab reproducibility: “Do it again but change the labels!” documentation: “Which results did go into the figure?” Can you reproduce your results? 3
  • 4. What should we automate? do not automate things you… …won’t do again. …don’t want to remember how you did them. …like doing multiple times. typical targets for automation repetitive shell tasks building and testing of software simulation runs and analysis of results 4
  • 5. Automation Languages plenty of languages general purpose “scripting” languages (Sh, Perl, Ruby) general purpose languages (C, Java) domain specific languages (Make, ant, XSLT, Matlab) you can do anything with any language, but… there is no “one size fits all” language use the right language for each task use the domain knowledge provided by domain specific languages make your job as easy as possible glue the best tools together, be creative 5
  • 6. Automation of Shell Tasks examples rename all welcome.html files to index.html change all links pointing to /proj/* to point to /home/* benefits reduce errors make functionality available to others strategies 1. level: use the power of the shell (oneliners) 2. level: use scripts 6
  • 7. The Power of the Shell example: create a zip file of my source files: command line: zip archive *.h *.c GUI: - run WinZip of similar - create new archive - select source directory, add *.c filter, add *.h filter - close archive and quit WinZip example: mass replace text in files find . -name “*.html” -exec perl -spi -e 's/string1/string2/g' {} ; concise and precise which options have be be set in GUI? likely to be valid for a long time (GUIs change a lot) room for further automation calling a sequence of scripts from a super-script create wrappers for frequently used commands 7
  • 8. Scripting Languages shell scripts (sh, tcsh, ksh) cumbersome syntax few libraries, rely on external tools (incompatibilities) manipulation of results difficult don’t use them, or only for simple sequences of commands general purpose script languages (Ruby, Perl, Python) real programming languages (procedural / object oriented) extensive libraries strong text manipulation capabilities very portable if built-in commands are used can do anything a shell script can do glue-logic between tools can use built-in commands and libraries and external commands 8
  • 9. Scripting Shell Tasks example generate PDFs from all ASCII handouts for this workshop benefits don’t forget anything do it triggered by changes method Trigger perl make ASCII for all subdirectories if filename ends in .txt redcloth if filename contains searchstring HTML make file.pdf move file.pdf to public_html html2ps end PS end distill end PDF 9
  • 11. Example: Shell Task Scripting use strict; use File::Find; use File::Basename; use File::Spec; my $path_to_scripts = dirname(__FILE__); my $makefile = quot;$path_to_scripts/handout_makefilequot;; my $searchstr = $ARGV[0]; my $outdir = $ARGV[1]; my $abs_outdir = File::Spec->rel2abs($outdir); my @dir_list = '.'; # we start in the current directory # find all files and for each call ’wanted’ find({wanted => &wanted, no_chdir => 1}, @dir_list); sub wanted { my $name = $File::Find::name; if (-f $_ && $name =~ m/^(.+).txt$/) { # is a file and name ends in .txt my $prefix = $1; if($name =~ m/$searchstr/) { system(quot;make -f $makefile REDCLOTH=$path_to_scripts/redcloth $prefix.pdfquot;); system(quot;cp $prefix.pdf $abs_outdirquot;); } } } 11
  • 12. More Power: Domain Specific Languages general purpose scripting languages can do everything domain specific languages can do some things more efficiently they incorporate domain knowledge code is shorter, more expressive programs more efficient examples: XSLT, matlab, SQL, … 12
  • 13. Example: Domain Specific Languages XSLT XML to XML transformations declarative, template based <card type=quot;simplequot;> <name>John Doe</name> <email>doe@widget.com</email> <phone>(202) 456-1414</phone> </card> <?xml version=quot;1.0quot;?> <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;> <head> <title>business card</title> </head> <body> <h1>John Doe</h1> <p>email: <a href=quot;mailto:doe@widget.comquot;> doe@widget.com</a></p> <p>phone:(202) 456-1414</p> </body> </html> 13
  • 14. Example: Domain Specific Languages application specific XML XSL stylesheet <card type=quot;simplequot;> <xsl:stylesheet version=quot;1.0quot; <name>John Doe</name> <email>doe@widget.com</email> xmlns:xsl=quot;http://www.w3.org/1999/XSL/Transformquot; <phone>(202) 456-1414</phone> xmlns=quot;http://www.w3.org/1999/xhtmlquot;> </card> <xsl:template match=quot;card[@type='simple']quot;> <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;> <title>business card</title> <body> XML-to-XML <xsl:apply-templates select=quot;namequot;/> <xsl:apply-templates select=quot;emailquot;/> transformation <xsl:apply-templates select=quot;phonequot;/> </body> </html> </xsl:template> XHTML <?xml version=quot;1.0quot;?> <xsl:template match=quot;card/namequot;> <html <h1><xsl:value-of select=quot;text()quot;/></h1> xmlns=quot;http://www.w3.org/1999/xhtmlquot;> </xsl:template> <head> <title>business card</title> <xsl:template match=quot;emailquot;> </head> <p>email: <a href=quot;mailto:{text()}quot;> <body> <xsl:value-of select=quot;text()quot;/></a> <h1>John Doe</h1> </p> <p>email: </xsl:template> <a href=quot;mailto:doe@widget.comquot;> doe@widget.com</a></p> <xsl:template match=quot;phonequot;> <p>phone:(202) 456-1414</p> <p>phone:<xsl:value-of select=quot;text()quot;/></p> </body> </xsl:template> </html> </xsl:stylesheet> example adapted from http://www.brics.dk/~amoeller/XML/xslt-4.1.html 14
  • 15. Code Generation basic ideas DRY principle: keep information in one place only translate between representations of the same information simple to change active vs. passive code generators passive: generate code once (then modify manually) active: run each time the input data changes examples XML to XML transformations database and access functions: SQL tables and Java Code methods scripts domain specific languages … 15
  • 17. Building and Testing Software basic steps compile link test build strategy only do what is necessary (modification time) write down recipe in one place build tools (make, ant, ...) benefits incremental builds can be triggered by changes => continuous integration what about IDEs? can do the same with one click information distributed, not portable some IDEs can export build procedure as makefile 17
  • 18. Build Languages make, ant, cmake, imake, rake domain knowledge hierarchy of build targets build rules (templates e.g. File.java File.class) dependencies minimal incremental rebuilds general purpose or language specific example ant: knows about javac, jar, rmic, javah, javadoc, etc. tasks: archive, coverage, compile, deployment, execution, logging, scm, test, etc use for: automate build, test, packaging, deployment 18
  • 19. Example: Build Language REDCLOTH = redcloth HTML2PS = html2ps PS2PDF = distill %.html : %.txt $(REDCLOTH) $< > $@ %.ps : %.html $(HTML2PS) $< > $@ %.pdf : %.ps $(PS2PDF) $< %.clean : %.txt rm -f $*.ps $*.html 19
  • 20. Continuous Integration core idea: run build and test loop continuously watch repository for changes run build and tests publish status of the build and tests to developers build is successful if: - uses latest sources from version control - is built automatically - passes all unit tests and functional tests benefits detect errors early monitor code quality over time prevent integration problems 20
  • 21. Contiuous Integration 2 requires: automated building and testing use a single repository where anyone can get the current version of all sources (and all previous versions) automate the build process so that anyone can use a single command to build the system from the sources automate the testing so that you can run a good suite of tests on the system at any time with a single command tools CruiseControl CruiseControl.NET Tinderbox damagecontrol use established version-control, build and testing frameworks 21
  • 23. CruiseControl Case Study idea: automate validation and publishing of the workshop webpage basic steps validate XHTML validate CSS convert ASCII handouts to PDF publish on webserver main tool: CruiseControl ideal for java also other languages possible (as you will see) 23
  • 25. Directory Layout cruisecontrol/ myproj/ cc_builds/ build.xml project ant build file config.xml cc configuration Makefile cc-build.xml master build file -> trig. LICENSE checkouts/ co/myproj/build.xml README bin/ project-spec. autom. tools myproj/ checkout of myproj bar.sh ... build/ foo.pl logs/ build/ build results myproj/ prod/ production binaries status.txt build status for myproj test/ test/debug binaries log_buildno.xml build/test results for doc/ documentation (non-generated) artifacts/ buildno src/ sources spam.java myproj/ ham.java buildno/ test/ unit tests and functional tests build archive vendor/lib 3rd party libraries sample CruiseControl sample project directory layout directory layout 25
  • 26. CruiseControl: Configuration (config.xml) <cruisecontrol> <project name=quot;tecsw_workshopquot; buildafterfailed=quot;falsequot;> <modificationset quietperiod=quot;60quot; > <svn localWorkingCopy=quot;checkout/tecsw_workshopquot;/> </modificationset> <schedule interval=quot;120quot; > <ant buildfile=quot;cc-build.xmlquot; target=quot;buildquot;/> </schedule> <listeners> <currentbuildstatuslistener file=quot;logs/tecsw_workshop/status.txtquot;/> </listeners> <publishers> <artifactspublisher dir=quot;checkout/tecsw_workshop/buildquot; dest=quot;artifacts/tecsw_workshopquot;/> <htmlemail mailhost=quot;smtp.ee.ethz.chquot; returnaddress=quot;bleuler@tik.ee.ethz.chquot; buildresultsurl=quot;http://tik8.ee.ethz.ch:8080/cruisecontrol/buildresults/tecsw_workshopquot; logdir=quot;logs/tecsw_workshopquot; css=quot;webapps/cruisecontrol/css/cruisecontrol.cssquot; xsldir=quot;webapps/cruisecontrol/xslquot;> <always address=quot;bleulerquot;/> <failure address=quot;plesslquot; reportWhenFixed=quot;truequot; /> </htmlemail> </publishers> <log dir=quot;logs/tecsw_workshopquot;> <merge dir=quot;checkout/tecsw_workshop/build/resultsquot;/> </log> </project> </cruisecontrol> 26
  • 27. HTML validation report generation build rule in build.xml triggered whenever a modification to SVN repository occurs actual report is generated by validate_html.rb Ruby script validate_html calls W3C HTML validator (remote website) results are read, interpreted, and XML report is generated <project name=quot;sssequot; default=quot;allquot; basedir=quot;.quot;> <property name=quot;tools.dirquot; location=quot;toolsquot;/> <property name=quot;build.dirquot; location=quot;buildquot;/> <property name=quot;results.dirquot; location=quot;${build.dir}/resultsquot;/> <property name=quot;htmlpublish.dirquot; location=quot;${build.dir}/public_htmlquot;/> <property name=quot;htmlvalidation.dirquot; location=quot;${build.dir}/htmlvalidationquot;/> <target name=quot;validate_htmlquot; depends=quot;build_webpagequot; > <echo message = quot;Running the HTML validator on the websitequot; /> <exec executable=quot;${tools.dir}/validate_html.rbquot; failonerror=quot;truequot; output=quot;${results.dir}/html_validation_results.xmlquot;> <arg line=quot;${htmlpublish.dir} ${htmlvalidation.dir}quot; /> </exec> </target> </project> 27
  • 28. Build Results (log_buildno.xml) excerpt: <cruisecontrol> <modifications> subversion revision <modification type=quot;svnquot;> <file action=quot;addedquot;> information <revision>66</revision> <filename>/talks/8_releasing_software/release.ppt</filename> </file> <date>11/29/2005 13:46:57</date> <user>kuenzli</user> <comment><![CDATA[initial slide template]]></comment> <revision>66</revision> </modification> </modifications> <htmlvalidate> <passed errors=quot;0quot; report=quot;htmlvalidation/index.htmlquot; HTML validation file=quot;public_html/index.htmlquot; /> <failed errors=quot;14quot; report=quot;htmlvalidation/ie7/test.htmlquot; report file=quot;public_html/ie7/test.htmlquot; /> </htmlvalidate> </cruisecontrol> 28
  • 29. Publishing Process all build and test results are log_buildno.xml stored in a single XML file UnitTest Commit log Build Coding style HTML valid. XSL stylesheets XSL XSL XSL XSL XSL generate reports reports format UnitTest Commit log Build Coding style HTML valid. the build and report report report report report test results nicely HTML Email SMS various publisher publisher publisher publishers send results to developers 29
  • 30. Failed Build (HTML publisher) build information summary build errors and warnings test reports Subversion revision logfile comments HTML and CSS vali- dation report We have added this information for our case study 30
  • 31. Successfull Build (HTML publisher) 31
  • 32. A Bug has been fixed (Email publisher) email to all who committed since last successful build 32
  • 33. Simulation Runs and Analysis – An Example revision for a paper study comparing algorithms given algorithms in binaries and source synthetic data some scripts for converting output files (a few broken) multiple results directories per algorithm one parameter file per algorithm figures in the paper task: do exactly the same for another kind of synthetic data problems: what were the parameter settings for the different runs? which scripts were used for processing which results? which results did make it into the final figures? 33
  • 34. Simulation Runs and Analysis II conclusions “normal” project “everything” was there it was mostly useless Too many things had been performed manually. advice do not underestimate the amount of information in a few commands entered by hand automation is the most accurate form of documentation 34
  • 35. Reproducible Research - A Vision scientific experiments should be reproducible in computer science they really could be project.tar.gz results README figures data/ ./do_it_all.pl tables code/ do_it_all.pl Can I reproduce your results? 35
  • 36. Wrap up: Principles and Pitfalls of Project automation don’t repeat yourself DRY single source principle prefer convention over configuration + prefer modularity over generalization choose right granularity (rule of thumb: isolate long running tasks) you will always have to adapt small things: reduce barrier for change use domain specific tools trying to solve all possible problems don’t know when to stop ! re-invent the wheel 36
  • 37. Advice do not try to automate everything be familiar with the automation possibilities and judge yourself everyone should be intimate with a scripting language a build tool (make, ant, etc.) the most important shell commands one editor define a good project layout remove burden from developer of deciding what files to put where defined directory layout enable automation, e.g. self-testing stick to the layout! exchange code and solutions 37
  • 38. Literature A. Hunt and D. Thomas, The Pragmatic Programmer, Addison Wesley, 2000 D. Thomas et al., Programming Ruby, Pragmatic Bookshelf, L. Wall et al., Programming Perl, O’Reilly, 2000 T. Christiansen and N. Torkington, Perl Cookbook, O’Reilly, 1998 M. Clark, Pragmatic Project Automation, Pragmatic Bookshelf, 2004 http://cruisecontrol.sourceforge.net extensive list of code generators: http://www.codegeneration.net 38