Friday Quiz: Who Said This?
I've been dutifully bringing interesting quotes from all over the internet to my readers in the past three years. Toady, I'm going to turn a quote into a quiz: who said this? (I'll post the link tomorrow.)
[JavaScript], unlike Python, was a rushed little hack for Netscape 2 that was then frozen prematurely during the browser wars, and evolved significantly only once by ECMA. So its early flaws were never fixed, and worse, no virtuous cycle of fine-grained community feedback in the form of standard library code construction, and revision of the foundational parts of the language to better support the standard library and its common use-cases, ever occurred.
[Update] Anonymous has it right. The quote is from Brendan Eich, the inventor of JavaScript.
Alex Miller: Implementing Domain Specific Languages in Java
The three shades of DSL: fluent interfaces, scripting languages, and parser generators
Alex Miller from BEA Systems gave a presentation on domain specific languages at the St. Louis JUG yesterday.
Alex started by showing examples of several DSLs: regular expression, SQL, chess notation, needlework pattern notation, etc.
Some of the common properties of all of the DSLs shown are: compact, concise, having an implied context, assumption of domain knowledge, etc.
He then showed the pros and cons of introducing a DSL into a product. Both the pros and cons are consequences of the shared properties of DSLs.
He then introduced ways by which a DSL is implemented:
- through what Martin Fowler calls Fluent Interfaces
- using a scripting language like the BeanShell
- writing a parser yourself (either by hand or using a parser generator like Antlr)
Examples and implementations of a DSL for chart generation using the JFreeChart library in all three shades are shown.
There are some memorable quotes from the talk:
- If you look at a fluent interface from an API design point of view, they are terrible APIs
- (Of writing a parser, Terence Parr said) why do it by hand in five days when you can automate it in three years
- JavaCC has gone through too many hands in the past 10 years before landing in the spot on Java.net, while Terence has been doing nothing but Antlr during the same time. I wouldn't recommend JavaCC at this point
I started a mini-debate during the Q&A portion of the meeting by asking the "Spring+Hibernate" vs. "Java EE 5/EJB 3" question. It went off on multiple tangents (Struts being legacy, AJAX being tricky, etc.) but I did see one committed Hibernate believer in Kyle Cordes and one committed Spring believer in Jeff Grigg. Jeff Brown pointed out (when I asked him before the meeting) the two are not mutually exclusive: you can use both Spring and Hibernate in a Java EE 5 container, and your EJB 3 implementation may very well be Hibernate itself.
But Web 2.0 (Dojo, Prototype, AJAX, etc.) is the future.