Peter Naur's "Telegram Problem"
1 As Stated Originally
- "Write a program that takes a number w, then accepts lines of text
and outputs lines of text, where the output lines have as many
words as possible but are never longer than w characters. Words may
not be split, but you may assume that no single word is too long
for a line."
- Originally described in 196x by Peter Naur, 2005 Turing Award
Winner.
2 Task at Hand
- This is essentially word-wrapping within a paragraph of a text
editor. "As such, it is a classic Object Oriented problem, used as
an example in the Design Patterns Book."
- There are several research papers published on this problem. See below.
- Do a requirement analysis. E.g.: What assumptions must we make so that
this problem is doable?
2.1 Exam Questions
- Develop clearly stated specs, in (i) well chosen English, and also
in (ii) Math + Logic + Grammar, for Peter Naur's Telegram problem
reproduced here. Resolve all ambiguities, "sins",
etc. sympathetically, and focus on specs. "Given a text consisting
of words separated by BLANKS or by NL (new line) characters,
convert it to a line-by-line form in accordance with the following
rules: (1) line breaks must be made only where the given text has
BLANK or NL; (2) each line is filled as far as possible, as long as
(3) no line will contain more than MAXPOS characters."
- Develop a design for the above in VHLL, a very high level pseudo
code language. The pseudo code should be good enough for a
sophomore to code it in Java without any interaction with you.
3 References
- Ledgard, Henry F. "The case for structured programming." BIT
Numerical Mathematics 14.1 (1974): 45-57.
- Noonan, Robert E. "Structured programming and formal
specification." IEEE Transactions on Software Engineering, 4
(1975): 421-425.
- Gerhart, Susan L., and Lawrence Yelowitz. "Observations of
Fallibility in Applications of Modern Programming Methodologies."
IEEE Transactions on Software Engineering, 3 (1976): 195-207.
- McKeeman, W. M. Respecifying the telegram
problem. No. 77-2-001. U of California, Santa Cruz, 1977.
- Torii, Koji, et al. "Functional programming and logical programming
for the telegram analysis problem." Proceedings of the 7th
international conference on Software engineering. IEEE Press, 1984.
- Meyer, Bertrand, "On Formalism In Specifications", IEEE Software,
1985, vol. 2, no. 1. pp. 6-26. (Meyer is the designer of the
excellent OOPL named Eiffel.) Required Reading.
Copyright © 2016 •
www.wright.edu/~pmateti 2016-02-15