Teaching Java, teaching what?

S

Stefan Ram

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.

But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?
 
E

Eric Sosman

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.

But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?

"Believe ninety percent of what you see, fifty percent of
what you read, and ten percent of what you hear."

That was my father's dictum when I was quite young, long
before the Internet came along (had the Internet been around,
he would surely have moved "fifty percent" to a lower figure).
Anyhow, he'd have said that what you "hear everywhere" is only
ten percent reliable, so although you should pay it some heed
you shouldn't let it influence you too strongly.

My own take (uninformed; peg this somewhere between the
ten- and fifty-percent level) is that Java applets have shown
themselves to be too dangerous for the lawless Net. This does
not, however, equate to "Java on the desktop is dead." Both
applets and Java Web Start *in a controlled environment* can
be safe and useful. Use them on the inTRAnet if you like, as
a way to deploy in-house applications. Also, Swing can put a
perfectly adequate (albeit not fancy) GUI on an application
launched from the desktop rather than in a browser, should you
wish to do so.

Does this make a case for, or a case against, teaching Swing?
Sorry; for that question I don't have even a ten-percent answer.
 
J

Jeff Higgins

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.

But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?
It would be wrong to accept a student whose educational objective
misaligned with your syllabus. Are you seeking reassurance?
 
M

markspace

My own take (uninformed; peg this somewhere between the
ten- and fifty-percent level) is that Java applets have shown
themselves to be too dangerous for the lawless Net. This does

Just to toss in my own two nickels, I don't believe that applets are
inherently more dangerous than Adobe Flash or JavaScript. The major
problems with applets lately was Oracle was slow to addressing security
issues. That's really a problem for any internet connected computer or
program. Heck Windows OS wasn't exactly known for its security on the
'net a few years ago.
 
S

Stefan Ram

Jeff Higgins said:
It would be wrong to accept a student whose educational objective
misaligned with your syllabus.

There is no fixed syllabus. The school for adult students
just asks me to give a »Java class«, the details of the
syllabus are left to me. Every year I am trying anew to
write a good syllabus for my Java class that should be
aligned with as much student's educational objective's as
possible and also reflect what I deem to be important to
learn about Java. I am at liberty to include or exclude Swing.

I do not choose students, instead it's the other way round:
If my syllabus and the student's educational objectives are
misaligned too much, the student will not visit my class.
 
M

markspace

There is no fixed syllabus. The school for adult students

I do not choose students, instead it's the other way round:

Do students ever return and tell you what they thought of their class?
What was their feedback? Do you consult with the employers of those
students to find what they want?

Both of these strike me as better ideas than asking us. Personally,
it's been so long since I learned both Java and especially my first
programming language, I wouldn't trust myself to give advice to anyone
starting out today without knowing some context.
 
J

Joerg Meier

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.
But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?

Ok, Java on the desktop certainly isn't dead, heck, even gaming in Java has
just recently excited millions and millions of people with stuff like
Minecraft.

But that being said, Swing/GUI is a comparatively 'hard' task, spanning a
huge VOLUME of information. By that I mean that unlike, say, Reflection, or
big O notation, Swing isn't just something you have to 'understand', but
also something that even while teaching the brightest students will take a
long time due to how many pieces there are that people will need to
understand to do the bare minimum.

If you can keep your students interested without touching Swing, I'd say
stay away from it, or maybe provide links to tutorials for the interested
students. If your students are not excited by console apps, you might want
to consider other things to teach that interest them.

For example, it is relatively trivial to produce a basic framework allowing
people to move things on the screen in a framework like libGDX (like, as a
game). It might not exactly be a job skill, but then neither will one
course of Swing intro be.

Liebe Gruesse,
Joerg
 
J

Jeff Higgins

There is no fixed syllabus. The school for adult students
just asks me to give a »Java class«, the details of the
syllabus are left to me. Every year I am trying anew to
write a good syllabus for my Java class that should be
aligned with as much student's educational objective's as
possible and also reflect what I deem to be important to
learn about Java. I am at liberty to include or exclude Swing.

