The Source for Java Technology Collaboration
User: Password:



Rich Unger's Blog

January 2008 Archives


Text-to-Speech NetBeans Module

Posted by richunger on January 09, 2008 at 06:46 PM | Permalink | Comments (10)

I'm getting back into the coding groove.  Just for fun, last night I integrated the FreeTTS engine into the NetBeans Platform.

The module does 4 things:

  1. Integrates the engine
  2. Provides an extension point in its layer file for new voices
  3. Provides an options dialog for selecting a voice
  4. Provides an API hook for speaking a String in the current voice.  Thus it would be trivial for a NB developer to add an action that says something (e.g. TTS.getDefault().speak("the time is " + getTimeString())  )

It was pretty easy.  I spent most of the evening unraveling the weird manifest and classloader tricks the freeTTS project does.  (IMHO there's no reason for a TTS library to create a classloader.  Ever.)

A few hints to library writers:

  1. overloading the Main-Class attribute in your jar's manifest to do anything other than specifying a class with a main() method is a bad idea.
  2. If the way you read in your configuration requires a hack to work with webstart, you're making too many assumptions.
  3. It's not the library code's job to figure out which classloader a user-supplied extension is in.  It's the users job to add their jar to the classpath.  By trying to do it in the library's source code, you're just ensuring that anyone integrating your library in a way you didn't foresee can't do it.

Seriously, I spent just a few minutes getting FreeTTS to work on the command line, maybe half an hour writing the netbeans code, and several hours figuring out just why the heck the engine wasn't finding any voices when it ran in NetBeans.

Learning Computer Science: Where does Java Belong?

Posted by richunger on January 08, 2008 at 05:02 PM | Permalink | Comments (5)

In light of the article presented in the Journal of Defense Software Engineering, and the responses it has generated, I just couldn't resist throwing my 2 cents in, particularly as I'm killing time between job interviews.

If you haven't been following this debate, let me recap.  Some Ada experts are saying that the growing monoculture of Java in college curricula is damaging the quality of CS education.  It's producing software engineers who do not know how to engineer.
"Students found it hard to write programs that did not have a graphic interface, had no feeling for the relationship between the source program and what the hardware would actually do, and (most damaging) did not understand the semantics of pointers at all, which made the use of  C in systems programming very challenging."

I think Java is a wonderful language for teaching computer science.  However, they're not entirely wrong, either.

I bring the perspective of one who's been through such a curriculum.  Washington University was one of the first schools to jump on the Java bandwagon, thanks to the efforts of some wonderful professors.  I took the first iteration of CS 101 taught in that language, back in 1997.  Previously, CS 101 was taught in Scheme, and CS 102 was taught in C++.

The change in these courses were extremely popular.  We were able to build more substantial software in our first semester than students had in previous semesters.  In our first semester, we were already learning the rudiments of good object oriented design.  In our second semester, we were learning the rudiments of good concurrent programming.

However, the next year I took a Design Patterns class that was taught in C++.  I was completely unprepared.  I spent half the semester catching up to the kids who knew what pointers were, and how to do linking and write a makefile.  I didn't learn the Design Patterns until I took Advanced Design Patterns a year later.

The general attitude of most professors at the time was that students needed to get off their butts and learn the languages themselves.  The professors were teaching computer science, not programming.  <crotchety-old-guy>In my day, if we needed to use a different language, we bought a book and learned it in a week!</crotchety-old-guy>

Well, that may be fine if you learned Ada and are expected to pick up Pascal, but taking a student who's only been taught Java, and expecting them to go off and pick up C++ before class is going to cause problems.  They're not going to have the first clue how to run a linker, what a pointer is, or what the point of a header file is supposed to be.

This is exactly what the authors of the Journal article mean when they say:

...we have regretted the introduction of Java as a first language of instruction for most computer science majors. We have seen how this choice has weakened the formation of our students, as reflected in their performance in systems and architecture courses.

WashU's student ACM chapter saw these problems, and put together their own curriculum for a lab-based class that taught these and other concepts behind good coding techniques.  We even chose a textbook.  We figured, if they would teach this class, that would free up the higher level systems and architecture classes to teach what they want, instead of the rush to the bottom that was occurring at the time.

Well, at the time, no one wanted to teach it.  However, I've heard they since introduced it, and students are finally learning how to code and debug before taking systems and architecture classes.

So, does all this mean that WashU made the wrong move?  I don't think so.  Java is not bad for education.  Bad curricula is bad for education.  They made some mistakes in the implementation, and then they fixed them.

The Journal's critique had 3 major themes:

1. Mathematics requirements in CS programs are shrinking.

Okay, if they're talking about discrete mathematics, numerical methods, and automata theory, this is clearly a bad trend.  However, WashU used to have engineering requirements in mathematics that just didn't make sense.  I don't need Laplace transforms to do CS.  I only need them if I'm going to work for Wolfram.

2. The development of programming skills in several languages is giving way to cookbook approaches using large libraries and special-purpose packages.

The fact that such packages are available for Java does not mean Java is bad for education.  My instructor for Algorithms and Data Structures allowed us to use C++ or Java, so long as we weren't just calling java.util.Hashtable to write our hash table.  Nothing wrong with that.

3. The resulting set of skills is insufficient for today’s software industry (in particular for safety and security purposes) and, unfortunately, matches well what the outsourcing industry can offer. We are training easily replaceable professionals.

This one is best read with the source in mind.  These guys are Ada experts in the Defense industry.  Formal methods and provability are very important, but they are not core classes that everybody should take.  They are invaluable if you're going to work in defense or safety applications, but probably not if you're going to work on, say, speech recognition.  For that, we need students who took courses in machine learning.  The field is now big enough for multiple specializations.

By all means, teach classes in other languages.  Students should be forced to take at least one class in a functional language.  However, for CS 101, Java is an excellent choice.

I also took a course in assembly, and even a course in VHDL.  Talk about bare metal -- C is for wimps :)

Tags: , ,



Youtube player in JDIC browser

Posted by richunger on January 06, 2008 at 06:51 PM | Permalink | Comments (1)

At Geertjan's suggestion, I tried his Youtube modules with my JDIC integration.  Worked out of the box, no problem.  I didn't have to change a thing.  Nice when that happens, eh?

JDIC - NetBeans Integration Updated for 6.0

Posted by richunger on January 02, 2008 at 03:24 PM | Permalink | Comments (5)

To jump back into programming, and to familiarize myself with the new release of NetBeans, I've updated the jdic-netbeans integration.  Here you can see the browser embedded in NB, replacing the default "Swing browser".

There's still some issues with the integration that I've never managed to tackle, relating to heavyweight-lightweight component mixing.  The browser doesn't handle being resized very well, and tends to put itself in front of other TopComponents.  Any ideas welcome!

The source code is available on the java.net project site.

Tags: ,





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds