SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Cocoon Best Practises
                  Lessons learnt during the development of big projects.


                                                     Or : How to avoid
                                                     my stupid mistakes



Speaker : Jeremy Quinn of Luminas
   Venue : Cocoon GT2004




                                                                                v. 1.0
                                                                                             1

I am (was) a developer for Luminas, a web development company in the UK, specialising
in Open Source solutions to industry.
Luminas is a member of the Orixo XML Business Alliance.
This presentation is about best practises for development of projects within Cocoon and
is a distillation of techniques culled from the Cocoon mail lists and my Orixo colleagues.
Contents
                 Usecases

                 Testing

                 Sitemap Usage

                 i18n

                 Relational Databases

                 Production

                 Going Live

                 Be a Good Citizen

                                                    2

The talk will be broken down into these sections.
Write Use Cases


                 Describe your project
                 Keep your use cases updated
                 Find the happy balance



                                                                                          3

Use cases are a formalised way of describing how a piece of software will work from the
point of view of specific ‘actors’, eg. Users, Admins, The System etc.
Luminas are in the process of preparing their in-house UseCaseML and sample XSLT for
the community to use. It is work in progress, so we hope others will get involved in
improving it.
Describe your Project

                 Developers need to know what
                 to do
                 Clients need to know what they
                 will get
                 Managers need to allocate
                 resources

                                                                                       4

Writing use cases is the stage when you make sure that everyone knows what is
supposed to be happening.
Use cases can be used to make sure everything that is being asked for is possible.
Everyone involved in a project needs to be able to flag up any issues involving their
domain.
Use cases can form the basis of the functional contract between you and the client.
Use cases can tell you when you have finished !!!
Keep it updated


                 Projects change
                 Your use cases should reflect this
                 Keep them versioned
                 Publish them online for the client


                                                                                       5

As the project changes due to engineering or client constraints, your usecases should be
updated to reflect the changes.
This allows both the client and the developers to keep in sync and make sure changes
are properly described and possible to implement.
Keep your use cases in a versioning repository like your source code. Code releases will
typically be related to use case versions.
Find the balance


                 Enough detail for it to be useful
                 for the developer
                 Written in language the client
                 can understand



                                                                                         6

Finding the happy ground between descriptions the client can understand and a level of
detail that is useful for the developer can be dificult.
Use cases should not be considered a marketing document, but an engineering
document.
Luminas use them as the point of communication between developer and client.
They need to be written in collaboration between both groups.
Home
                                 Use Case:
                 AAF Files
                 AAF Editor          Use case ID: UC-3.0
                 Documentation   Use case title: Programme Screen
                 - AAF Reader            Project: BBC XML-AAF Editor
                 - Editor
                                          Scope: BBC AAF Management System
                 Usecases
                 - Editor                  Level: Unknown
                 - XSLT                  Author: Jeremy Quinn
                                          Status: Draft
                                         Version: 1.0

                                 Summary
                                 A programme screen, where the viewer is able to edit information about the
                                 Programme

                                 Overview
                                  Goal in context: The viewer is able to edit basic information about the
                                                   Programme.
                                     Preconditions: There are StoryBoards to view.
                                           Success     The viewer can edit and save the relevant information.
                                         guarantee:
                                            Minimal    N/A
                                         guarantee:
                                       Performance     Unknown
                                             target:
                                           Invoked:    Often
                                            Priority: Must
                                            Trigger: The Viewer's desire to edit info about the Programme

                                 Main success scenario
                                 Step Actor Description
                                 1    Author can edit the fields specified in UC-3.1
                                 2       Author can save etc. their changes using the buttons specified in UC-
                                                3.2
                                 3       Author can use the download button specified in UC-3.3

                                 Extensions
                                 Step          Condition               Actor         Description
                                 1

                                 Variations
                                 Step Domain Actor Description
                                 2    Unknown Author cancels the screen's actions, is then directed to
                                                     UC-2.0

                                 Notes

                                                                                                                 7

This is a slim sample from an ongoing project at Luminas.
You can see from this a description of a single use case, and how it relates to other use
cases.
We are still learning how to use this tool eectively.
Testing

                 Continuous testing
                   CruiseControl, Gump etc.

                 Write unit tests
                   jUnit, ejbUnit, Cactus etc.

                 Automate functional tests
                   AntEater, httpUnit, Cactus etc.



                                                                                             8

