I don't see it myself, that teaching servlets would be more
time-consuming than teaching Swing (or JavaFX for that matter). In fact,
I think that teaching servlets affords an excellent opportunity to
introduce students to important real-world stuff:
1) using libraries;
2) the ubiquity and importance of app servers;
3) HTTP request-response handling;
4) how servlets underlie many Java frameworks, with a brief intro to how
the frameworks build upon the servlet API.
Can this be done in 30 hours, especially for programming neophytes?
Almost certainly now.
It is very useful topics - more useful than Swing, but I can not
see them as step one.
There are too much stuff to learn to get anywhere.
I provide some help at a danish web forum for IT problems. And
there are one university where they have a programming course
in first semester. They decided on Java - which I think is a
fine choice. But they want them to learn Java by doing JSF web apps,
RESTful web services etc.. The result is not pretty. The students
that should learn about data structures, control structures, OOP
etc. are looking at things generated by Eclipse wizards and they have
no idea about what all that stuff is doing.
But I'm not convinced you can accomplish more by doing "first
steps with Swing". The issue here may be that 30 hours isn't
If kept simple with JLabel, JTextField, JButton etc. I think they
can make something work *and* understand what they are doing.
but I myself have a gut feeling that you'd do better with a
I am not sold on that.
For a barebones first approach, I think we can over-emphasize the
importance of GUIs (web or desktop) as being what beginners expect to
see, or what they feel comfortable with. I'm probably dating myself
here, but back in the '70's when I learned programming with FORTRAN 66
and FORTRAN 77, I (and most of my peers) grokked program output to
printer or tape, and program input from similar sources. It's also not
difficult to relate a console input prompt to an HTML text input box -
students understand that what matters is what you do with the input, not
so much how you got it.
Let me put something else out there. 30 hours is a short semester if we
suppose three 1-hour classes per week. Is it even realistic to try and
introduce any kind of GUI (Swing, JavaFX, servlets with simple HTML etc)
in 30 hours? Perhaps console output is all you should shoot for.
Console apps would certainly be better in the sense that there are even
less context to learn.
The problem here is probably more in the area of motivation. A console
app does not look fancy and that could be demotivating.