TDDD05 Component-Based Software
Optional programming exercises
This course has no mandatory labs. You may sign up for an optional lab series as far as there are places available.
As additional (optional) practical exercises, we suggest on this page some programming exercises that you can do on your own, either in the IDA lab rooms when there is space during non-scheduled hours or at your home computer, using freely accessible software tools. For these exercises, there is no supervision, no submission, no correction and no bonus points awarded. We therefore recommend that you form small, informal working groups such that you can help each other if there should be problems.
Programming exercise 0
Preparations: If you prefer to work on your home computer, we recommend that you download, install and get familiar with (a) the Eclipse IDE, (b) a C++ development environment and (c) the latest version of the SUN Java JDK. Some further software packages will be needed and announced with later exercises.
Programming exercise 1
(after Lecture 2 on Object-oriented technology - Properties and limitations for component based design)
- Write a small example code in C++ that demonstrates the syntactic fragile base class problem. Explain what happens.
- Write the same example in Java to show that the syntactic FBCP does not occur there. Explain why.
- Use the OO language of your choice to write example code that demonstrates the semantic fragile base class problem. Explain what happens.
Programming exercise 2
(after Lesson 1 on Java Reflection)
- Write a Java program that reads the name of a class from the command line
and emits the interface of the class in Java syntax (interface or
class, modifiers, constructors, methods, fields; no method bodies).
(Hint: You can load a class whose name you know with java.lang.Class.forName(). The java.lang.Class class offers a rich interface that enables you to inspect the interface of any class.)
Apply this program to a set of classes and interfaces as test input. You may also use the program on itself.
- Now write a program that reads a class name and a list of arguments,
and creates an object of that class where the read arguments are passed to
(Hint: Treat arguments as strings. A java.lang.Class can enumerate its constructors. Choose a constructor with the appropriate parameter count. Then, find the parameter types. To create typed argument objects, call the appropriate constructors that take a string as their only argument. Call dynamic constructors using java.lang.reflect.Constructor.newInstance().)
Programming exercise 3
(after the lecture on Problems and solutions in standard component systems)
- Implement the yellow-page service example:
Choose a language (Java or C/C++; we recommend Java because serialization of basic data types is already provided and the exchange format of serialized Java objects is portable across systems) and implement the code fragments for client, stub, client adapter, server adapter, skeleton, and the server component itself, as sketched in the lecture.
(Remark: when working on thin clients, you usually cannot open any IP ports for server sockets. Try this better on your home computer.)
- Extend your mini-RPC system by generic stubs and skeletons.
Programming exercise 4
(after the lectures on CORBA)
- Sketch how to generalize your yellow-page-service implementation code
of the previous exercise to design your own mini-CORBA system:
For a few central data types (such as int, float, char) give mappings to corresponding Java and C/C++ data types, define the serialization/deserialization functions for them, define a tiny interface definition language mini-IDL containing function prototypes using these data types only, and explain how stub and skeleton functions would be generated from an interface specification in your mini-IDL language.
- Suggest how you would extend your mini-IDL specification language by type constructors such as array(elemtype, length). Give an appropriate extension of your mini-IDL-to-language mapping that works recursively, such that also arrays of arrays would be mapped properly.
- Experiment with the CORBA implementation provided by the SUN JDK (1.4 or later).
- Practical CORBA exercises are part of the course TDDB37 Distributed systems.
Programming exercise 5
(after the lectures on Web services and Software architecture systems)
- Watch the demo of the Orchestra BPEL Designer.
... (to be continued)
Page responsible: Lena Buffoni
Last updated: 2010-03-10