Products like Cruisecontrol or Gump can be used for continuous testing (Luminas do not
actually do this yet).
Write unit tests for business objects. Tests can be run by Ant, Eclipse or Maven etc. Test
suites include jUnit, Cactus, ejbUnit etc., Luminas currently use jUnit.
Tests should be conducted before the code is used from FlowScript etc.
Run the tests before committing code to reassure yourself that you are not breaking
anything.
Use AntEater, httpUnit, Cactus etc. for automated functional tests.
Maven can impose many of these best practises on you.
Sitemap Usage


                  Design your URI request space
                  Setup the top level
                  Use Sub-Sitemaps
                  Use Resources



                                                                      9

The sitemap is a key and maybe unique Cocoon resource.
Learning to use it eectively is key to using Cocoon eficiently.
Design your URIs

                 Make URIs memorable
                 Principle of least surprise
                   Use suffixes consistently

                   Make sure / goes somewhere sensible

                 No accented characters


                                                                                       10

Fine control of your URI request space is central to Cocoon.
Design your URL request-space early on.
A URI is a contract with the world.
Clean URIs are an important aspect of the overall good design of your site.
We use sufixes for static content, especially where we may need to provide that content
in dierent formats like HTML, PDF, WAP etc. but we tend to avoid using sufixes within
the webapp part of projects.
Output relative URLs so Development and Live can work within dierent URL contexts, as
you will probably want to serve this behind a virtualhost via Apache mod_proxy.
Setup the top level

                 Components
                 Error handling
                 Authentication regions
                 Mounting sub-sitemaps
                 Simple static pipelines

                                                                                           11

Your top level (project) sitemap should be set up carefully
Don’t rely on the default components from the main Cocoon sitemap, these could
change when you update Cocoon. Be specific.
Declare the Components you actually use and parameterise them according to how you
need to use them in the project.
We declare authentication regions in the top-level Project sitemap, but keep
authentication in it’s own sitemap.
Some recommend using the container for authentication.
If you have simple url patterns for simple static content, that is re-used in many URIs,
the top-level Project Sitemap is a good place for these.
Use Sub-SiteMaps


                 Keeps sitemaps small
                 Break your URI space down into
                 sub-sitemaps
                 Separate functionality into sub-
                 sitemaps


                                                                                      12

Keep sitemaps as small as reasonably possible, this makes debugging problems much
easier, aids maintainability and makes them easier to understand.
The use of sub-sitemaps makes this possible.
Keep similar bits of functionality together, so that pipelines can share resources.
Use Resources


                map:resource
                 Aids re-use

                 Aids readability

                 Aids management

                Use good naming schemes


                                                                         13

Read and understand the Wiki entry : “CleanerSiteMapsThroughResources”
Always use i18n

                 Labels sent to the user
                  CForms

                  Messages from FlowScript

                  JX Template

                 Localise dates and numbers
                 Test UTF-8 cross-platform

                                                                                       14

Always use i18n for messages or labels sent to the user, regardless of whether you
expect there to be translations to other languages.
Never embed user strings in flowscript etc. it makes maintenance a nightmare.
i18n dictionaries can be passed o to those with writing skills i.e. they should not be
written by developers, remember what they say about developers not being able to write
documentation !!!
We have experienced problems with dierent Server OSes outputting UTF-8
inconsistently, specifically the ‘high’ characters. Test thoroughly!!!
Relational Databases


                 Use persistence frameworks
                   Apache ORB/OJB

                   Hibernate

                   Spring tools




                                                                                          15

