This is the first of three lectures on integrating domain-specific languages with general-purpose programming languages. In particular, SQL for database queries.
SQL is a domain-specific language for programming queries over relational databases. Queries may be complex, with declarative and imperative components, and are often constructed by other programs rather than by hand.
Standard frameworks for creating these queries build them out of plain strings, taking little account of their rich structure. This can also happen in other settings where a program in one language is used to manipulate code written in another.
The lecture demonstrates this using examples from the SkyServer database, as well as recent Google Buzz and Twitter vulnerabilities. We look at the basics of the JDBC framework for database access in Java, and how prepared strings introduce some structure. There is also some mention of NoSQL architectures, and the general issue of why one might use one language from another.
The next two lectures will look at ways to better integrate such domain-specific languages within general-purpose programming; in ways that can help both the programmer and the compiler.
SQL queries are programs in a rich high-level language; when we treat them as unstructured text we lose all we know about programming.
Friday’s lecture will be about the LINQ framework on C#. In preparation for that, carry out the following homework.
- Find an online tutorial about C#.
- Read it.
- Post its URL, and your comments on the tutorial, here on the blog.
Coursework office hour
If you have questions or problems you wish to raise regarding the course or your coursework, you can bring them to me on Wednesday afternoon.
Office Hour: 1.30–2.30pm Wednesday 27 October, Informatics Forum 5.04
If the turnstile gates are closed and your student card does not open them, ask at the front desk for admission.