View
4.410
Download
3
Tags:
Embed Size (px)
DESCRIPTION
One of the hidden gems of the XML technology milieu is XQuery ... even if XML is not your thing (for example you work only with JSON) I will show you how XQuery is especially adept and super fast in terms of pure web development. And if you do happen to have a lot of XML I will also demonstrate how this concise, small data orientated language can result in serious productivity gains over other programming languages. XQuery is available today on the server, in the browser (mobile devices) and large deployments in both commercial and open source environments. This talk will present both anecdotal and evidence based analysis showing how using XQuery can result in quicker development times over other programming languages when applied to the right scenarios and will try to help give a starting point to those wishing to investigate this extremely powerful little language.
Citation preview
XQUERY – THE GETTING STUFF DONE LANGUAGE
Jim Fuller, Principle ConsultantMarkLogic
XQuery - The Getting Stuff Done language
Jim Fulleremail: [email protected] twitter: @xqueryPrincipal Consultant, Europe13/10/11
I will try XQuery
Agenda
The 5 W’s
Cool Stuff
Xquery Overview
Survey Results and Analysis
Summary
5W’s Scientific Method
What’s the problem ?
The Mythical Man Month- Fred Brooks
'All programmers are optimists.’
'Adding manpower to a late software project makes it later.’
'The fundamental problem with program maintenance is that fixing a defect has a substantial (20-50 percent) chance of
introducing another.’
Problem #1 - Programming is hard
'building software will always be hard. There is no silver bullet.'
Data problems
relaxing constraints in vogue
multifarious data models
impedance mismatch
BigData Opportunity* http://gigaom.com/cloud/big-data-equals-big-opportunities-for-businesses-infographic/
BigData Opportunity* http://gigaom.com/cloud/big-data-equals-big-opportunities-for-businesses-infographic/
Problem #2 - Your boss knows about the Big Data opportunity
managing data variability, volume & velocity is hard
Why again ..
Solution #1: Choosing the right language can result in 4-5 times greater productivity
Solution #2 – Choose a language that mitigates risks associated with BigData
XQuery Overview
I will try XQuery
X Q u e r y X Q u e r y
misconceptions
The dynamic functional language
Domain specific language
XPATH^2
Strongly typed
SQL like –Inner Join
SELECT * FROM employee, department WHERE employee.DepartmentID = department.DepartmentID;
for $emp in //employeereturn
$emp[@deptid eq //dept/@id]
SQL like – left Outer Join
for $u in fn:collection(‘customers’)return <customer id={$u/custno} name=“{$u/name}”> { for $p in fn:collection(”purchaseorders”)//po where $u/custno = $p//custno
return <po>{$p/@id}</po> } </customer>
Functions
declare function local:hello($name) { concat("Hello ", $name)};
local:hello(”Aarhus!")
Code in the language of the domain
declare function local:test($a,$b,$c,$d,$e,$f,$g,$h,$i,$k){ …..};
declare function local:test($a as element(record)
){ ……};
Literals and Constructorsxquery version "1.0";
let $names := ("Jim","Gabi","Vojtech","Norm","Nuno","Eric")return<names>{ for $name in $names return <name>{$name}</name> }</names>
(:
element {$computed-element-name}{ attribute {$computed-attr-name}{"some attr value"}}
:)
Broad applicability
http://github.com/xquery/xquerydoc – XQuery parsing XQuery
IBM Developerworks – Classify content with XQuery article
http://try.zorba-xquery.com/
XQuery + database
http://demo.exist-db.org/exist/eXide/index.html
MarkLogic
EVALUATION LAYER
EvaluatorXSLT | XPath | XQuery
Shared-Nothing Protocol
Buffer
DATA LAYERData Cache
Compressed StorageXML | Binary | Text
IndexesValue | Structure | Text | Scalar | Metadata | Security | Geospatial | Reverse
Transaction Journal
Transaction ControllerMultiversion Concurrency Control
APPLICATION SERVICES
HTTP | HTTPS | XDBC | WebDAV | REST | AJAX / JSON
Information Studio API
Library Services APISearch API
Analysis
I will try XQuery
Programming Language ProductivityData compiled from studies by Prechelt and Garret of a particular string processing problem - public domain 2006.
Programming Language ProductivityData compiled from studies by Prechelt and Garret of a particular string processing problem - public domain 2006.
Nooooo!
#loc per FP=
Lines of codePer
Function Point
Methodology
Project Uncertainty Principle
An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl for a
search/string-processing programLutz Prechelt ([email protected]) Fakulta t fu r Informatik ̈ ̈
Universita t Karlsruhe ̈
Language #loc per Function PointC 91
C++ 53Java 54Perl 21
* Designing and writing programs using dynamic languages tended to take half as long as well as resulting in half the code.
Developing an Enterprise Web Application in Xquery - 2009 Martin Kaufmann, Donald Kossmann
Java/J2EE XQueryModel 3100 240View 4100 1500Controller 900 1180
8100 (?) 2920 (3490)
* 28msec – 2011 http://www.28msec.com/html/home
Java XQuerySimpleDB 2905 572S3 8589 1469SNS 2309 455
13803 2496
Review 11 projects
FP AnalysisCalc FP inputs/outputsCalc VAF (0.65 + [ (Ci) / 100])
AVP = VAF * sum(FP)
* FP overview - http://www.softwaremetrics.com/fpafund.htm
#locusing cloc
= #loc per FP
Language #loc per Function PointEiffel 21SQL 13-30
XQuery 27-33Haskell 38Erlang 40Python 42-47
Java 50-80Javascript 50-55Scheme 53
C++ 59-80C 128-140
Do Software Language Engineers Evaluate their Languages?
2011 - CITI, Departamento de Informa tica, Faculdade de Ciˆencias e Tecnologia, FCT, ́Universidade Nova de Lisboa, 2829-516 Caparica, Portugal [email protected],{miguel.goulao,vasco.amaral}@di.fct.unl.pt http://citi.di.fct.unl.pt/
SLE consistently relax language evaluation
no validation from users
recommend systematic approach to DSL evaluation
Xquery 2011 Survey
Preferred Programming Language
73%55%
45%32%
22%
Which data formats do you use the most ?
95%
40%
39%
32%
27%
18%
15%
Written answers
Do you have any opinions if XQuery is more or less productive language versus other programming languages ?
What was different about learning or using XQuery versus other programming languages ?
Choose an option that you most strongly believe in …
66%
14%
10%
Do you think XQuery makes you a more productive programmer ?
67%
14%
10%
8%
Is XQuery more productive then Java in developing web based data applications ?
58%
22%
12%
8%
Cool Stuff
I will try XQuery
Corona
Drop in replacement for NoSQL with no compromise
Open Source development supported by ML
Written in XQuery
Summary
I will try XQuery
Sanity Check
Xquery job search indeed.com
Media Customers
Government Customers
MarkLogic Customers Know
Financial Services and Other Customers
Finally …
Disclaimer: I have used the above subliminal suggestion throughout the
presentation
I will try XQuery
Thank you ...@xquery Questions ?
Tools
Resources and References