[ANU] [DCS] [COMP2100/2500] [Description] [Schedule] [Lectures] [Labs] [Homework] [Assignments] [COMP2500] [Assessment] [PSP] [Java] [Reading] [Help]
COMP2100/2500
Lecture 25: FAQ IISummary
A second interactive lecture based around feedback from students about what they are finding difficult, confusing etc.
New material for 2005
Very sketchy since there's only 5 minutes to the lecture. I'll fill this out later.
In Q1 of Assignment 2 I'm dropping the requirement that says you're not allowed to use the Java TextComponent classes. From now on, if you want to, you can make class TextPanel inherit from JTextPane and use all the advanced features there... except one: you may not simply save the document as HTML and then do setPage(url).
For Q2, you want a JFileChooser. There's a page in the Swing tutorial that tells you how to use them.
Questions and answers from 2004
For Q1 Part 1 are we supposed to keep the current set-up and just run the pages together or should we just write to one long page? If the latter how do you know before you start adding words how long the document will be, or should we use something more dynamic than a pixmap?
Write to one long page, whose width is the width of the window, and whose height is the larger of the height of the window and the height of the formatted text.
Working out that height is one of the challenges of this assignment. There are a few ways to approach it.
Each time you run out of room on your pixmap, make a new one that's a little bigger, draw the contents of the old pixmap onto the top part of the new one, then discard the old one and keep drawing new text onto the new one.
Traverse the entire tree the first time just to measure the height you need, then create a pixmap the right size, then traverse the tree again drawing text onto the pixmap. You could do this with a new visitor, or you could give your visitor two "modes".
Instead of drawing all your text to one big pixmap straight off, draw each line of text to its own small pixmap, just the height needed for that one line. Store all these little pixmaps in an array. Once you've finished, you can quickly loop over that array adding up the heights, then create a big pixmap the right size, then loop through the array drawing the little pixmaps onto the big one, one after the other.
I'm sure there are other strategies too...
Questions and short answers from 2003
Are there any alternative PSP processes that yield the same or similar benefits to the one we're following?
As far as I know, no-one else has written down a process in anything like the same detail and certainly not backed up by the same amount of rigorous research. But there are other approaches. For a balanced and somewhat more relaxed approach you might want to read a book like Code Complete by Steve McConnell for example. For something very different, look up Extreme Programming.
I heard that you've got a PhD from mathematics not from IT. Why are you lecturing in IT now? Any advantages to having a good maths background for doing IT or programming?
It's true. My PhD is in applied mathematics.
Why am I lecturing in IT now? I couldn't get a job in mathematics. But it's more complicated than that: I lost interest in maths and noticed that I only got interested when for one reason or another I had to write a computer program. So that's why I'm in IT now.
As for the advantages of having a strong maths background. I think I've said this before, at the start of the semester: for almost all computing people, knowing any particular bit of maths is irrelevant. BUT, and it's a very big but, having learned how to think logically, rigorously, having learned how to formulate assertions and then prove them - that is of incalculable value for software developers. Maths is weight training for your brain.
[ANU] [DCS] [COMP2100/2500] [Description] [Schedule] [Lectures] [Labs] [Homework] [Assignments] [COMP2500] [Assessment] [PSP] [Java] [Reading] [Help]
Copyright © 2005, Ian Barnes, The Australian National University
Version 2005.1, Friday, 13 May 2005, 12:55:13 +1000
Feedback & Queries to
comp2100@cs.anu.edu.au