I do not choose students, instead it's the other way round:
If my syllabus and the student's educational objectives are
misaligned too much, the student will not visit my class.
The student visited my class.

Therefore my syllabus and the student's
educational objectives are not misaligned too much.

Good job!

My bet is that Swing will be a part of the JDK and JRE
for a long time. Yes, beginners expect to see windows.
With a current JDK what are the GUI alternatives?
Are you comfortable with teaching all of the alternatives?
So far it seems harder to pop up a dialog in JavaFX than Swing.
But then I don't yet have much experience with JavaFX.
If the adult students are learning to program for their
own enjoyment, then teach what you are most comfortable with.
They will explore the alternatives on their own once they
get over the hump. If it is vocational training then teach
what they are required to know.
 
A

Arne Vajhøj

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.

But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?

Java on the desktop has not died - it never lived.

:)

But I don't think it matters.

You students need to learn OOP and Java programming.

Creating desktop Java applications is fine for that.

JSF web apps, JAX-RS web services with non-Java frontend,
Spring MVC web apps, GWT etc. may be more common than
Java desktop apps, but I think they are less suited to learn
OOP and Java.

And Java desktop skills are not wasted:
* such apps do get written - maybe not as state of the art
commercial applications but still a lot of utility apps - and
even though maybe 90% of Java developers work in the Java EE
world, then my guess is that 95% of Java developers know how to
write a Java desktop app
* it is easier to learn writing desktop application sin another
language after having learned about it in Java - all the stuff
about event thread etc. also exist in other technologies

Arne
 
A

Arne Vajhøj

Just to toss in my own two nickels, I don't believe that applets are
inherently more dangerous than Adobe Flash or JavaScript. The major
problems with applets lately was Oracle was slow to addressing security
issues. That's really a problem for any internet connected computer or
program. Heck Windows OS wasn't exactly known for its security on the
'net a few years ago.

I mostly agree.

Executing code downloaded from the internet is very tricky
security wise.

And alternatives like Flash, SilverLigth and JavaScript has
certainly had their security vulnerabilities as well.

I do think Java applets has a few extra features that
may have contributed to the problems:
* the ability to be allowed privs by user
* full API

Arne
 
A

Arne Vajhøj

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.

But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?

But please consider switching from Swing to JavaFX!

Because:
* it is the future
* it is a more modern way of doing GUI development
* you can do some nifty things with embedded browser, embedded
multi media etc. that may impress your students

Arne
 
R

Roedy Green

But then, I hear everywhere: »Java on the Desktop is dead.«.

What has replaced it?

All the excitement right now is apps for cellphones. Sales of desktop
computers is dropping and of portables is rising.
 
S

Silvio

Many Java classes and Java books teach Java foundations and
then Java OOP to finally be able to show how Swing can be
used to create programs that look like beginners expect
programs to look like, i.e., they do not write some text to
an old-fashioned text console, but run as a GUI windows.

But then, I hear everywhere: »Java on the Desktop is dead.«.
Now I asked myself: Is it wrong to teach how to write Java
desktop applications in a class (using Swing)? After all,
you do not want to waste the time of the students by
teaching them something that is »dead«?

Why not have them write a simple Servlet or two? Teach them some very
basic HTML/CSS tricks for their second or third Servlet (as opposed to
plain text) and I am sure you get people interested.
If you embed a Servlet container (Jetty comes to mind) they can all run
their own application locally and test it from their browser.

IMHO you should either go mobile or HTML(5). I know there are crowds
clinging to Applet/Desktop/Swing/JavaFX etc. but it does not sound as a
logical choice for an introductory course.

Silvio
 
S

Stefan Ram

Silvio said:
Why not have them write a simple Servlet or two?

The time for teaching is very limited: I now often have only
30 hours to take students from »no programming experience
whatsoever« to »first steps with Swing« including exercises
done in the classroom. When teaching Java with Swing, I need
the JDK as the one single dependency: javac Main.java, java
Main, and that's it.