If you are reading from and/or writing to SQL databases, particularly business objects,
the use of persistence frameworks can assist you to separate your logic from the
structure of your database tables.
Persistence
                A sample mapping between a Bean and an SQL Table


   hibernate-mapping package=quot;org.project.beanquot;
     class name=quot;Imagequot; table=quot;imagequot;
     meta attribute=quot;class-descriptionquot;
       This bean represents the basic information about an Image.
     /meta
     meta attribute=quot;implementsquot;Persistable/meta
     id name=quot;idquot; column=quot;idquot; type=quot;longquot;
       generator class=quot;sequencequot;
         param name=quot;sequencequot;image_id_seq/param
       /generator
     /id
     discriminator column=quot;classquot; type=quot;stringquot; force=quot;falsequot;/
     property name=quot;titlequot; type=quot;stringquot; not-null=quot;truequot;/
     property name=quot;descriptionquot; type=quot;stringquot;/
     many-to-one name=quot;imagecategoryquot; class=quot;ImageCategoryquot;
       column=quot;image_category_idquot;/
     ...
   /hibernate-mapping




                                                                                     16

This is a snippet from a Hibernate mapping file showing how a Bean may be mapped to
SQL Tables.
Persistence
                  Some sample flowscript to access an SQL Table as a Bean

      function imageRecord() {
        var factory = cocoon.getComponent(PersistanceFactory.ROLE);
        var session = factory.createSession();
        try {
          var id = new Long(cocoon.parameters[quot;imageidquot;]);

            var image = ImagePeer.load(session, id);
            if (image != null) {
              cocoon.sendPage(cocoon.parameters[quot;screenquot;], { image: image });
            } else {
              cocoon.sendPage(quot;screen/errorquot;, {message: quot;non.existant.recordquot;});
            }
          } catch (e) {
            cocoon.log.error(e);
            cocoon.sendPage(quot;screen/errorquot;, {message: e});
          } finally {
            session.close();
            cocoon.releaseComponent(factory);
          }
      }



                                                                                           17

This is a simple function that loads a named entity from SQL as a Bean that is passed to
JXTG for display.
Flowscript


                 Explicitly pass parameters
                 Write business logic in Java
                 Flow  Actions  XSP



                                                                                          18

Explicitly pass parameters from your sitemap to flowscript, rather than asking for
arbitrary parameters from request (etc.) in flowscript, as the sitemap will quickly show
you what the input contract required by the flowscript should be.
It is possible to use Chained Input Modules to provide defaults for missing request
params (eg. Wiki: WorkingWithLocales).
Write complex business logic in Java, call those methods from flowscript (though
flowscript can be used to prototype those classes).
Prefer Flow over Actions, and Actions over XSP.
Development


                Use SCM tools
                Replicate the environment
                Use Bugzilla




                                                               19

Choose a development environment that suits your real needs.
Source Code

                 Test before committing
                 Commit early, commit often
                 Don’t commit built material
                 Don’t commit local customisation
                 Read commit-mails

                                                                                        20

Use Source Code Management tools like CVS or Subversion etc.
Test before committing, to save holding up other people with your new bugs.
Don't hang around until you've finished the entire project, get discrete functioning units
committed as soon as they work.
Always write proper comments in your commits.
Don't check-in generated build results, rebuild them on each build-run. Don’t commit
local.build.properties.
Provide commitmails and viewcvs.cgi on your repos.
Read the commit mails, to keep up with what others on your team are doing !!!
Replicate

                  Choose a build pattern
                  Make Ant scripts that build into
                  a Cocoon distribution
                  Make build scripts that strip your
                  project out of Cocoon
                  Allow developers to override
                  defaults values
                                                                                          21

For a consistent development environment, you want to make a project that patches itself
into Cocoon (and cleans itself out) in a predictable way, so that anyone doing work in it is
not going to introduce bugs merely due to the way they have the project set up.
If you have databases in your project, have scripts that load a consistent test dataset into
them.
Choose one of the build patterns in the Wiki: ”YourCocoonBasedProject”,
“YourCocoonBasedProjectAnt16”, “ ProjectBuilding”.
The main criteria seem to be:

 One or many developers.

 One or many concurrent projects.
The combination of Ant, XConfPatch Task and build.properties can be used very
eectively for this. local.build.properties can be used for customisation.
Typical tasks: “help”, “init”, “compile”, “clean”, “test”, “doc”.
Bugzilla


                 Track bugs
                 Discuss details
                 Track change requests



                                                                                       22

