Andrej Koelewijn

  • Home
  • About
  • Publications
  • Departments
    • agile
    • architecture
    • cloud
    • java
    • mobile
    • open standards
    • oracle
    • oss
    • other
    • soa
    • software development
    • tablet
    • Uncategorized
    • web
  • Subscribe via RSS

SQL is a DSL

October 27th, 2008  |  Published in oracle  |  17 Comments

Sometimes it seems like programmers will do everything to avoid SQL. At the same time DSLs (Domain Specific Languages) are very popular. If DSLs are so great, why are you trying to avoid SQL? Or procedural extensions to SQL? SQL is a DSL for dealing with relational data.

SQL was invented to deal with relational data, there aren’t many better, easier and faster ways to deal with large amounts of data stored in a relational database. Seriously, databases are made to handle large amounts of data. To sort it, to filter it, etc. Trying to do that in another language, or even worse, in another layer, makes no sense. It’s really expensive to move the data from the database into your middleware layer, and Java (or any other middleware language) isn’t really a good language to sort and filter large amount of data.

Procedural extensions to SQL, like for example Oracle’s pl/SQL, are even worse off. It seems like middleware programmers will do everything not to have to use a procedural language in the database. But fact is that pl/sql is a very good tool to write data heavy business logic in. There is no faster way to handle large amounts of data, then right there in the database. And there is no easier way to write data heavy procedural code than using a procedural extension to SQL. That is what pl/sql is: a DSL for writing data centric logic.

Added bonus: anything in the database is extremely reusable. Almost every language has a library which allows you to make use of relational databases. So, if you put it in the database, no matter what middleware or frontend language you’re going to use in the future, your data centric logic can be reused.

  • Igor

    I absolutely agree with you. For some reason SQL got a bad rap among Java developers. Apparently it’s not object-oriented enough.

    Existing frameworks promise to shield Java developers from SQL which is a shame and produces some monstrously inefficient applications.

    I believe that database and SQL queries and stored procedures are the most long-lived part of the application. Business logic that uses it would change more frequently and UI has the shortest live span.

    From this perspactive, I think the tools and developers that approach database design from Java side are doing it backwards.

  • Igor

    I absolutely agree with you. For some reason SQL got a bad rap among Java developers. Apparently it’s not object-oriented enough.

    Existing frameworks promise to shield Java developers from SQL which is a shame and produces some monstrously inefficient applications.

    I believe that database and SQL queries and stored procedures are the most long-lived part of the application. Business logic that uses it would change more frequently and UI has the shortest live span.

    From this perspactive, I think the tools and developers that approach database design from Java side are doing it backwards.

  • Toon

    Well said. There is hope still.

  • Toon

    Well said. There is hope still.

  • Jan

    Off course you are right provided that a customer does have Oracle’s RDBMS to start of with. In a scenario where it is unclear or uncertain what the actual database platform will be – for instance for standard applications that want to provide functionality instead of just serving data – staying away for vender specific SQL (like non-standard JDBC types, and procedural extensions) is a good thing.

    In cases where the database *is* Oracle’s RDBMS I don’t have a problem using Oracle’s extensions like PL/SQL as long as it is only data related.

  • Jan

    Off course you are right provided that a customer does have Oracle’s RDBMS to start of with. In a scenario where it is unclear or uncertain what the actual database platform will be – for instance for standard applications that want to provide functionality instead of just serving data – staying away for vender specific SQL (like non-standard JDBC types, and procedural extensions) is a good thing.

    In cases where the database *is* Oracle’s RDBMS I don’t have a problem using Oracle’s extensions like PL/SQL as long as it is only data related.

  • Pingback: Friendfeeds usage of mysql: schema-less :: Andrej Koelewijn

  • Pingback: William Vambenepe’s blog » Blog Archive » “Federationing”

  • http://drcoddwasright.blogspot.com/ Robert Young

    Java, web, KiddieKoders are stupid. full stop. They write COBOL, in lower case, and are convinced they are doing something new and different. They iterate through a lump of data just as COBOL coders do through a copybook. They should be strung up by their heels and flogged.

  • http://drcoddwasright.blogspot.com/ Robert Young

    Java, web, KiddieKoders are stupid. full stop. They write COBOL, in lower case, and are convinced they are doing something new and different. They iterate through a lump of data just as COBOL coders do through a copybook. They should be strung up by their heels and flogged.

  • http://www.sqltutorials.net/ SQL Tutorials

    Does anyone know if there is another language or set of commands beside SQL for talking with databases?

    I’m working on a project and am doing some research thanks

  • http://www.sqltutorials.net/ SQL Tutorials

    Does anyone know if there is another language or set of commands beside SQL for talking with databases?

    I’m working on a project and am doing some research thanks

  • http://www.sqltutorials.net/ SQL Tutorials

    You know, the thing about SQL is, that there is virtually nothing that can replace it.

    Does anyone know if a substitute exists for sql? I mean besides MS SQL and Oracle and all that jazz. Thanks.

  • http://www.sqltutorials.net/ SQL Tutorials

    You know, the thing about SQL is, that there is virtually nothing that can replace it.

    Does anyone know if a substitute exists for sql? I mean besides MS SQL and Oracle and all that jazz. Thanks.

  • http://www.andrejkoelewijn.com/ andrej

    This article mentions some alternative query languages: Web and Semantic Web Query Languages: A Survey .

  • http://www.andrejkoelewijn.com/ akoelewijn

    This article mentions some alternative query languages: Web and Semantic Web Query Languages: A Survey .

  • Lukas Eder

    I couldn’t agree more with you. Maybe you would like to consider my post about jOOQ (Java Object Oriented Querying) on dzone: http://java.dzone.com/announcements/simple-and-intuitive-approach

    jOOQ is a library that brings SQL in the form of a DSL to Java. But that is just a side-effect for the main goal for jOOQ, namely to allow for very close integration of both standard and proprietary SQL in Java. Many developers will not agree with the “standardisation fever” that goes around in Java and prefer constructs such as PL/SQL, or any Oracle feature such as UDT’s, Oracle AQ, Oracle analytic functions as well as their equivalents in other languages.

    Check out jOOQ at http://jooq.sourceforge.net

    Any feedback is welcome!