I have the impression that teaching servlets is more
time-consuming, because the toolchain is longer and the
configuration and application of more tools needs to be done
and explained.
 
S

Stefan Ram

Chris Uppal said:
Have you considered teaching Android programming (in Java) instead of "desktop"
programming ?

I am offering Android programming as a separate class for
students with knowledge of the fundamentals of OO
programming in Java. But for a general Java class this might
be too special. The classroom has desktop PCs installed, so
Swing might appear more natural in this environment.

My Android course is based on Android Studio and Gradle, so
I start with an explanation of Android Studio and Gradle.
But this might not be interesting for everyone in a general
Java class. Also some knowledge of XML is needed sometimes,
so Android programming might have more prerequistes than
Swing programming.

A funny observation I made is that to take full advantage of
Gradle, it helps to learn Groovy. So when Google will keep
supporting Gradle, this also might make Groovy more popular.
 
A

Arved Sandstrom

Depends on what the class is meant to teach. If the point is
to teach GUI or event-driven programming and the students
already have experience with Java from earlier courses, fair
enough. If the point is to teach general programming or the
Java programming language, I think time and effort could
be invested a lot more wisely than teaching Swing.
I agree.

I'll add this: we're talking about teaching _programmers_, not users of
an application. Hence the comments about wanting to present a GUI rather
than a text console are not really relevant. A working software
developer is going to be looking at text console output and log files a
lot, and maybe debugger displays...regardless of what the user interface
is. So that's what you accustom your students to.

And if I wanted to focus on a GUI, in order to (as Leif suggested)
concentrate on event-driven programming, say, I'd pick a web app anyway.

AHS
 
S

Silvio

The time for teaching is very limited: I now often have only
30 hours to take students from »no programming experience
whatsoever« to »first steps with Swing« including exercises
done in the classroom. When teaching Java with Swing, I need
the JDK as the one single dependency: javac Main.java, java
Main, and that's it.

I have the impression that teaching servlets is more
time-consuming, because the toolchain is longer and the
configuration and application of more tools needs to be done
and explained.

If you sufficiently wrap the embedded container inside a utility class
the toolchain becomes quite short and all the students would do is
define a Servlet class implementing a doGet method. They would need to
know some basics about a HTTPServletResponse but I suspect getting
started with even the most basic Swing stuff requires more knowledge
upfront.

On the other hand you would have to set up their environments with some
additional JARs so that might be a problem, especially if they intend to
take the fruits of their work home.
 
A

Arved Sandstrom

The time for teaching is very limited: I now often have only
30 hours to take students from »no programming experience
whatsoever« to »first steps with Swing« including exercises
done in the classroom. When teaching Java with Swing, I need
the JDK as the one single dependency: javac Main.java, java
Main, and that's it.

I have the impression that teaching servlets is more
time-consuming, because the toolchain is longer and the
configuration and application of more tools needs to be done
and explained.
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?
Maybe not. 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
enough...but I myself have a gut feeling that you'd do better with a
servlet approach.

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.

AHS
 
A

Arne Vajhøj

What has replaced it?

Java was never a major player for desktop apps.

Windows GUI apps are mostly old C++ MFC, old C# Win Forms,
new C# WPF and a bit of the new WinRT stuff.

*nix is still mostly C and C++ with various KDE and Gnome libs.
All the excitement right now is apps for cellphones. Sales of desktop
computers is dropping and of portables is rising.

Sales of PC's has dropped some. But the PC is not headed for
extinction.

Arne
 
A

Arne Vajhøj

If you sufficiently wrap the embedded container inside a utility class
the toolchain becomes quite short and all the students would do is
define a Servlet class implementing a doGet method. They would need to
know some basics about a HTTPServletResponse but I suspect getting
started with even the most basic Swing stuff requires more knowledge
upfront.

A desktop app is very standalone.

Web means:
- two apps: browser and server
- knowledge of at least HTML required (CSS and JS optional)
- a little bit of knowledge about HTTP and the interaction

And web is often less OO than desktop apps, which may move
focus from the purpose of the course.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top