Use tools like Bugzilla in your own projects.
You can use it for notifying the group of the addition and completion of bugs, tracking
their progress and discussing their details.
“Bug” can seem like a very rude word to the hard-working developer .... I remember
feeling “That is not a bug, it is the result of a poor specification !!”.
Remember, “Bugs” can include visual, behavioural, communicative and logical problems
with all aspects of the project, not just the source code. Bugs can include enhancements
and feature requests.
Tip: Warn developers to mind their language if the client is subscribed to Bugzilla as
well ;)
Going Live

                Minimise log messages
                Disable dangerous features
                Hide Cocoon behind Apache
                Serve static assets via Apache



                                                                                      23

Turn o debug messages in logkit.xconf.
Disable dangerous components and features, including views, cocoon-reload, cocoon-
status, cache-clearance etc.
Don't run cocoon in a publicly-visible way.
Close the ports used by your Servlet engine.
Run with a front-end proxy (see the Wiki: “ApacheModProxy”).
Get Apache to provide error pages if the Servlet goes down or is under maintenance.
This way developers working directly from the Servlet, get to see verbose error
messages, while users see something polite.
Write an Ant Task for automating the creation of a special version for going live.
Serve static resources (images, css, javascript, etc.) directly via Apache.
Be a good citizen


                 Read the manual
                 Search the Wiki or Mail Lists
                 Ask on the User’s List
                 Write your solution in the Wiki
                 Report errors in the documentation

                                                                                      24

If you don't know how to do something, read the documentation on the cocoon site.
Search the Wiki and the mailing lists.
If you still cannot find a solution, ask on the users list.
If you can't find documentation for something and then later work out how to do it, be a
good citizen and write it up in the Wiki.
If you find mistakes in the code or documentation, submit a patch or at least a bug
report.
Last Words


                  Be liberal in what you accept
                  Be strict in what you send
                  Separate concerns ruthlessly



                                                                                         25

When pulling in external content, pass it through Tidy if it is HTML, and clean it through
XSLT in an intelligent way if it is XML, so that the mess made by others cannot break
your processes.
When handling URIs, apply the “Process of least surprise”, when handling form inputs,
provide sensible defaults for missing values where possible.
When sending pages, make sure you validate against the relevant standards. When you
output HTML, validate against the WAI standards.
Don’t fight against the SoC that is embedded in Cocoon, embrace it, it is your friend!!!
There is a very good reason Cocoon works like that. Even if you are a sole developer
prototyping a project, separate!!! Sooner or later, other people will be sharing the work.

Mais conteúdo relacionado

Mais procurados

Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013hannahmorse
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013Paigeward96
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013Tooney1994
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013ChristianO96
 
Ig3 music video_assignment_updated_02.2013
Ig3 music video_assignment_updated_02.2013Ig3 music video_assignment_updated_02.2013
Ig3 music video_assignment_updated_02.2013rogernator1996
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013k_ishii_
 
Agile Project Management and Scrum Introduction
Agile Project Management and Scrum IntroductionAgile Project Management and Scrum Introduction
Agile Project Management and Scrum IntroductionEric Krock
 
Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12BirdieProductions
 

Mais procurados (8)

Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013
 
Ig3 music video_assignment_updated_02.2013
Ig3 music video_assignment_updated_02.2013Ig3 music video_assignment_updated_02.2013
Ig3 music video_assignment_updated_02.2013
 
Ig3 music_video_assignment_updated_02.2013
 Ig3 music_video_assignment_updated_02.2013 Ig3 music_video_assignment_updated_02.2013
Ig3 music_video_assignment_updated_02.2013
 
Agile Project Management and Scrum Introduction
Agile Project Management and Scrum IntroductionAgile Project Management and Scrum Introduction
Agile Project Management and Scrum Introduction
 
Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12
 

Semelhante a Cocoon Best Practises

Converting to the latest COBOL Compiler made simple with the right tools
Converting to the latest COBOL Compiler made simple with the right toolsConverting to the latest COBOL Compiler made simple with the right tools
Converting to the latest COBOL Compiler made simple with the right toolsDevOps for Enterprise Systems
 
Randori design goals and justification
Randori design goals and justificationRandori design goals and justification
Randori design goals and justificationmichael.labriola
 
A New Paradigm In Linux Debug From Viosoft
A New Paradigm In Linux Debug From ViosoftA New Paradigm In Linux Debug From Viosoft
A New Paradigm In Linux Debug From Viosoftguestc28df4
 
