Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22961

Re: regexp(ing) Backus-Naurish expressions ...

Newsgroups comp.lang.java.programmer
Date 2013-03-15 11:34 -0700
References <khqsie$jee$1@speranza.aioe.org> <5140fb94$0$32106$14726298@news.sunsite.dk> <sy70t.279596$EO2.53348@newsfe04.iad> <5142766c$0$32106$14726298@news.sunsite.dk> <VTB0t.60721$sI3.36935@newsfe22.iad>
Message-ID <14264c4a-b2de-4580-a065-9bc8e2218ee0@googlegroups.com> (permalink)
Subject Re: regexp(ing) Backus-Naurish expressions ...
From Lew <lewbloch@gmail.com>

Show all headers | View raw


I was happy to merely observe this variation on Editor Wars, but there are a couple of points 
I'd like to offer.

Arved Sandstrom wrote:
> How much does that schema and XML parsing save you? Presumably you want 

A lot, in my experience. I've done a fair amount of heterogenous-system communications 
via various protocols including fixed-format ("columns 1-6 mean identifier, 7-8 are a control code, 
9-15 are the section name, ..."), CSV, XML, Google Buffers and JSON. 

Using XML for, say, web services or to communicate an object model is quite powerful, made
more so by the use of schemas and schema validation.

It doesn't handle deep validation, nor should it. It's the XML equivalent of surface-edit validation 
in a GUI. You don't expect the back end to validate everything, typically, but to count on certain 
sanity checks from the front end. Thus it is common for the front end (GUI widget or XML doc) 
to validate things like "is this a number?". And useful.

> those properties to end up in one or more strongly typed "properties" 
> objects. Whether the source of properties is a properties file or XML, 
> you have to code up those Java "properties" POJOs with full knowledge of 
> expected structure. *That* is your schema right there, regardless: 

That is not your schema. That is one layer's implementation of your schema.

> running an XML validator on an XML file against an XML schema is 
> duplication of effort. You'd learn the same things by failing to load 

Not if you do it right, it isn't.

> the properties into your beans, which you have to do anyway.

Not if you do it right, you don't.

Systems have different pipelines at different layers. In a system where XML is 
advantageous, you have validation at the gateway, before it gets into your queues 
and components and heavy logic. This increases throughput and scalability in addition 
to correctness and reliability.

Also, redundant checks are not always a bad thing. Back in the 1970s a nuclear 
missile siloed in West Virginia lost three of its four failsafes. Had there not been redundancy, 
there would have been catastrophe. Back in the 1980s there was a nuclear-medicine 
radiation-doser manufacturer in Canada who removed "redundant" hardware failsafes in the 
dosage, and the software bugs promptly started killing people.

A properly designed system will put surface edits in the front end, whether it's XML or 
source code compilation or JSON parsing or what-have-you, and different checks in 
different layers. Useful redundancy is achieved by dependent layers asserting the validity 
promised by antecedent layers rather than duplication of all the effort.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

regexp(ing) Backus-Naurish expressions ... qwertmonkey@syberianoutpost.ru - 2013-03-13 21:54 +0000
  Re: regexp(ing) Backus-Naurish expressions ... markspace <markspace@nospam.nospam> - 2013-03-13 15:12 -0700
  Re: regexp(ing) Backus-Naurish expressions ... Arne Vajhøj <arne@vajhoej.dk> - 2013-03-13 18:20 -0400
    Re: regexp(ing) Backus-Naurish expressions ... Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-03-13 20:00 -0300
      Re: regexp(ing) Backus-Naurish expressions ... Arne Vajhøj <arne@vajhoej.dk> - 2013-03-14 21:16 -0400
        Re: regexp(ing) Backus-Naurish expressions ... Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-03-15 06:31 -0300
          Re: regexp(ing) Backus-Naurish expressions ... Lew <lewbloch@gmail.com> - 2013-03-15 11:34 -0700
            Re: regexp(ing) Backus-Naurish expressions ... Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-03-15 20:17 -0300
  Re: regexp(ing) Backus-Naurish expressions ... Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-03-13 17:47 -0500

csiph-web