[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: InnerXml is like printf (WAS: Underwhelmed)


Re:  InnerXml is like printf (WAS: Underwhelmed)
Miles Sabin <miles@m...> wrote:

| But on reflection (and playing devils advocate a bit) maybe it's not as 
| unreasonable as it seems. It has quite a lot in common with printf- 
| style IO APIs, which despite being error-prone (and occasionally the 
| source of security vulnerabilities) have proved to be surprisingly 
| resistant to replacement by more structured, typesafe or object- 
| oriented APIs.

Because it's

  1.  Quick
  2.  Dirty
  3.  Easily assimilated as rote technique by the grunt programmer

So, you get yourself a roomful of GPs and have 'em crank printfs until the
budget runs out.  It's called Resource Management, I believe.

| Why do these string-template approaches support such dramatically more 
| compact and readable code? I think it's simply because the syntax of 
| the template-strings provides a domain-specific "little language" which 
| is better tuned to the task at hand than the generic mechanisms 
| provided by the host language. 

Or libraries designed with the GP in mind.

| How about something XPath-like? For example,
| 
|   String s = "XPath expansion";
|   int i = 2;
|   parent.appendChild("usability[@factor="+i+"]/text("+s+")");
| 
| or if we waited for J2SE 1.5 which'll have auto-boxing and concise array 
| literals, we could even have,
| 
|   parent.appendChild("usability[@factor=%i]/text(%s)", {i, s});

How about

   import some.library.ConvenienceFunctions ;

   String s = "The Right Library" ;
   int    i = 2 ; 

   parent.add( new Eusability( ).aFactor( 2 ).add( s ) ) ;


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.