Software Engineering Radio

People often ask me what podcasts I regularly listen to. Well there are many of them and I won’t enumerate them all here, but I wanted to mention one that I listen to almost every day nowadays.

Markus Voelter started Software Engineering Radio in January 2006. As he describes it on the website, this podcast tries to be a lasting educational resource and not a newscast. You won’t find new product announcements, no tech news of any kind. Only tutorials, interviews, and discussions about specific software-engineering topics.

When I discovered this podcast, about one year ago, I quickly downloaded just the episodes that appeared to be the most relevant to my work. But I found that almost all episodes had something in there for me. For example, recently I listened to the episode on real-time systems, a field I do not work in anymore. Well, at one point the interviewee discussed how jobs were scheduled in certain real-time systems, trying to optimize the total value or utility of the work done by choosing which tasks to perform and which to let slip past their deadlines. And that got me thinking about the Scrum planning process, when the Scrumaster selects, for the upcoming sprint, items from the product backlog in decreasing order of importance until the total estimated time fills up the scrum duration.

Now imagine for a minute that we could get the product owner to assign utility values to each product backlog item. Then instead of selecting product backlog items in decreasing order of importance, we could apply the same kind of decision process and optimize the utility created by each sprint.

(Later that day I went to the library to research this topic but all I found was an exercise from the classic Introduction to Algorithms in which the reader is asked to optimize such a job schedule. The chapter in question was the one about Dynamic Programming, in case anyone is interested.)

Anyway, back to SE-Radio. I’ve found the episodes’ quality range from good to very good, covering a broad range of topics. Perhaps they could be slightly improved with a little bit more structure, and also if the interviewer would stop regularly interrupting the guests with their own opinions. Sound quality has been an issue in the early days (ONE episode in particular was literally painful to listen to—I won’t say which one) but now it’s much, much better.

These days I listen to at least one episode a day, my goal being to listen to all of them. I can really recommend it.

Reblog this post [with Zemanta]

Spring for structure, property files for parameters

Spring is a great framework for externalizing the object graph of your application. Typically you write an XML config file that defines a number of Java objects (or “beans“) and how they are supposed to relate to each others.

For example, suppose you have a class ThermalNode whose instances need to hold a reference to, say, an instance of a TimeProvider class. The way you usually do this in vanilla Java is you define this relationship somewhere close to the program’s start:

ThermalNode node = new ThermalNode();
node.setTimeProvider(new TimeProvider());

But in Spring you define this structure outside of your main program, and the above would be written somewhat like this:

<bean class="ThermalNode">
  <property name="timeProvider" ref="timeProvider"/>
</bean>
<bean id="timeProvider" class="TimeProvider"/>

And thus the structure of your object graph has been moved away from your compiled code.

Where this got really interesting for me was when I started introducing parameters for the thermal nodes, e.g. thermal capacicities. I would have for instance this sort of structure:

+---------------+
|  ThermalNode  |
|---------------|
|  capacity1    |
+---------------+
       |
       \
       /
       \ conductance
       /
       \
       |
+---------------+
|  ThermalNode  |
|---------------|
|  capacity2    |
+---------------+

What you then start having are beans whose properties (or constructor arguments, which is the way I prefer doing it) are not only references to other beans but also values.

Now a requirement for this project of mine is that it should be easily customizable by the end user. And that means not having the poor user coming and manually edit Spring config files.

Instead, Spring lets you define properties in plain property files, e.g.

# A property file
capacity1=300
capacity2=250

Then these properties are available to your main Spring config file through this kind of incantation:

<context:property-placeholder
    location="classpath:my.properties"/>

And your beans can then refer to these properties like this:

<bean class="ThermalNode">
  <contructor-arg ref="timeProvider"/>
  <constructor-arg value="${capacity1}"/>
</bean>

I have found this way particularly useful, namely put the structural data in the Spring config file, and put the parameter data in its properties file. Doing so not only makes it easy for the user to run the program with different parameters. It also lets you stash away the Spring config file in your application’s jarfile, putting it out of the way of the user. And that, I believe, is a very good thing, because you typically do not want to confuse the user with Spring’s syntax.

Reblog this post [with Zemanta]