Tags

activemq agile bi camel css esb google governance grails groovy gtalk html5 internet ipad ivy J2EE java javascript jaxrs jmx jquery lean linkeddata linux maven mule noiv openoffice opensource Open Source oracle osgi oss rdbms rest scrum servicemix soa sql svg tablet web 2.0 XML xmpp yql

Archives

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • June 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • February 2007
  • January 2007
  • December 2006
  • November 2006
  • October 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006
  • April 2006
  • March 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005
  • September 2005
  • August 2005
  • July 2005
  • June 2005

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Recent Posts

  • Updating a vagrant box
  • Using littleproxy in Mule unit tests
  • Useful site to determine what html5, css3 & svg you can use
  • A Product Owner is a Project Manager
  • Using css webfonts in inkscape

Categories

  • agile
  • architecture
  • cloud
  • java
  • mobile
  • open standards
  • oracle
  • oss
  • other
  • soa
  • software development
  • tablet
  • Uncategorized
  • web

Recent Comments

  • Pcdiggs on Software architecture, PHP and Javascript
  • Een Scrum Product Owner is een Project Leider on A Product Owner is a Project Manager
  • Using css webfonts in inkscape :: Andrej Koelewijn on Create presentations using inkscape
  • Create presentations using inkscape :: Andrej Koelewijn on Presentation: Introduction to Scrum
  • Gebhard Greiter on What is Agile?
Buzz
andrkoel: Utrecht hele dag mist, scheveningen zomerse dag... http://t.co/cDRCJHr9
4:35 PM Nov 10, 2011, comment
andrkoel: RT @stefanvdkamp: Beter filmpje van Garret McNamara in de 30 meter hoge golf. http://t.co/9abiWkYX
9:20 AM Nov 10, 2011, comment
andrkoel: Mmm, een uur voor den haag - leiden lijkt te weinig, ga mijn afspraak niet redden...
7:34 AM Nov 10, 2011, comment
andrkoel: Big Data is Useless without Science http://t.co/2I8EiLsH
6:18 AM Nov 10, 2011, comment
andrkoel: Just tried #vagrant to quickly setup virtualbox development environment. Looks good, although provisioning apache through puppet failed...
10:47 PM Nov 09, 2011, comment
 


©2012 Andrej Koelewijn
Powered by WordPress using the Gridline Lite theme by Graph Paper Press.