5. Advanced
Object-Oriented Programming
Language-Oriented Programming
Prof. Dr. Bernhard Humm
Faculty of Computer Science
Retrospective Functional Programming
• What is a higher-order function?
• What is a lambda function / closure?
• Are closures just „syntactic sugar“ or are they more powerful than
named functions? Is there behaviour that you can express with
closures that you cannot express with named functions?
• Explain sort, detect, select, collect, and inject
• What additional documentation features are implemented in the
language functional.1? Do they form a language extension?
• What are pre- and post-conditions / design by contract?
• Which design-by-contract features are implemented in the language
functional.1? Do they form a language extension?
This lecture in the context of the entire
course
1. Introduction
2. Lisp Crash Course
3. Functional programming
4. Advanced object-oriented programming
5. Business information systems
6. Database queries
7. Logic programming
8. Workflows
Agenda
• Classes
• Instances
• Methods
Defining classes
• Schema for defining classes:
• Example:
(define-class name (direct-superclass-name*)
(slot-specifier*))
(
define-class
bank-account ()
(customer-name
balance))
Extension of cl:defclass
with convenience features
Class name
Slots a.k.a. instance variables /
attributes
bank-account
+customer-name +balance
Inheritance
• Lisp provides multiple inheritance
• Examples:
(define-class checking-account (
bank-account
)
(credit-limit))
(define-class savings-account (
bank-account
)
(interest-rate))
(define-class money-market-account
(
checking-account savings-account
)
())
Slots additional to inherited ones from
superclass
Multiple inheritance: slots from all
superclasses (bank-account, savings-account,
and checking-account) are inherited
bank-account +customer-name +balance checking-account +credit-limit savings-account +interest-rate money-market-account