Today’s lecture presented two different facilities designed to help write Java code that does the right thing: the Java
assert statement; and JML, the Java Modeling Language. Continue reading Lecture 13: Practical Tools for Java Correctness
Today’s lecture was the first of three on language techniques and tools that aim to improve program correctness: not necessarily changing what a program does, the time or space it takes, or the power it uses; but making sure that what it does is the right thing to do. Of course, that also requires having some way to identify what that is to begin with.
Continue reading Lecture 12: Specification and Verification
This lecture concludes the set on concurrency with three distinctive challenges for concurrent programming and some possible solutions: lock networks, deadlock, and hand-over-hand locking; priority inversion in thread scheduling; and relaxed memory models for modern processor architectures. Continue reading Lecture 11: Cautionary Tales in Concurrency
Today’s lecture set out some alternative approaches for managing concurrency in programming languages: asynchronous message-passing Actors and the always-upbeat optimistic concurrency of Software Transactional Memory. These are two examples from a wide range of mechanisms in use across many programming languages and applications domains, all of which seek to balance the key concurrency requirements of separation to prevent inconsistency and co-operation to allow interaction.
Continue reading Lecture 10: Some Other Approaches to Concurrency
In this lecture I reviewed the built-in Java concurrency primitives, the challenges of writing thread-safe code, and introduced some patterns that can help: immutability, synchronization wrappers, and control abstractions like producer/consumer. More high-level currency abstractions, such as those in the
java.util.concurrent package, support programming that is not only thread-safe but takes explicit advantage of concurrency to increase performance and responsiveness. Finally, I walked through some intentionally racy code in the Java
Continue reading Lecture 9: Concurrency Abstractions
Today’s session was to review and give feedback in small groups on the preliminary reports submitted as the first stage of the APL assignment. Thanks to everyone who came along to today’s session and contributed their comments. This was the first time I’ve done this in the course, and I’m grateful to those who commented on the arrangements.
Continue reading Lecture 8: Peer Review and Feedback
Moving on from type systems, today’s lecture started a look at programming for concurrency: why you might want — or need — to write concurrent code and some of the challenges in doing so. I also introduced some of the concurrency primitives in Java and how they are used, as well as telling a story about the Apollo Guidance Computer and the robustness of its concurrent event handling under input overload.
Continue reading Lecture 7: Concurrency
Thanks to the very many students who sent in lists of online references for each of the five coursework topics. I have selected some of those I think most useful, and list them below. These links work today, Tuesday 11 October. If you find one broken while the assignment is still running, please email me and I’ll attempt to fix it.
Continue reading Coursework references
Tuesday 11 October is Ada Lovelace Day, and the University of Edinburgh is hosting a series of events in the Main Library. There’s no APL lecture in the afternoon: come along and help improve Wikipedia.
- AM: Guest talks, activities, building things
- PM: Women in STEM Wikipedia edit-a-thon
Link: Event description and booking
Ada Lovelace Day is an international celebration day of the achievements of women in science, technology, engineering and maths (STEM). It aims to increase the profile of women in STEM and, in doing so, create new role models who will encourage more girls into STEM careers and support women already working in STEM.
Links: Ada Lovelace Day; Map of events worldwide
To find out more about Ada Lovelace and her impact on computing — including programming — then I recommend watching these.
“It may be desirable to explain, that by the word operation, we mean any process which alters the mutual relation of two or more things, be this relation of what kind it may. This is the most general definition, and would include all subjects in the universe.”
Ada Lovelace, 1842, identifying the
scope of application for a programmable computer
This lecture completes the quartet of type/term interactions: after first-class functions, parameterized types, and polymorphic terms, we have types that depend on the value of terms. Numerical examples include types to capture vector lengths and matrix dimensions. Dependent types can also be used to strengthen the deep embedding of domain-specific languages into a host meta-language. Examples given included typed lambda-terms and logical formulas. The lecture also touched on the Curry-Howard correspondence of propositions-as-types seen earlier in Wadler’s talk, and the use of dependently-typed programming in the machine-assisted proof of mathematical theorems. Finally, there were some references to dependently-typed languages for writing and verifying programs that are correct by construction.
Continue reading Lecture 6: Dependent Types