Linköpings universitet IDA Department of Computer and Information Sciences Prof. Dr. Christoph Kessler EXAM TDDD05 Component-based Software 2013-06-01, 14:00–18:00, TER1, TER2 Examinator: Christoph Kessler Jour: Christoph Kessler (070-3666687, 013-282406), visiting ca. 15:30 Hjälpmedel / Admitted material: Engelsk ordbok / Dictionary from English to your native language General instructions • This exam has 10 assignments and 4 pages, including this one. Read all assignments carefully and completely before you begin. • Please use a new sheet of paper for each assignment. When you are done, please sort all your pages by assignment numbers, and number them consecutively. • Motivate clearly all statements and reasoning. Explain calculations and solution procedures. • Be precise in your statements. Unprecise formulations may lead to a reduction of points. • Write clearly. Unreadable text will be ignored. • You may answer in either English or Swedish. • The assignments are not ordered according to difficulty. • The exam is designed for 40 points. You may thus plan about 5 minutes per point. • Grading: U, 3, 4, 5. The preliminary threshold for passing (grade 3) is 20 points. Where required, ECTS grades will be set by the LiU administration according to the LiU guideline for direct translation from Swedish grades: 5=A, 4=B, 3=C, U=FX. 1 1. (3 p.) Components and Composition (a) Define the two terms black-box composition and grey-box composition. For each of these, name an example composition system and shortly describe the used composition technique (no details). (2p) (b) What is the purpose of a composition language in a composition system? (1p) 2. (7.5 p.) OO technology and design by contract (a) In the context of design by contract in object-oriented programming, we considered the concept of syntactic substitutability (Liskov substitutability). This imposes certain type constraints on the component provider when evolving the interface/component by creating a new subclass of the old interface/component as a substitute that should still work properly with any existing client code. Explain carefully (i) what covariance of method parameter types means in general, (ii) why covariance of method parameters would be a desirable modification in the new subclass from the provider’s point of view, and (iii) for which of the three different kinds of method parameters (input parameters, output parameters/return values, and exceptions) covariance is permitted without breaking existing client code, and for which it is forbidden. (2.5p) (b) Are objects components?? Considering Szyperski’s widely accepted definition of a component, objects (as in ordinary object-oriented programming) have certain properties in common with components, but there are also important differences. Explain what properties are in common, and what the differences are. (2p) (c) Describe the Syntactic Fragile Base Class Problem and its implications for the compatibility of binary components compiled from OO programs. Give also a simple example that exhibits the problem. Which fundamental property of OO languages causes the problem? Suggest one (technical) method to overcome the problem. (3p) 3. (5 p.) Metaprogramming (a) Give examples (the programming system / tool names) for (i) static metaprogramming at base level, (ii) static metaprogramming at meta level, (iii) dynamic metaprogramming at base level. (1.5p) (b) (i) Give a C++ example definition of an arbitrary generic data type using the C++ template mechanism, and (ii) give an example code that instantiates a concrete data type from it. (iii) Explain carefully what the C++ compiler generates from your code (show a pseudocode equivalent of the generated code). (2.5p) (c) Name two different component markup techniques. (1p) 2 4. (6.5 p.) CORBA (a) How does CORBA achieve programming language transparency for static calls? (Describe the principle and those main parts involved in CORBA static calls that are primarily relevant for enabling language transparency. In particular, what does each of these parts do at a call? and which parts are generated, and from what source?) (3p) (b) Name three main tasks of an object adapter in CORBA. (1.5p) (c) Why is the Naming service essential for the flexibility of a CORBA installation? (1p) (d) What is the purpose of the IIOP (Internet Inter-ORB Protocol)? In particular, for what kind of calls is it used? (1p) 5. (1 p.) JavaBeans (a) If there was no reflection mechanism in Java, the JavaBeans component model would not work. Why? (1p) 6. (6 p.) Enterprise JavaBeans (EJB) (a) Enterprise JavaBeans (EJB) allows for separation of business logic from some middleware services. Give two examples of such middleware services and describe how Enterprise JavaBeans handles them. (2p) (b) For each Enterprise JavaBean (EJB), the developer must specify which kind of bean it is. What are the 3 different kinds of Enterprise JavaBeans? (1p) (c) What is dependency injection in the context of EJB3? If a client application uses dependency injection to resolve a reference of an EJB object, why can’t the client application be invoked directly on the JVM? (2p) (d) Why it is suggested to use @Local instead of @Remote when applicable? (1p) 7. (4 p) Aspect-oriented Programming (AOP) (a) In short: What is the main motivation for using Aspect-Oriented Programming? (0.5p) (b) (1.5p) Define the following AOP / Aspect-J terms: i. Dynamic join point ii. Pointcut iii. Advice (c) Is it possible in Aspect-J to write an aspect that actually removes, not adds, behavior (such as calls to a specific method) of the core program? If yes, give a short example (commented pseudocode). If not, explain why not. (1p) (d) What is the greatest new problem that comes with aspect-oriented programming, and why? (1p) 3 8. (1 p.) Model-driven architecture (MDA) (a) Give two main arguments how using MDA can increase programmer productivity. (1p) 9. (4 p) Web services (a) (1.5p) What is the purpose of each of the following protocols and specification languages used in web services: - SOAP - WSDL - BPEL? (b) Describe how a client uses UDDI to connect to a statically unknown web service. (2p) (c) Name one type of error in the design of a web service application that can be detected by statically analyzing its BPMN model. (0.5p) 10. (2 p.) Invasive Software Composition (a) (1.5p) Consider the component model of invasive software composition. In short, what are its (i) components? (ii) binding points? (iii) binding time? (b) How does the composition language of invasive software composition compare to that of Aspect-oriented programming (as known from Aspect-J)? (compare the main language paradigms, no details) (0.5p) Lab bonus: The optional Ladok moment for the timely completed optional lab series has already been reported at the time of the exam. If applicable, your exam score will be increased with 4 lab bonus points. Good luck! 4