How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react MoonTechnolabsPvtLtd
 
A New Paradigm In Linux Debug From Viosoft Corporation
A New Paradigm In Linux Debug From Viosoft CorporationA New Paradigm In Linux Debug From Viosoft Corporation
A New Paradigm In Linux Debug From Viosoft Corporationart_lee
 
Sa 006 modifiability
Sa 006 modifiabilitySa 006 modifiability
Sa 006 modifiabilityFrank Gielen
 
What’s new for Developers in IBM Domino & Domino Designer 9.0.1
What’s new for Developers in IBM Domino & Domino Designer 9.0.1What’s new for Developers in IBM Domino & Domino Designer 9.0.1
What’s new for Developers in IBM Domino & Domino Designer 9.0.1IBM Connections Developers
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kuberneteskloia
 
Starting Fresh Every Morning Paper
Starting Fresh Every Morning PaperStarting Fresh Every Morning Paper
Starting Fresh Every Morning Paperyannmonclair
 
A two stage feature selection method for text categorization
A two stage feature selection method for text categorizationA two stage feature selection method for text categorization
A two stage feature selection method for text categorizationParag Tamhane
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD123abcda
 
Fundamentals of Using Open Source Code to Build Products
Fundamentals of Using Open Source Code to Build ProductsFundamentals of Using Open Source Code to Build Products
Fundamentals of Using Open Source Code to Build ProductsBrian Warner
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM toolsLarry Cai
 

Semelhante a Cocoon Best Practises (20)

Converting to the latest COBOL Compiler made simple with the right tools
Converting to the latest COBOL Compiler made simple with the right toolsConverting to the latest COBOL Compiler made simple with the right tools
Converting to the latest COBOL Compiler made simple with the right tools
 
Lect1
Lect1Lect1
Lect1
 
Anmol
AnmolAnmol
Anmol
 
Randori design goals and justification
Randori design goals and justificationRandori design goals and justification
Randori design goals and justification
 
A New Paradigm In Linux Debug From Viosoft
A New Paradigm In Linux Debug From ViosoftA New Paradigm In Linux Debug From Viosoft
A New Paradigm In Linux Debug From Viosoft
 
How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react
 
A New Paradigm In Linux Debug From Viosoft Corporation
A New Paradigm In Linux Debug From Viosoft CorporationA New Paradigm In Linux Debug From Viosoft Corporation
A New Paradigm In Linux Debug From Viosoft Corporation
 
Sa 006 modifiability
Sa 006 modifiabilitySa 006 modifiability
Sa 006 modifiability
 
Visusual basic
Visusual basicVisusual basic
Visusual basic
 
What’s new for Developers in IBM Domino & Domino Designer 9.0.1
What’s new for Developers in IBM Domino & Domino Designer 9.0.1What’s new for Developers in IBM Domino & Domino Designer 9.0.1
What’s new for Developers in IBM Domino & Domino Designer 9.0.1
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
Ex11 mini project
Ex11 mini projectEx11 mini project
Ex11 mini project
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Starting Fresh Every Morning Paper
Starting Fresh Every Morning PaperStarting Fresh Every Morning Paper
Starting Fresh Every Morning Paper
 
Birendra_resume
Birendra_resumeBirendra_resume
Birendra_resume
 
A two stage feature selection method for text categorization
A two stage feature selection method for text categorizationA two stage feature selection method for text categorization
A two stage feature selection method for text categorization
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
 
Fundamentals of Using Open Source Code to Build Products
Fundamentals of Using Open Source Code to Build ProductsFundamentals of Using Open Source Code to Build Products
Fundamentals of Using Open Source Code to Build Products
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
 

