X-Received: by 10.224.17.140 with SMTP id s12mr4472047qaa.3.1363372469910; Fri, 15 Mar 2013 11:34:29 -0700 (PDT) X-Received: by 10.49.81.198 with SMTP id c6mr691771qey.37.1363372469883; Fri, 15 Mar 2013 11:34:29 -0700 (PDT) Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!t2no3536259qal.0!news-out.google.com!k8ni622qas.0!nntp.google.com!t2no3536256qal.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Fri, 15 Mar 2013 11:34:29 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T NNTP-Posting-Host: 69.28.149.29 References: <5140fb94$0$32106$14726298@news.sunsite.dk> <5142766c$0$32106$14726298@news.sunsite.dk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <14264c4a-b2de-4580-a065-9bc8e2218ee0@googlegroups.com> Subject: Re: regexp(ing) Backus-Naurish expressions ... From: Lew Injection-Date: Fri, 15 Mar 2013 18:34:29 +0000 Content-Type: text/plain; charset=ISO-8859-1 Lines: 52 Xref: csiph.com comp.lang.java.programmer:22961 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