Último

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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 DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Cocoon Best Practises

  • 1. Cocoon Best Practises Lessons learnt during the development of big projects. Or : How to avoid my stupid mistakes Speaker : Jeremy Quinn of Luminas Venue : Cocoon GT2004 v. 1.0 1 I am (was) a developer for Luminas, a web development company in the UK, specialising in Open Source solutions to industry. Luminas is a member of the Orixo XML Business Alliance. This presentation is about best practises for development of projects within Cocoon and is a distillation of techniques culled from the Cocoon mail lists and my Orixo colleagues.
  • 2. Contents Usecases Testing Sitemap Usage i18n Relational Databases Production Going Live Be a Good Citizen 2 The talk will be broken down into these sections.
  • 3. Write Use Cases Describe your project Keep your use cases updated Find the happy balance 3 Use cases are a formalised way of describing how a piece of software will work from the point of view of specific ‘actors’, eg. Users, Admins, The System etc. Luminas are in the process of preparing their in-house UseCaseML and sample XSLT for the community to use. It is work in progress, so we hope others will get involved in improving it.
  • 4. Describe your Project Developers need to know what to do Clients need to know what they will get Managers need to allocate resources 4 Writing use cases is the stage when you make sure that everyone knows what is supposed to be happening. Use cases can be used to make sure everything that is being asked for is possible. Everyone involved in a project needs to be able to flag up any issues involving their domain. Use cases can form the basis of the functional contract between you and the client. Use cases can tell you when you have finished !!!
  • 5. Keep it updated Projects change Your use cases should reflect this Keep them versioned Publish them online for the client 5 As the project changes due to engineering or client constraints, your usecases should be updated to reflect the changes. This allows both the client and the developers to keep in sync and make sure changes are properly described and possible to implement. Keep your use cases in a versioning repository like your source code. Code releases will typically be related to use case versions.
  • 6. Find the balance Enough detail for it to be useful for the developer Written in language the client can understand 6 Finding the happy ground between descriptions the client can understand and a level of detail that is useful for the developer can be dificult. Use cases should not be considered a marketing document, but an engineering document. Luminas use them as the point of communication between developer and client. They need to be written in collaboration between both groups.
  • 7. Home Use Case: AAF Files AAF Editor Use case ID: UC-3.0 Documentation Use case title: Programme Screen - AAF Reader Project: BBC XML-AAF Editor - Editor Scope: BBC AAF Management System Usecases - Editor Level: Unknown - XSLT Author: Jeremy Quinn Status: Draft Version: 1.0 Summary A programme screen, where the viewer is able to edit information about the Programme Overview Goal in context: The viewer is able to edit basic information about the Programme. Preconditions: There are StoryBoards to view. Success The viewer can edit and save the relevant information. guarantee: Minimal N/A guarantee: Performance Unknown target: Invoked: Often Priority: Must Trigger: The Viewer's desire to edit info about the Programme Main success scenario Step Actor Description 1 Author can edit the fields specified in UC-3.1 2 Author can save etc. their changes using the buttons specified in UC- 3.2 3 Author can use the download button specified in UC-3.3 Extensions Step Condition Actor Description 1 Variations Step Domain Actor Description 2 Unknown Author cancels the screen's actions, is then directed to UC-2.0 Notes 7 This is a slim sample from an ongoing project at Luminas. You can see from this a description of a single use case, and how it relates to other use cases. We are still learning how to use this tool eectively.
  • 8. Testing Continuous testing CruiseControl, Gump etc. Write unit tests jUnit, ejbUnit, Cactus etc. Automate functional tests AntEater, httpUnit, Cactus etc. 8 Products like Cruisecontrol or Gump can be used for continuous testing (Luminas do not actually do this yet). Write unit tests for business objects. Tests can be run by Ant, Eclipse or Maven etc. Test suites include jUnit, Cactus, ejbUnit etc., Luminas currently use jUnit. Tests should be conducted before the code is used from FlowScript etc. Run the tests before committing code to reassure yourself that you are not breaking anything. Use AntEater, httpUnit, Cactus etc. for automated functional tests. Maven can impose many of these best practises on you.
  • 9. Sitemap Usage Design your URI request space Setup the top level Use Sub-Sitemaps Use Resources 9 The sitemap is a key and maybe unique Cocoon resource. Learning to use it eectively is key to using Cocoon eficiently.
  • 10. Design your URIs Make URIs memorable Principle of least surprise Use suffixes consistently Make sure / goes somewhere sensible No accented characters 10 Fine control of your URI request space is central to Cocoon. Design your URL request-space early on. A URI is a contract with the world. Clean URIs are an important aspect of the overall good design of your site. We use sufixes for static content, especially where we may need to provide that content in dierent formats like HTML, PDF, WAP etc. but we tend to avoid using sufixes within the webapp part of projects. Output relative URLs so Development and Live can work within dierent URL contexts, as you will probably want to serve this behind a virtualhost via Apache mod_proxy.
  • 11. Setup the top level Components Error handling Authentication regions Mounting sub-sitemaps Simple static pipelines 11 Your top level (project) sitemap should be set up carefully Don’t rely on the default components from the main Cocoon sitemap, these could change when you update Cocoon. Be specific. Declare the Components you actually use and parameterise them according to how you need to use them in the project. We declare authentication regions in the top-level Project sitemap, but keep authentication in it’s own sitemap. Some recommend using the container for authentication. If you have simple url patterns for simple static content, that is re-used in many URIs, the top-level Project Sitemap is a good place for these.
  • 12. Use Sub-SiteMaps Keeps sitemaps small Break your URI space down into sub-sitemaps Separate functionality into sub- sitemaps 12 Keep sitemaps as small as reasonably possible, this makes debugging problems much easier, aids maintainability and makes them easier to understand. The use of sub-sitemaps makes this possible. Keep similar bits of functionality together, so that pipelines can share resources.
  • 13. Use Resources map:resource Aids re-use Aids readability Aids management Use good naming schemes 13 Read and understand the Wiki entry : “CleanerSiteMapsThroughResources”
  • 14. Always use i18n Labels sent to the user CForms Messages from FlowScript JX Template Localise dates and numbers Test UTF-8 cross-platform 14 Always use i18n for messages or labels sent to the user, regardless of whether you expect there to be translations to other languages. Never embed user strings in flowscript etc. it makes maintenance a nightmare. i18n dictionaries can be passed o to those with writing skills i.e. they should not be written by developers, remember what they say about developers not being able to write documentation !!! We have experienced problems with dierent Server OSes outputting UTF-8 inconsistently, specifically the ‘high’ characters. Test thoroughly!!!
  • 15. Relational Databases Use persistence frameworks Apache ORB/OJB Hibernate Spring tools 15 If you are reading from and/or writing to SQL databases, particularly business objects, the use of persistence frameworks can assist you to separate your logic from the structure of your database tables.
  • 16. Persistence A sample mapping between a Bean and an SQL Table hibernate-mapping package=quot;org.project.beanquot; class name=quot;Imagequot; table=quot;imagequot; meta attribute=quot;class-descriptionquot; This bean represents the basic information about an Image. /meta meta attribute=quot;implementsquot;Persistable/meta id name=quot;idquot; column=quot;idquot; type=quot;longquot; generator class=quot;sequencequot; param name=quot;sequencequot;image_id_seq/param /generator /id discriminator column=quot;classquot; type=quot;stringquot; force=quot;falsequot;/ property name=quot;titlequot; type=quot;stringquot; not-null=quot;truequot;/ property name=quot;descriptionquot; type=quot;stringquot;/ many-to-one name=quot;imagecategoryquot; class=quot;ImageCategoryquot; column=quot;image_category_idquot;/ ... /hibernate-mapping 16 This is a snippet from a Hibernate mapping file showing how a Bean may be mapped to SQL Tables.
  • 17. Persistence Some sample flowscript to access an SQL Table as a Bean function imageRecord() { var factory = cocoon.getComponent(PersistanceFactory.ROLE); var session = factory.createSession(); try { var id = new Long(cocoon.parameters[quot;imageidquot;]); var image = ImagePeer.load(session, id); if (image != null) { cocoon.sendPage(cocoon.parameters[quot;screenquot;], { image: image }); } else { cocoon.sendPage(quot;screen/errorquot;, {message: quot;non.existant.recordquot;}); } } catch (e) { cocoon.log.error(e); cocoon.sendPage(quot;screen/errorquot;, {message: e}); } finally { session.close(); cocoon.releaseComponent(factory); } } 17 This is a simple function that loads a named entity from SQL as a Bean that is passed to JXTG for display.
  • 18. Flowscript Explicitly pass parameters Write business logic in Java Flow Actions XSP 18 Explicitly pass parameters from your sitemap to flowscript, rather than asking for arbitrary parameters from request (etc.) in flowscript, as the sitemap will quickly show you what the input contract required by the flowscript should be. It is possible to use Chained Input Modules to provide defaults for missing request params (eg. Wiki: WorkingWithLocales). Write complex business logic in Java, call those methods from flowscript (though flowscript can be used to prototype those classes). Prefer Flow over Actions, and Actions over XSP.
  • 19. Development Use SCM tools Replicate the environment Use Bugzilla 19 Choose a development environment that suits your real needs.
  • 20. Source Code Test before committing Commit early, commit often Don’t commit built material Don’t commit local customisation Read commit-mails 20 Use Source Code Management tools like CVS or Subversion etc. Test before committing, to save holding up other people with your new bugs. Don't hang around until you've finished the entire project, get discrete functioning units committed as soon as they work. Always write proper comments in your commits. Don't check-in generated build results, rebuild them on each build-run. Don’t commit local.build.properties. Provide commitmails and viewcvs.cgi on your repos. Read the commit mails, to keep up with what others on your team are doing !!!
  • 21. Replicate Choose a build pattern Make Ant scripts that build into a Cocoon distribution Make build scripts that strip your project out of Cocoon Allow developers to override defaults values 21 For a consistent development environment, you want to make a project that patches itself into Cocoon (and cleans itself out) in a predictable way, so that anyone doing work in it is not going to introduce bugs merely due to the way they have the project set up. If you have databases in your project, have scripts that load a consistent test dataset into them. Choose one of the build patterns in the Wiki: ”YourCocoonBasedProject”, “YourCocoonBasedProjectAnt16”, “ ProjectBuilding”. The main criteria seem to be: One or many developers. One or many concurrent projects. The combination of Ant, XConfPatch Task and build.properties can be used very eectively for this. local.build.properties can be used for customisation. Typical tasks: “help”, “init”, “compile”, “clean”, “test”, “doc”.
  • 22. Bugzilla Track bugs Discuss details Track change requests 22 Use tools like Bugzilla in your own projects. You can use it for notifying the group of the addition and completion of bugs, tracking their progress and discussing their details. “Bug” can seem like a very rude word to the hard-working developer .... I remember feeling “That is not a bug, it is the result of a poor specification !!”. Remember, “Bugs” can include visual, behavioural, communicative and logical problems with all aspects of the project, not just the source code. Bugs can include enhancements and feature requests. Tip: Warn developers to mind their language if the client is subscribed to Bugzilla as well ;)
  • 23. Going Live Minimise log messages Disable dangerous features Hide Cocoon behind Apache Serve static assets via Apache 23 Turn o debug messages in logkit.xconf. Disable dangerous components and features, including views, cocoon-reload, cocoon- status, cache-clearance etc. Don't run cocoon in a publicly-visible way. Close the ports used by your Servlet engine. Run with a front-end proxy (see the Wiki: “ApacheModProxy”). Get Apache to provide error pages if the Servlet goes down or is under maintenance. This way developers working directly from the Servlet, get to see verbose error messages, while users see something polite. Write an Ant Task for automating the creation of a special version for going live. Serve static resources (images, css, javascript, etc.) directly via Apache.
  • 24. Be a good citizen Read the manual Search the Wiki or Mail Lists Ask on the User’s List Write your solution in the Wiki Report errors in the documentation 24 If you don't know how to do something, read the documentation on the cocoon site. Search the Wiki and the mailing lists. If you still cannot find a solution, ask on the users list. If you can't find documentation for something and then later work out how to do it, be a good citizen and write it up in the Wiki. If you find mistakes in the code or documentation, submit a patch or at least a bug report.
  • 25. Last Words Be liberal in what you accept Be strict in what you send Separate concerns ruthlessly 25 When pulling in external content, pass it through Tidy if it is HTML, and clean it through XSLT in an intelligent way if it is XML, so that the mess made by others cannot break your processes. When handling URIs, apply the “Process of least surprise”, when handling form inputs, provide sensible defaults for missing values where possible. When sending pages, make sure you validate against the relevant standards. When you output HTML, validate against the WAI standards. Don’t fight against the SoC that is embedded in Cocoon, embrace it, it is your friend!!! There is a very good reason Cocoon works like that. Even if you are a sole developer prototyping a project, separate!!! Sooner or later, other people will be sharing the work.